JDK 10 RFR of JDK-8193194: Update javax.lang.model.util visitors for 10

Jonathan Gibbons jonathan.gibbons at oracle.com
Thu Dec 7 17:32:24 UTC 2017


+1

-- Jon


On 12/7/17 9:29 AM, joe darcy wrote:
> Hello,
>
> The javax.lang.model API was introduced in JDK 6 via JSR 269. In JDK 
> 7, 8, and 9 new sets of concrete visitors were added in the 
> javax.lang.model.util package. In JDKs 7, 8, and 9, there were new 
> language changes that required new modeling constructs. There are no 
> such changes in JDK 10. Therefore, a new set of visitors will not be 
> added for JDK 10. However, some minor updates to the JDK 9 visitors 
> should be made to indicate they cover both JDK 9 and JDK 10 constructs.
>
> Please review the patch below which implements the updates.
>
> -Joe
>
> diff -r 56d3576aadd5 
> src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor9.java
> --- 
> a/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor9.java 
> Mon Dec 04 19:12:57 2017 +0100
> +++ 
> b/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor9.java 
> Thu Dec 07 09:28:13 2017 -0800
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights 
> reserved.
> + * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights 
> reserved.
>   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
>   *
>   * This code is free software; you can redistribute it and/or modify it
> @@ -32,7 +32,7 @@
>  /**
>   * A skeletal visitor for annotation values with default behavior
>   * appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9}
> - * source version.
> + * and {@link SourceVersion#RELEASE_10 RELEASE_10} source versions.
>   *
>   * <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
>   */
> - at SupportedSourceVersion(RELEASE_9)
> + at SupportedSourceVersion(RELEASE_10)
>  public abstract class AbstractAnnotationValueVisitor9<R, P> extends 
> AbstractAnnotationValueVisitor8<R, P> {
>
>      /**
> diff -r 56d3576aadd5 
> src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor9.java
> --- 
> a/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor9.java 
> Mon Dec 04 19:12:57 2017 +0100
> +++ 
> b/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor9.java 
> Thu Dec 07 09:28:13 2017 -0800
> @@ -34,7 +34,7 @@
>  /**
>   * A skeletal visitor of program elements with default behavior
>   * appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9}
> - * source version.
> + * and {@link SourceVersion#RELEASE_10 RELEASE_10} source versions.
>   *
>   * <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
>   */
> - at SupportedSourceVersion(RELEASE_9)
> + at SupportedSourceVersion(RELEASE_10)
>  public abstract class AbstractElementVisitor9<R, P> extends 
> AbstractElementVisitor8<R, P> {
>      /**
>       * Constructor for concrete subclasses to call.
> diff -r 56d3576aadd5 
> src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor9.java
> --- 
> a/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor9.java 
> Mon Dec 04 19:12:57 2017 +0100
> +++ 
> b/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor9.java 
> Thu Dec 07 09:28:13 2017 -0800
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights 
> reserved.
> + * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights 
> reserved.
>   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
>   *
>   * This code is free software; you can redistribute it and/or modify it
> @@ -27,13 +27,13 @@
>
>  import javax.annotation.processing.SupportedSourceVersion;
>  import javax.lang.model.type.*;
> -
> +import javax.lang.model.SourceVersion;
>  import static javax.lang.model.SourceVersion.*;
>
>  /**
>   * A skeletal visitor of types with default behavior appropriate for
> - * the {@link javax.lang.model.SourceVersion#RELEASE_9 RELEASE_9}
> - * source version.
> + * the {@link SourceVersion#RELEASE_9 RELEASE_9}
> + * and {@link SourceVersion#RELEASE_10 RELEASE_10} source versions.
>   *
>   * <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
>   */
> - at SupportedSourceVersion(RELEASE_9)
> + at SupportedSourceVersion(RELEASE_10)
>  public abstract class AbstractTypeVisitor9<R, P> extends 
> AbstractTypeVisitor8<R, P> {
>      /**
>       * Constructor for concrete subclasses to call.
> diff -r 56d3576aadd5 
> src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java
> --- 
> a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java 
> Mon Dec 04 19:12:57 2017 +0100
> +++ 
> b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java 
> Thu Dec 07 09:28:13 2017 -0800
> @@ -33,7 +33,8 @@
>  /**
>   * 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
> + * SourceVersion#RELEASE_9 RELEASE_9} and {@link
> + * SourceVersion#RELEASE_10 RELEASE_10} source versions. 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
> @@ -77,7 +78,7 @@
>   * @since 9
>   * @spec JPMS
>   */
> - at SupportedSourceVersion(RELEASE_9)
> + at SupportedSourceVersion(RELEASE_10)
>  public class ElementKindVisitor9<R, P> extends ElementKindVisitor8<R, 
> P> {
>      /**
>       * Constructor for concrete subclasses; uses {@code null} for the
> diff -r 56d3576aadd5 
> src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java
> --- 
> a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java 
> Mon Dec 04 19:12:57 2017 +0100
> +++ 
> b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java 
> Thu Dec 07 09:28:13 2017 -0800
> @@ -34,7 +34,8 @@
>  /**
>   * A scanning visitor of program elements with default behavior
>   * appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9}
> - * source version.  The <code>visit<i>Xyz</i></code> methods in this
> + * and {@link SourceVersion#RELEASE_10 RELEASE_10} source versions.
> + * 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},
>   * {@linkplain ExecutableElement#getParameters parameters}, etc., as
> @@ -90,7 +91,7 @@
>   * @since 9
>   * @spec JPMS
>   */
> - at SupportedSourceVersion(RELEASE_9)
> + at SupportedSourceVersion(RELEASE_10)
>  public class ElementScanner9<R, P> extends ElementScanner8<R, P> {
>      /**
>       * Constructor for concrete subclasses; uses {@code null} for the
> diff -r 56d3576aadd5 
> src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor9.java
> --- 
> a/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor9.java 
> Mon Dec 04 19:12:57 2017 +0100
> +++ 
> b/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor9.java 
> Thu Dec 07 09:28:13 2017 -0800
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights 
> reserved.
> + * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights 
> reserved.
>   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
>   *
>   * This code is free software; you can redistribute it and/or modify it
> @@ -32,7 +32,8 @@
>  /**
>   * 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
> + * and {@link SourceVersion#RELEASE_10 RELEASE_10} source versions.
> + * Visit methods call {@link #defaultAction
>   * defaultAction} passing their arguments to {@code defaultAction}'s
>   * corresponding parameters.
>   *
> @@ -66,7 +67,7 @@
>   * @see SimpleAnnotationValueVisitor8
>   * @since 9
>   */
> - at SupportedSourceVersion(RELEASE_9)
> + at SupportedSourceVersion(RELEASE_10)
>  public class SimpleAnnotationValueVisitor9<R, P> extends 
> SimpleAnnotationValueVisitor8<R, P> {
>      /**
>       * Constructor for concrete subclasses; uses {@code null} for the
> diff -r 56d3576aadd5 
> src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor9.java
> --- 
> a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor9.java 
> Mon Dec 04 19:12:57 2017 +0100
> +++ 
> b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor9.java 
> Thu Dec 07 09:28:13 2017 -0800
> @@ -33,7 +33,7 @@
>  /**
>   * A simple visitor of program elements with default behavior
>   * appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9}
> - * source version.
> + * and {@link SourceVersion#RELEASE_10 RELEASE_10} source versions.
>   *
>   * Visit methods corresponding to {@code RELEASE_9} and earlier
>   * language constructs call {@link #defaultAction defaultAction},
> @@ -73,7 +73,7 @@
>   * @since 9
>   * @spec JPMS
>   */
> - at SupportedSourceVersion(RELEASE_9)
> + at SupportedSourceVersion(RELEASE_10)
>  public class SimpleElementVisitor9<R, P> extends 
> SimpleElementVisitor8<R, P> {
>      /**
>       * Constructor for concrete subclasses; uses {@code null} for the
> diff -r 56d3576aadd5 
> src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor9.java
> --- 
> a/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor9.java 
> Mon Dec 04 19:12:57 2017 +0100
> +++ 
> b/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor9.java 
> Thu Dec 07 09:28:13 2017 -0800
> @@ -32,7 +32,8 @@
>
>  /**
>   * A simple visitor of types with default behavior appropriate for the
> - * {@link SourceVersion#RELEASE_9 RELEASE_9} source version.
> + * {@link SourceVersion#RELEASE_9 RELEASE_9} and
> + * {@link SourceVersion#RELEASE_10 RELEASE_10} source versions.
>   *
>   * Visit methods corresponding to {@code RELEASE_9} and earlier
>   * language constructs call {@link #defaultAction defaultAction},
> @@ -71,7 +72,7 @@
>   * @see SimpleTypeVisitor7
>   * @since 9
>   */
> - at SupportedSourceVersion(RELEASE_9)
> + at SupportedSourceVersion(RELEASE_10)
>  public class SimpleTypeVisitor9<R, P> extends SimpleTypeVisitor8<R, P> {
>      /**
>       * Constructor for concrete subclasses; uses {@code null} for the
> diff -r 56d3576aadd5 
> src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java
> --- 
> a/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java 
> Mon Dec 04 19:12:57 2017 +0100
> +++ 
> b/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java 
> Thu Dec 07 09:28:13 2017 -0800
> @@ -33,7 +33,8 @@
>  /**
>   * 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
> + * RELEASE_9} and {@link SourceVersion#RELEASE_10 RELEASE_10} source
> + * versions. 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
> @@ -74,7 +75,7 @@
>   * @see TypeKindVisitor8
>   * @since 9
>   */
> - at SupportedSourceVersion(RELEASE_9)
> + at SupportedSourceVersion(RELEASE_10)
>  public class TypeKindVisitor9<R, P> extends TypeKindVisitor8<R, P> {
>      /**
>       * Constructor for concrete subclasses to call; uses {@code null}
>



More information about the compiler-dev mailing list