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

Provided new utility visitors supporting SourceVersion.RELEASE_9

    XMLWordPrintable

    Details

    • Subcomponent:
    • Compatibility Risk:
      low
    • Compatibility Risk Description:
      Existing types deprecated, but otherwise normal evolution for this API.
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      Add the suite of FooVisitor9 types in the usual way for the javax.lang.model API, deprecate the FooVisitor6 types, and add missing @SupportedSourceVersion annotations.

      Problem

      With a new platform release, the time has come to define javax.lang.model utility visitor appropriate for the release.

      Solution

      Besides adding the new FooVisitor9 types, also:

      • Deprecate the FooVisitor6 types

      • Add missing @SupportedSourceVersion  annotations to AbstractTypeVisitor{6, 7, 8}.

      Specification

      Deprecate the following classes:
      
      AbstractAnnotationValueVisitor6
      AbstractElementVisitor6
      AbstractTypeVisitor6
      ElementKindVisitor6
      ElementScanner6
      SimpleAnnotationValueVisitor6
      SimpleElementVisitor6
      SimpleTypeVisitor6
      TypeKindVisitor6
      
      Add @SupportedSourceVersion annotations as follows:
      
      @SupportedSourceVersion(RELEASE_6) to AbstractTypeVisitor6
      @SupportedSourceVersion(RELEASE_7) to AbstractTypeVisitor7
      @SupportedSourceVersion(RELEASE_8) to AbstractTypeVisitor8
      
      Add the following types:
      
      AbstractAnnotationValueVisitor9
      AbstractElementVisitor9
      AbstractTypeVisitor9
      ElementKindVisitor9
      ElementScanner9
      SimpleAnnotationValueVisitor9
      SimpleElementVisitor9
      SimpleTypeVisitor9
      TypeKindVisitor9
      
      Specification of those types below:
      
      +/**
      + * A skeletal visitor for annotation values with default behavior
      + * appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9}
      + * source version.
      + *
      + * <p> <b>WARNING:</b> The {@code AnnotationValueVisitor} interface
      + * implemented by this class may have methods added to it in the
      + * future to accommodate new, currently unknown, language structures
      + * added to future versions of the Java&trade; programming language.
      + * Therefore, methods whose names begin with {@code "visit"} may be
      + * added to this class in the future; to avoid incompatibilities,
      + * classes which extend this class should not declare any instance
      + * methods with names beginning with {@code "visit"}.
      + *
      + * <p>When such a new visit method is added, the default
      + * implementation in this class will be to call the {@link
      + * #visitUnknown visitUnknown} method.  A new abstract annotation
      + * value visitor class will also be introduced to correspond to the
      + * new language level; this visitor will have different default
      + * behavior for the visit method in question.  When the new visitor is
      + * introduced, all or portions of this visitor may be deprecated.
      + *
      + * @param <R> the return type of this visitor's methods
      + * @param <P> the type of the additional parameter to this visitor's methods.
      + *
      + * @see AbstractAnnotationValueVisitor6
      + * @see AbstractAnnotationValueVisitor7
      + * @see AbstractAnnotationValueVisitor8
      + * @since 1.9
      + */
      +@SupportedSourceVersion(RELEASE_9)
      +public abstract class AbstractAnnotationValueVisitor9<R, P> extends AbstractAnnotationValueVisitor8<R, P> {
      +
      +    /**
      +     * Constructor for concrete subclasses to call.
      +     */
      +    protected AbstractAnnotationValueVisitor9() {
      +        super();
      +    }
      +}
      
      +/**
      + * A skeletal visitor of program elements with default behavior
      + * appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9}
      + * source version.
      + *
      + * <p> <b>WARNING:</b> The {@code ElementVisitor} interface
      + * implemented by this class may have methods added to it in the
      + * future to accommodate new, currently unknown, language structures
      + * added to future versions of the Java&trade; programming language.
      + * Therefore, methods whose names begin with {@code "visit"} may be
      + * added to this class in the future; to avoid incompatibilities,
      + * classes which extend this class should not declare any instance
      + * methods with names beginning with {@code "visit"}.
      + *
      + * <p>When such a new visit method is added, the default
      + * implementation in this class will be to call the {@link
      + * #visitUnknown visitUnknown} method.  A new abstract element visitor
      + * class will also be introduced to correspond to the new language
      + * level; this visitor will have different default behavior for the
      + * visit method in question.  When the new visitor is introduced, all
      + * or portions of this visitor may be deprecated.
      + *
      + * @param <R> the return type of this visitor's methods.  Use {@link
      + *            Void} for visitors that do not need to return results.
      + * @param <P> the type of the additional parameter to this visitor's
      + *            methods.  Use {@code Void} for visitors that do not need an
      + *            additional parameter.
      + *
      + * @see AbstractElementVisitor6
      + * @see AbstractElementVisitor7
      + * @see AbstractElementVisitor8
      + * @since 1.9
      + */
      +@SupportedSourceVersion(RELEASE_9)
      +public abstract class AbstractElementVisitor9<R, P> extends AbstractElementVisitor8<R, P> {
      +    /**
      +     * Constructor for concrete subclasses to call.
      +     */
      +    protected AbstractElementVisitor9(){
      +        super();
      +    }
      +}
      
      +/**
      + * A skeletal visitor of types with default behavior appropriate for
      + * the {@link javax.lang.model.SourceVersion#RELEASE_9 RELEASE_9}
      + * source version.
      + *
      + * <p> <b>WARNING:</b> The {@code TypeVisitor} interface implemented
      + * by this class may have methods added to it in the future to
      + * accommodate new, currently unknown, language structures added to
      + * future versions of the Java&trade; programming language.
      + * Therefore, methods whose names begin with {@code "visit"} may be
      + * added to this class in the future; to avoid incompatibilities,
      + * classes which extend this class should not declare any instance
      + * methods with names beginning with {@code "visit"}.
      + *
      + * <p>When such a new visit method is added, the default
      + * implementation in this class will be to call the {@link
      + * #visitUnknown visitUnknown} method.  A new abstract type visitor
      + * class will also be introduced to correspond to the new language
      + * level; this visitor will have different default behavior for the
      + * visit method in question.  When the new visitor is introduced, all
      + * or portions of this visitor may be deprecated.
      + *
      + * @param <R> the return type of this visitor's methods.  Use {@link
      + *            Void} for visitors that do not need to return results.
      + * @param <P> the type of the additional parameter to this visitor's
      + *            methods.  Use {@code Void} for visitors that do not need an
      + *            additional parameter.
      + *
      + * @see AbstractTypeVisitor6
      + * @see AbstractTypeVisitor7
      + * @see AbstractTypeVisitor8
      + * @since 1.9
      + */
      +@SupportedSourceVersion(RELEASE_9)
      +public abstract class AbstractTypeVisitor9<R, P> extends AbstractTypeVisitor8<R, P> {
      +    /**
      +     * Constructor for concrete subclasses to call.
      +     */
      +    protected AbstractTypeVisitor9() {
      +        super();
      +    }
      +}
      
      +/**
      + * A visitor of program elements based on their {@linkplain
      + * ElementKind kind} with default behavior appropriate for the {@link
      + * SourceVersion#RELEASE_9 RELEASE_9} source version.  For {@linkplain
      + * Element elements} <tt><i>XYZ</i></tt> that may have more than one
      + * kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
      + * to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
      + * first argument's kind.  The <tt>visit<i>XYZKind</i></tt> methods
      + * call {@link #defaultAction defaultAction}, passing their arguments
      + * to {@code defaultAction}'s corresponding parameters.
      + *
      + * <p> Methods in this class may be overridden subject to their
      + * general contract.  Note that annotating methods in concrete
      + * subclasses with {@link java.lang.Override @Override} will help
      + * ensure that methods are overridden as intended.
      + *
      + * <p> <b>WARNING:</b> The {@code ElementVisitor} interface
      + * implemented by this class may have methods added to it or the
      + * {@code ElementKind} {@code enum} used in this case may have
      + * constants added to it in the future to accommodate new, currently
      + * unknown, language structures added to future versions of the
      + * Java&trade; programming language.  Therefore, methods whose names
      + * begin with {@code "visit"} may be added to this class in the
      + * future; to avoid incompatibilities, classes which extend this class
      + * should not declare any instance methods with names beginning with
      + * {@code "visit"}.
      + *
      + * <p>When such a new visit method is added, the default
      + * implementation in this class will be to call the {@link
      + * #visitUnknown visitUnknown} method.  A new abstract element kind
      + * visitor class will also be introduced to correspond to the new
      + * language level; this visitor will have different default behavior
      + * for the visit method in question.  When the new visitor is
      + * introduced, all or portions of this visitor may be deprecated.
      + *
      + * @param <R> the return type of this visitor's methods.  Use {@link
      + *            Void} for visitors that do not need to return results.
      + * @param <P> the type of the additional parameter to this visitor's
      + *            methods.  Use {@code Void} for visitors that do not need an
      + *            additional parameter.
      + *
      + * @see ElementKindVisitor6
      + * @see ElementKindVisitor7
      + * @see ElementKindVisitor8
      + * @since 1.9
      + */
      +@SupportedSourceVersion(RELEASE_9)
      +public class ElementKindVisitor9<R, P> extends ElementKindVisitor8<R, P> {
      +    /**
      +     * Constructor for concrete subclasses; uses {@code null} for the
      +     * default value.
      +     */
      +    protected ElementKindVisitor9() {
      +        super(null);
      +    }
      +
      +    /**
      +     * Constructor for concrete subclasses; uses the argument for the
      +     * default value.
      +     *
      +     * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
      +     */
      +    protected ElementKindVisitor9(R defaultValue) {
      +        super(defaultValue);
      +    }
      +}
      
      +/**
      + * A scanning visitor of program elements with default behavior
      + * appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9}
      + * source version.  The <tt>visit<i>XYZ</i></tt> methods in this
      + * class scan their component elements by calling {@code scan} on
      + * their {@linkplain Element#getEnclosedElements enclosed elements},
      + * {@linkplain ExecutableElement#getParameters parameters}, etc., as
      + * indicated in the individual method specifications.  A subclass can
      + * control the order elements are visited by overriding the
      + * <tt>visit<i>XYZ</i></tt> methods.  Note that clients of a scanner
      + * may get the desired behavior be invoking {@code v.scan(e, p)} rather
      + * than {@code v.visit(e, p)} on the root objects of interest.
      + *
      + * <p>When a subclass overrides a <tt>visit<i>XYZ</i></tt> method, the
      + * new method can cause the enclosed elements to be scanned in the
      + * default way by calling <tt>super.visit<i>XYZ</i></tt>.  In this
      + * fashion, the concrete visitor can control the ordering of traversal
      + * over the component elements with respect to the additional
      + * processing; for example, consistently calling
      + * <tt>super.visit<i>XYZ</i></tt> at the start of the overridden
      + * methods will yield a preorder traversal, etc.  If the component
      + * elements should be traversed in some other order, instead of
      + * calling <tt>super.visit<i>XYZ</i></tt>, an overriding visit method
      + * should call {@code scan} with the elements in the desired order.
      + *
      + * <p> Methods in this class may be overridden subject to their
      + * general contract.  Note that annotating methods in concrete
      + * subclasses with {@link java.lang.Override @Override} will help
      + * ensure that methods are overridden as intended.
      + *
      + * <p> <b>WARNING:</b> The {@code ElementVisitor} interface
      + * implemented by this class may have methods added to it in the
      + * future to accommodate new, currently unknown, language structures
      + * added to future versions of the Java&trade; programming language.
      + * Therefore, methods whose names begin with {@code "visit"} may be
      + * added to this class in the future; to avoid incompatibilities,
      + * classes which extend this class should not declare any instance
      + * methods with names beginning with {@code "visit"}.
      + *
      + * <p>When such a new visit method is added, the default
      + * implementation in this class will be to call the {@link
      + * #visitUnknown visitUnknown} method.  A new element scanner visitor
      + * class will also be introduced to correspond to the new language
      + * level; this visitor will have different default behavior for the
      + * visit method in question.  When the new visitor is introduced, all
      + * or portions of this visitor may be deprecated.
      + *
      + * @param <R> the return type of this visitor's methods.  Use {@link
      + *            Void} for visitors that do not need to return results.
      + * @param <P> the type of the additional parameter to this visitor's
      + *            methods.  Use {@code Void} for visitors that do not need an
      + *            additional parameter.
      + *
      + * @see ElementScanner6
      + * @see ElementScanner7
      + * @see ElementScanner8
      + * @since 1.9
      + */
      +@SupportedSourceVersion(RELEASE_9)
      +public class ElementScanner9<R, P> extends ElementScanner8<R, P> {
      +    /**
      +     * Constructor for concrete subclasses; uses {@code null} for the
      +     * default value.
      +     */
      +    protected ElementScanner9(){
      +        super(null);
      +    }
      +
      +    /**
      +     * Constructor for concrete subclasses; uses the argument for the
      +     * default value.
      +     *
      +     * @param defaultValue the default value
      +     */
      +    protected ElementScanner9(R defaultValue){
      +        super(defaultValue);
      +    }
      +}
      
      +/**
      + * A simple visitor for annotation values with default behavior
      + * appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9}
      + * source version.  Visit methods call {@link #defaultAction
      + * defaultAction} passing their arguments to {@code defaultAction}'s
      + * corresponding parameters.
      + *
      + * <p> Methods in this class may be overridden subject to their
      + * general contract.  Note that annotating methods in concrete
      + * subclasses with {@link java.lang.Override @Override} will help
      + * ensure that methods are overridden as intended.
      + *
      + * <p> <b>WARNING:</b> The {@code AnnotationValueVisitor} interface
      + * implemented by this class may have methods added to it in the
      + * future to accommodate new, currently unknown, language structures
      + * added to future versions of the Java&trade; programming language.
      + * Therefore, methods whose names begin with {@code "visit"} may be
      + * added to this class in the future; to avoid incompatibilities,
      + * classes which extend this class should not declare any instance
      + * methods with names beginning with {@code "visit"}.
      + *
      + * <p>When such a new visit method is added, the default
      + * implementation in this class will be to call the {@link
      + * #visitUnknown visitUnknown} method.  A new simple annotation
      + * value visitor class will also be introduced to correspond to the
      + * new language level; this visitor will have different default
      + * behavior for the visit method in question.  When the new visitor is
      + * introduced, all or portions of this visitor may be deprecated.
      + *
      + * @param <R> the return type of this visitor's methods
      + * @param <P> the type of the additional parameter to this visitor's methods.
      + *
      + * @see SimpleAnnotationValueVisitor6
      + * @see SimpleAnnotationValueVisitor7
      + * @see SimpleAnnotationValueVisitor8
      + * @since 1.9
      + */
      +@SupportedSourceVersion(RELEASE_9)
      +public class SimpleAnnotationValueVisitor9<R, P> extends SimpleAnnotationValueVisitor8<R, P> {
      +    /**
      +     * Constructor for concrete subclasses; uses {@code null} for the
      +     * default value.
      +     */
      +    protected SimpleAnnotationValueVisitor9() {
      +        super(null);
      +    }
      +
      +    /**
      +     * Constructor for concrete subclasses; uses the argument for the
      +     * default value.
      +     *
      +     * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
      +     */
      +    protected SimpleAnnotationValueVisitor9(R defaultValue) {
      +        super(defaultValue);
      +    }
      +}
      
      
      +/**
      + * A simple visitor of program elements with default behavior
      + * appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9}
      + * source version.
      + *
      + * Visit methods corresponding to {@code RELEASE_9} and earlier
      + * language constructs call {@link #defaultAction defaultAction},
      + * passing their arguments to {@code defaultAction}'s corresponding
      + * parameters.
      + *
      + * <p> Methods in this class may be overridden subject to their
      + * general contract.  Note that annotating methods in concrete
      + * subclasses with {@link java.lang.Override @Override} will help
      + * ensure that methods are overridden as intended.
      + *
      + * <p> <b>WARNING:</b> The {@code ElementVisitor} interface
      + * implemented by this class may have methods added to it in the
      + * future to accommodate new, currently unknown, language structures
      + * added to future versions of the Java&trade; programming language.
      + * Therefore, methods whose names begin with {@code "visit"} may be
      + * added to this class in the future; to avoid incompatibilities,
      + * classes which extend this class should not declare any instance
      + * methods with names beginning with {@code "visit"}.
      + *
      + * <p>When such a new visit method is added, the default
      + * implementation in this class will be to call the {@link
      + * #visitUnknown visitUnknown} method.  A new simple element visitor
      + * class will also be introduced to correspond to the new language
      + * level; this visitor will have different default behavior for the
      + * visit method in question.  When the new visitor is introduced, all
      + * or portions of this visitor may be deprecated.
      + *
      + * @param <R> the return type of this visitor's methods.  Use {@code Void}
      + *             for visitors that do not need to return results.
      + * @param <P> the type of the additional parameter to this visitor's methods.  Use {@code Void}
      + *              for visitors that do not need an additional parameter.
      + *
      + * @see SimpleElementVisitor6
      + * @see SimpleElementVisitor7
      + * @see SimpleElementVisitor8
      + * @since 1.9
      + */
      +@SupportedSourceVersion(RELEASE_9)
      +public class SimpleElementVisitor9<R, P> extends SimpleElementVisitor8<R, P> {
      +    /**
      +     * Constructor for concrete subclasses; uses {@code null} for the
      +     * default value.
      +     */
      +    protected SimpleElementVisitor9(){
      +        super(null);
      +    }
      +
      +    /**
      +     * Constructor for concrete subclasses; uses the argument for the
      +     * default value.
      +     *
      +     * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
      +     */
      +    protected SimpleElementVisitor9(R defaultValue){
      +        super(defaultValue);
      +    }
      +}
      
      +/**
      + * A simple visitor of types with default behavior appropriate for the
      + * {@link SourceVersion#RELEASE_9 RELEASE_9} source version.
      + *
      + * Visit methods corresponding to {@code RELEASE_8} and earlier
      + * language constructs call {@link #defaultAction defaultAction},
      + * passing their arguments to {@code defaultAction}'s corresponding
      + * parameters.
      + *
      + * <p> Methods in this class may be overridden subject to their
      + * general contract.  Note that annotating methods in concrete
      + * subclasses with {@link java.lang.Override @Override} will help
      + * ensure that methods are overridden as intended.
      + *
      + * <p> <b>WARNING:</b> The {@code TypeVisitor} interface implemented
      + * by this class may have methods added to it in the future to
      + * accommodate new, currently unknown, language structures added to
      + * future versions of the Java&trade; programming language.
      + * Therefore, methods whose names begin with {@code "visit"} may be
      + * added to this class in the future; to avoid incompatibilities,
      + * classes which extend this class should not declare any instance
      + * methods with names beginning with {@code "visit"}.
      + *
      + * <p>When such a new visit method is added, the default
      + * implementation in this class will be to call the {@link
      + * #visitUnknown visitUnknown} method.  A new simple type visitor
      + * class will also be introduced to correspond to the new language
      + * level; this visitor will have different default behavior for the
      + * visit method in question.  When the new visitor is introduced, all
      + * or portions of this visitor may be deprecated.
      + *
      + * @param <R> the return type of this visitor's methods.  Use {@link
      + *            Void} for visitors that do not need to return results.
      + * @param <P> the type of the additional parameter to this visitor's
      + *            methods.  Use {@code Void} for visitors that do not need an
      + *            additional parameter.
      + *
      + * @see SimpleTypeVisitor6
      + * @see SimpleTypeVisitor7
      + * @since 1.8
      + */
      +@SupportedSourceVersion(RELEASE_9)
      +public class SimpleTypeVisitor9<R, P> extends SimpleTypeVisitor8<R, P> {
      +    /**
      +     * Constructor for concrete subclasses; uses {@code null} for the
      +     * default value.
      +     */
      +    protected SimpleTypeVisitor9(){
      +        super(null);
      +    }
      +
      +    /**
      +     * Constructor for concrete subclasses; uses the argument for the
      +     * default value.
      +     *
      +     * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
      +     */
      +    protected SimpleTypeVisitor9(R defaultValue){
      +        super(defaultValue);
      +    }
      +}
      
      
      +/**
      + * A visitor of types based on their {@linkplain TypeKind kind} with
      + * default behavior appropriate for the {@link SourceVersion#RELEASE_9
      + * RELEASE_9} source version.  For {@linkplain
      + * TypeMirror types} <tt><i>XYZ</i></tt> that may have more than one
      + * kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
      + * to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
      + * first argument's kind.  The <tt>visit<i>XYZKind</i></tt> methods
      + * call {@link #defaultAction defaultAction}, passing their arguments
      + * to {@code defaultAction}'s corresponding parameters.
      + *
      + * <p> Methods in this class may be overridden subject to their
      + * general contract.  Note that annotating methods in concrete
      + * subclasses with {@link java.lang.Override @Override} will help
      + * ensure that methods are overridden as intended.
      + *
      + * <p> <b>WARNING:</b> The {@code TypeVisitor} interface implemented
      + * by this class may have methods added to it in the future to
      + * accommodate new, currently unknown, language structures added to
      + * future versions of the Java&trade; programming language.
      + * Therefore, methods whose names begin with {@code "visit"} may be
      + * added to this class in the future; to avoid incompatibilities,
      + * classes which extend this class should not declare any instance
      + * methods with names beginning with {@code "visit"}.
      + *
      + * <p>When such a new visit method is added, the default
      + * implementation in this class will be to call the {@link
      + * #visitUnknown visitUnknown} method.  A new type kind visitor class
      + * will also be introduced to correspond to the new language level;
      + * this visitor will have different default behavior for the visit
      + * method in question.  When the new visitor is introduced, all or
      + * portions of this visitor may be deprecated.
      + *
      + * @param <R> the return type of this visitor's methods.  Use {@link
      + *            Void} for visitors that do not need to return results.
      + * @param <P> the type of the additional parameter to this visitor's
      + *            methods.  Use {@code Void} for visitors that do not need an
      + *            additional parameter.
      + *
      + * @see TypeKindVisitor6
      + * @see TypeKindVisitor7
      + * @since 1.9
      + */
      +@SupportedSourceVersion(RELEASE_9)
      +public class TypeKindVisitor9<R, P> extends TypeKindVisitor8<R, P> {
      +    /**
      +     * Constructor for concrete subclasses to call; uses {@code null}
      +     * for the default value.
      +     */
      +    protected TypeKindVisitor9() {
      +        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}
      +     */
      +    protected TypeKindVisitor9(R defaultValue) {
      +        super(defaultValue);
      +    }
      +}

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: