Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8202335

Update javax.lang.model.util visitors for 11

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 11
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      Only updating annotations to indicate a later source version is also supported.
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      Update the existing javax.lang.model utility visitors for the 9 release to indicate they are appropriate for the 11 release as well.

      Problem

      The javax.lang.model API was added in Java SE 6. In each of Java SE 7, 8, and 9, new sets of utility visitors were added for each release, for example starting with AbstractElementVisitor6, types AbstractElementVisitor7, AbstractElementVisitor8, AbstractElementVisitor8 were added in SE 7 and 8, respectively. Similar patterns were followed for ElementKindVisitor6, and the rest of the utility visitors.

      In Java SE 10, there were no language changes requiring new operational behavior from the root visitors. Therefore, rather than introducing yet another slate of visitor classes, the 9-era visitors were updated to indicate they are appropriate for 10 as well (JDK-8193201).

      In the absence of language changes in 11 which would require new operational behavior from the visitors, the 9-era visitors should be updated to indicate they are appropriate for releases 9 through 11.

      Solution

      Update the specification and SupportedSourceVersion annotations on the 9-era visitor classes to indicate they are appropriate for release 11.

      Specification

      --- old/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor9.java  2018-04-26 10:06:41.595567121 -0700
      +++ new/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor9.java  2018-04-26 10:06:41.023567096 -0700
      @@ -31,8 +31,8 @@
      
       /**
        * A skeletal visitor for annotation values with default behavior
      - * appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9}
      - * and {@link SourceVersion#RELEASE_10 RELEASE_10} source versions.
      + * appropriate for source versions {@link SourceVersion#RELEASE_9
      + * RELEASE_9} through {@link SourceVersion#RELEASE_11 RELEASE_11}.
        *
        * <p> <b>WARNING:</b> The {@code AnnotationValueVisitor} interface
        * implemented by this class may have methods added to it in the
      @@ -59,7 +59,7 @@
        * @see AbstractAnnotationValueVisitor8
        * @since 9
        */
      -@SupportedSourceVersion(RELEASE_10)
      +@SupportedSourceVersion(RELEASE_11)
       public abstract class AbstractAnnotationValueVisitor9<R, P> extends AbstractAnnotationValueVisitor8<R, P> {
      
           /**
      --- old/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor9.java  2018-04-26 10:06:43.619567210 -0700
      +++ new/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor9.java  2018-04-26 10:06:43.035567185 -0700
      @@ -33,8 +33,8 @@
      
       /**
        * A skeletal visitor of program elements with default behavior
      - * appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9}
      - * and {@link SourceVersion#RELEASE_10 RELEASE_10} source versions.
      + * appropriate for source versions {@link SourceVersion#RELEASE_9
      + * RELEASE_9} through {@link SourceVersion#RELEASE_11 RELEASE_11}.
        *
        * <p> <b>WARNING:</b> The {@code ElementVisitor} interface
        * implemented by this class may have methods added to it in the
      @@ -65,7 +65,7 @@
        * @since 9
        * @spec JPMS
        */
      -@SupportedSourceVersion(RELEASE_10)
      +@SupportedSourceVersion(RELEASE_11)
       public abstract class AbstractElementVisitor9<R, P> extends AbstractElementVisitor8<R, P> {
           /**
            * Constructor for concrete subclasses to call.
      --- old/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor9.java 2018-04-26 10:06:45.975567314 -0700
      +++ new/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor9.java 2018-04-26 10:06:45.191567280 -0700
      @@ -32,8 +32,8 @@
      
       /**
        * A skeletal visitor of types with default behavior appropriate for
      - * the {@link SourceVersion#RELEASE_9 RELEASE_9}
      - * and {@link SourceVersion#RELEASE_10 RELEASE_10} source versions.
      + * source versions {@link SourceVersion#RELEASE_9 RELEASE_9} through
      + * {@link SourceVersion#RELEASE_11 RELEASE_11}.
        *
        * <p> <b>WARNING:</b> The {@code TypeVisitor} interface implemented
        * by this class may have methods added to it in the future to
      @@ -63,7 +63,7 @@
        * @see AbstractTypeVisitor8
        * @since 9
        */
      -@SupportedSourceVersion(RELEASE_10)
      +@SupportedSourceVersion(RELEASE_11)
       public abstract class AbstractTypeVisitor9<R, P> extends AbstractTypeVisitor8<R, P> {
           /**
            * Constructor for concrete subclasses to call.
      --- old/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java  2018-04-26 10:06:48.131567409 -0700
      +++ new/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java  2018-04-26 10:06:47.407567377 -0700
      @@ -32,9 +32,11 @@
      
       /**
        * A visitor of program elements based on their {@linkplain
      - * ElementKind kind} with default behavior appropriate for the {@link
      - * SourceVersion#RELEASE_9 RELEASE_9} and {@link
      - * SourceVersion#RELEASE_10 RELEASE_10} source versions. For {@linkplain
      + * ElementKind kind} with default behavior appropriate for source
      + * versions {@link SourceVersion#RELEASE_9 RELEASE_9} through {@link
      + * SourceVersion#RELEASE_11 RELEASE_11}.
      + *
      + * For {@linkplain
        * Element elements} <code><i>Xyz</i></code> that may have more than one
        * kind, the <code>visit<i>Xyz</i></code> methods in this class delegate
        * to the <code>visit<i>Xyz</i>As<i>Kind</i></code> method corresponding to the
      @@ -78,7 +80,7 @@
        * @since 9
        * @spec JPMS
        */
      -@SupportedSourceVersion(RELEASE_10)
      +@SupportedSourceVersion(RELEASE_11)
       public class ElementKindVisitor9<R, P> extends ElementKindVisitor8<R, P> {
           /**
            * Constructor for concrete subclasses; uses {@code null} for the
      --- old/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java  2018-04-26 10:06:49.591567473 -0700
      +++ new/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java  2018-04-26 10:06:48.959567446 -0700
      @@ -33,8 +33,9 @@
      
       /**
        * A scanning visitor of program elements with default behavior
      - * appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9}
      - * and {@link SourceVersion#RELEASE_10 RELEASE_10} source versions.
      + * appropriate for source versions {@link SourceVersion#RELEASE_9
      + * RELEASE_9} through {@link SourceVersion#RELEASE_11 RELEASE_11}.
      + *
        * The <code>visit<i>Xyz</i></code> methods in this
        * class scan their component elements by calling {@code scan} on
        * their {@linkplain Element#getEnclosedElements enclosed elements},
      @@ -91,7 +92,7 @@
        * @since 9
        * @spec JPMS
        */
      -@SupportedSourceVersion(RELEASE_10)
      +@SupportedSourceVersion(RELEASE_11)
       public class ElementScanner9<R, P> extends ElementScanner8<R, P> {
           /**
            * Constructor for concrete subclasses; uses {@code null} for the
      --- old/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor9.java    2018-04-26 10:06:51.015567536 -0700
      +++ new/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor9.java    2018-04-26 10:06:50.387567508 -0700
      @@ -31,8 +31,9 @@
      
       /**
        * A simple visitor for annotation values with default behavior
      - * appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9}
      - * and {@link SourceVersion#RELEASE_10 RELEASE_10} source versions.
      + * appropriate for source versions {@link SourceVersion#RELEASE_9
      + * RELEASE_9} through {@link SourceVersion#RELEASE_11 RELEASE_11}.
      + *
        * Visit methods call {@link #defaultAction
        * defaultAction} passing their arguments to {@code defaultAction}'s
        * corresponding parameters.
      @@ -67,7 +68,7 @@
        * @see SimpleAnnotationValueVisitor8
        * @since 9
        */
      -@SupportedSourceVersion(RELEASE_10)
      +@SupportedSourceVersion(RELEASE_11)
       public class SimpleAnnotationValueVisitor9<R, P> extends SimpleAnnotationValueVisitor8<R, P> {
           /**
            * Constructor for concrete subclasses; uses {@code null} for the
      --- old/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor9.java    2018-04-26 10:06:52.687567610 -0700
      +++ new/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor9.java    2018-04-26 10:06:52.063567582 -0700
      @@ -32,8 +32,8 @@
      
       /**
        * A simple visitor of program elements with default behavior
      - * appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9}
      - * and {@link SourceVersion#RELEASE_10 RELEASE_10} source versions.
      + * appropriate for source versions {@link SourceVersion#RELEASE_9
      + * RELEASE_9} through {@link SourceVersion#RELEASE_11 RELEASE_11}.
        *
        * Visit methods corresponding to {@code RELEASE_9} and earlier
        * language constructs call {@link #defaultAction defaultAction},
      @@ -73,7 +73,7 @@
        * @since 9
        * @spec JPMS
        */
      -@SupportedSourceVersion(RELEASE_10)
      +@SupportedSourceVersion(RELEASE_11)
       public class SimpleElementVisitor9<R, P> extends SimpleElementVisitor8<R, P> {
           /**
            * Constructor for concrete subclasses; uses {@code null} for the
      --- old/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor9.java   2018-04-26 10:06:54.375567684 -0700
      +++ new/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor9.java   2018-04-26 10:06:53.779567658 -0700
      @@ -31,9 +31,9 @@
       import static javax.lang.model.SourceVersion.*;
      
       /**
      - * A simple visitor of types with default behavior appropriate for the
      - * {@link SourceVersion#RELEASE_9 RELEASE_9} and
      - * {@link SourceVersion#RELEASE_10 RELEASE_10} source versions.
      + * A simple visitor of types with default behavior appropriate for
      + * source versions {@link SourceVersion#RELEASE_9 RELEASE_9} through
      + * {@link SourceVersion#RELEASE_11 RELEASE_11}.
        *
        * Visit methods corresponding to {@code RELEASE_9} and earlier
        * language constructs call {@link #defaultAction defaultAction},
      @@ -70,9 +70,10 @@
        *
        * @see SimpleTypeVisitor6
        * @see SimpleTypeVisitor7
      + * @see SimpleTypeVisitor8
        * @since 9
        */
      -@SupportedSourceVersion(RELEASE_10)
      +@SupportedSourceVersion(RELEASE_11)
       public class SimpleTypeVisitor9<R, P> extends SimpleTypeVisitor8<R, P> {
           /**
            * Constructor for concrete subclasses; uses {@code null} for the
      --- old/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java 2018-04-26 10:06:55.735567744 -0700
      +++ new/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java 2018-04-26 10:06:55.131567717 -0700
      @@ -32,9 +32,11 @@
      
       /**
        * A visitor of types based on their {@linkplain TypeKind kind} with
      - * default behavior appropriate for the {@link SourceVersion#RELEASE_9
      - * RELEASE_9} and {@link SourceVersion#RELEASE_10 RELEASE_10} source
      - * versions. For {@linkplain
      + * default behavior appropriate for source versions {@link
      + * SourceVersion#RELEASE_9 RELEASE_9} through {@link
      + * SourceVersion#RELEASE_11 RELEASE_11}.
      + *
      + * For {@linkplain
        * TypeMirror types} <code><i>Xyz</i></code> that may have more than one
        * kind, the <code>visit<i>Xyz</i></code> methods in this class delegate
        * to the <code>visit<i>Xyz</i>As<i>Kind</i></code> method corresponding to the
      @@ -75,7 +77,7 @@
        * @see TypeKindVisitor8
        * @since 9
        */
      -@SupportedSourceVersion(RELEASE_10)
      +@SupportedSourceVersion(RELEASE_11)
       public class TypeKindVisitor9<R, P> extends TypeKindVisitor8<R, P> {
           /**
            * Constructor for concrete subclasses to call; uses {@code null}

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                darcy Joe Darcy
                Reporter:
                darcy Joe Darcy
                Reviewed By:
                Jonathan Gibbons
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: