Uploaded image for project: 'CCC Migration Project'
  1. CCC Migration Project
  2. CCC-8172686

Use less aggressive deprecation of utility visitors

XMLWordPrintable

    • low
    • The proposed deprecation has lower impact than the deprecation that has been in 9 for some time.
    • Java API
    • SE

      Summary

      Instead of deprecating the Java SE 6-era visitor types in javax.lang.model.util, just deprecation their constructors instead.

      Problem

      As part of JDK-8050430, the Java SE 6 vintage utility visitors in javax.lang.model.util were deprecated. This deprecation is a bit overly aggressive; deprecating the constructors of the utility visitors would suffice.

      Solution

      Deprecation the constructors of the visitors rather than the visitor types.

      Specification

      src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor6.java
      @@ -72,21 +72,21 @@
        *
        * @see AbstractAnnotationValueVisitor7
        * @see AbstractAnnotationValueVisitor8
        * @see AbstractAnnotationValueVisitor9
        * @since 1.6
      - * @deprecated Release 6 is obsolete; update to a visitor for a newer
      - * release level.
        */
      -@Deprecated
       @SupportedSourceVersion(RELEASE_6)
       public abstract class AbstractAnnotationValueVisitor6<R, P>
           implements AnnotationValueVisitor<R, P> {
      
           /**
            * Constructor for concrete subclasses to call.
      +     * @deprecated Release 6 is obsolete; update to a visitor for a newer
      +     * release level.
            */
      +    @Deprecated
           protected AbstractAnnotationValueVisitor6() {}
      
           /**
            * Visits an annotation value as if by passing itself to that
            * value's {@link AnnotationValue#accept accept}.  The invocation
      
      
      src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor6.java
      @@ -74,19 +74,19 @@
        *
        * @see AbstractElementVisitor7
        * @see AbstractElementVisitor8
        * @see AbstractElementVisitor9
        * @since 1.6
      - * @deprecated Release 6 is obsolete; update to a visitor for a newer
      - * release level.
        */
      -@Deprecated
       @SupportedSourceVersion(RELEASE_6)
       public abstract class AbstractElementVisitor6<R, P> implements ElementVisitor<R, P> {
           /**
            * Constructor for concrete subclasses to call.
      +     * @deprecated Release 6 is obsolete; update to a visitor for a newer
      +     * release level.
            */
      +    @Deprecated
           protected AbstractElementVisitor6(){}
      
           /**
            * Visits any program element as if by passing itself to that
            * element's {@link Element#accept accept} method.  The invocation
      
      src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor6.java
      
      @@ -73,19 +73,19 @@
        *
        * @see AbstractTypeVisitor7
        * @see AbstractTypeVisitor8
        * @see AbstractTypeVisitor9
        * @since 1.6
      - * @deprecated Release 6 is obsolete; update to a visitor for a newer
      - * release level.
        */
      -@Deprecated
       @SupportedSourceVersion(RELEASE_6)
       public abstract class AbstractTypeVisitor6<R, P> implements TypeVisitor<R, P> {
           /**
            * Constructor for concrete subclasses to call.
      +     * @deprecated Release 6 is obsolete; update to a visitor for a newer
      +     * release level.
            */
      +    @Deprecated
           protected AbstractTypeVisitor6() {}
      
           /**
            * Visits any type mirror as if by passing itself to that type
            * mirror's {@link TypeMirror#accept accept} method.  The
      
      
      src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java
      
      @@ -88,31 +88,34 @@
        *
        * @see ElementKindVisitor7
        * @see ElementKindVisitor8
        * @see ElementKindVisitor9
        * @since 1.6
      - * @deprecated Release 6 is obsolete; update to a visitor for a newer
      - * release level.
        */
      -@Deprecated
       @SupportedSourceVersion(RELEASE_6)
       public class ElementKindVisitor6<R, P>
                         extends SimpleElementVisitor6<R, P> {
           /**
            * Constructor for concrete subclasses; uses {@code null} for the
            * default value.
      +     * @deprecated Release 6 is obsolete; update to a visitor for a newer
      +     * release level.
            */
      +    @Deprecated
           protected ElementKindVisitor6() {
               super(null);
           }
      
           /**
            * Constructor for concrete subclasses; uses the argument for the
            * default value.
            *
            * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
      +     * @deprecated Release 6 is obsolete; update to a visitor for a newer
      +     * release level.
            */
      +    @Deprecated
           protected ElementKindVisitor6(R defaultValue) {
               super(defaultValue);
           }
      
           /**
      
      src/java.compiler/share/classes/javax/lang/model/util/ElementScanner6.java
      @@ -90,35 +90,38 @@
        *
        * @see ElementScanner7
        * @see ElementScanner8
        * @see ElementScanner9
        * @since 1.6
      - * @deprecated Release 6 is obsolete; update to a visitor for a newer
      - * release level.
        */
      -@Deprecated
       @SupportedSourceVersion(RELEASE_6)
       public class ElementScanner6<R, P> extends AbstractElementVisitor6<R, P> {
           /**
            * The specified default value.
            */
           protected final R DEFAULT_VALUE;
      
           /**
            * Constructor for concrete subclasses; uses {@code null} for the
            * default value.
      +     * @deprecated Release 6 is obsolete; update to a visitor for a newer
      +     * release level.
            */
      +    @Deprecated
           protected ElementScanner6(){
               DEFAULT_VALUE = null;
           }
      
           /**
            * Constructor for concrete subclasses; uses the argument for the
            * default value.
            *
            * @param defaultValue the default value
      +     * @deprecated Release 6 is obsolete; update to a visitor for a newer
      +     * release level.
            */
      +    @Deprecated
           protected ElementScanner6(R defaultValue){
               DEFAULT_VALUE = defaultValue;
           }
      
           /**
      
      
      src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor6.java
      
      @@ -81,14 +81,11 @@
        *
        * @see SimpleAnnotationValueVisitor7
        * @see SimpleAnnotationValueVisitor8
        * @see SimpleAnnotationValueVisitor9
        * @since 1.6
      - * @deprecated Release 6 is obsolete; update to a visitor for a newer
      - * release level.
        */
      -@Deprecated
       @SupportedSourceVersion(RELEASE_6)
       public class SimpleAnnotationValueVisitor6<R, P>
           extends AbstractAnnotationValueVisitor6<R, P> {
      
           /**
      
      @@ -99,22 +96,28 @@
           protected final R DEFAULT_VALUE;
      
           /**
            * Constructor for concrete subclasses; uses {@code null} for the
            * default value.
      +     * @deprecated Release 6 is obsolete; update to a visitor for a newer
      +     * release level.
            */
      +    @Deprecated
           protected SimpleAnnotationValueVisitor6() {
               super();
               DEFAULT_VALUE = null;
           }
      
           /**
            * Constructor for concrete subclasses; uses the argument for the
            * default value.
            *
            * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
      +     * @deprecated Release 6 is obsolete; update to a visitor for a newer
      +     * release level.
            */
      +    @Deprecated
           protected SimpleAnnotationValueVisitor6(R defaultValue) {
               super();
               DEFAULT_VALUE = defaultValue;
           }
      
      
      src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor6.java
      @@ -85,14 +85,11 @@
        *
        * @see SimpleElementVisitor7
        * @see SimpleElementVisitor8
        * @see SimpleElementVisitor9
        * @since 1.6
      - * @deprecated Release 6 is obsolete; update to a visitor for a newer
      - * release level.
        */
      -@Deprecated
       @SupportedSourceVersion(RELEASE_6)
       public class SimpleElementVisitor6<R, P> extends AbstractElementVisitor6<R, P> {
           /**
            * Default value to be returned; {@link #defaultAction
            * defaultAction} returns this value unless the method is
      
      @@ -101,21 +98,27 @@
           protected final R DEFAULT_VALUE;
      
           /**
            * Constructor for concrete subclasses; uses {@code null} for the
            * default value.
      +     * @deprecated Release 6 is obsolete; update to a visitor for a newer
      +     * release level.
            */
      +    @Deprecated
           protected SimpleElementVisitor6(){
               DEFAULT_VALUE = null;
           }
      
           /**
            * Constructor for concrete subclasses; uses the argument for the
            * default value.
            *
            * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
      +     * @deprecated Release 6 is obsolete; update to a visitor for a newer
      +     * release level.
            */
      +    @Deprecated
           protected SimpleElementVisitor6(R defaultValue){
               DEFAULT_VALUE = defaultValue;
           }
           /**
            * The default action for visit methods.  The implementation in
      
      
      src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor6.java
      @@ -85,14 +85,11 @@
        *
        * @see SimpleTypeVisitor7
        * @see SimpleTypeVisitor8
        * @see SimpleTypeVisitor9
        * @since 1.6
      - * @deprecated Release 6 is obsolete; update to a visitor for a newer
      - * release level.
        */
      -@Deprecated
       @SupportedSourceVersion(RELEASE_6)
       public class SimpleTypeVisitor6<R, P> extends AbstractTypeVisitor6<R, P> {
           /**
            * Default value to be returned; {@link #defaultAction
            * defaultAction} returns this value unless the method is
      
      @@ -101,21 +98,27 @@
           protected final R DEFAULT_VALUE;
      
           /**
            * Constructor for concrete subclasses; uses {@code null} for the
            * default value.
      +     * @deprecated Release 6 is obsolete; update to a visitor for a newer
      +     * release level.
            */
      +    @Deprecated
           protected SimpleTypeVisitor6(){
               DEFAULT_VALUE = null;
           }
      
           /**
            * Constructor for concrete subclasses; uses the argument for the
            * default value.
            *
            * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
      +     * @deprecated Release 6 is obsolete; update to a visitor for a newer
      +     * release level.
            */
      +    @Deprecated
           protected SimpleTypeVisitor6(R defaultValue){
               DEFAULT_VALUE = defaultValue;
           }
      
           /**
      
      
      src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor6.java
      @@ -83,31 +83,34 @@
        * @author Peter von der Ah&eacute;
        *
        * @see TypeKindVisitor7
        * @see TypeKindVisitor8
        * @since 1.6
      - * @deprecated Release 6 is obsolete; update to a visitor for a newer
      - * release level.
        */
      -@Deprecated
       @SupportedSourceVersion(RELEASE_6)
       public class TypeKindVisitor6<R, P> extends SimpleTypeVisitor6<R, P> {
           /**
            * Constructor for concrete subclasses to call; uses {@code null}
            * for the default value.
      +     * @deprecated Release 6 is obsolete; update to a visitor for a newer
      +     * release level.
            */
      +    @Deprecated
           protected TypeKindVisitor6() {
               super(null);
           }
      
      
           /**
            * Constructor for concrete subclasses to call; uses the argument
            * for the default value.
            *
            * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
      +     * @deprecated Release 6 is obsolete; update to a visitor for a newer
      +     * release level.
            */
      +    @Deprecated
           protected TypeKindVisitor6(R defaultValue) {
               super(defaultValue);
           }
      
           /**

            darcy Joe Darcy
            darcy Joe Darcy
            Jonathan Gibbons
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: