JDK 10 RFR of JDK-8193191: Update JavacTestingAbstractProcessor for JDK 10

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

JDK 10 RFR of JDK-8193191: Update JavacTestingAbstractProcessor for JDK 10

Joseph D. Darcy
Hello,

Please review the straightforward patch below to update the
JavacTestingAbstractProcessor utility superclass to JDK 10.

      JDK-8193191: Update JavacTestingAbstractProcessor for JDK 10

Besides the use of Set.of, most of the updates are just bumping
@SupportedSourceVersion annotation from 9 to 10.

Thanks,

-Joe

diff -r 56d3576aadd5
test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java
--- a/test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java
Mon Dec 04 19:12:57 2017 +0100
+++ b/test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java
Thu Dec 07 09:04:27 2017 -0800
@@ -1,5 +1,5 @@
  /*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights
reserved.
+ * Copyright (c) 2010, 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
@@ -31,13 +31,7 @@
   * An abstract annotation processor tailored to {@code javac}
regression testing.
   */
  public abstract class JavacTestingAbstractProcessor extends
AbstractProcessor {
-    private static final Set<String> allAnnotations;
-
-    static {
-        Set<String> tmp = new HashSet<>();
-        tmp.add("*");
-        allAnnotations = Collections.unmodifiableSet(tmp);
-    }
+    private static final Set<String> allAnnotations = Set.of("*");

      protected Elements eltUtils;
      protected Elements elements;
@@ -116,7 +110,7 @@
       * corresponding platform visitor type.
       */

-    @SupportedSourceVersion(RELEASE_9)
+    @SupportedSourceVersion(RELEASE_10)
      public static abstract class AbstractAnnotationValueVisitor<R, P>
extends AbstractAnnotationValueVisitor9<R, P> {

          /**
@@ -127,7 +121,7 @@
          }
      }

-    @SupportedSourceVersion(RELEASE_9)
+    @SupportedSourceVersion(RELEASE_10)
      public static abstract class AbstractElementVisitor<R, P> extends
AbstractElementVisitor9<R, P> {
          /**
           * Constructor for concrete subclasses to call.
@@ -137,7 +131,7 @@
          }
      }

-    @SupportedSourceVersion(RELEASE_9)
+    @SupportedSourceVersion(RELEASE_10)
      public static abstract class AbstractTypeVisitor<R, P> extends
AbstractTypeVisitor9<R, P> {
          /**
           * Constructor for concrete subclasses to call.
@@ -147,7 +141,7 @@
          }
      }

-    @SupportedSourceVersion(RELEASE_9)
+    @SupportedSourceVersion(RELEASE_10)
      public static class ElementKindVisitor<R, P> extends
ElementKindVisitor9<R, P> {
          /**
           * Constructor for concrete subclasses; uses {@code null} for the
@@ -168,7 +162,7 @@
          }
      }

-    @SupportedSourceVersion(RELEASE_9)
+    @SupportedSourceVersion(RELEASE_10)
      public static class ElementScanner<R, P> extends
ElementScanner9<R, P> {
          /**
           * Constructor for concrete subclasses; uses {@code null} for the
@@ -187,7 +181,7 @@
          }
      }

-    @SupportedSourceVersion(RELEASE_9)
+    @SupportedSourceVersion(RELEASE_10)
      public static class SimpleAnnotationValueVisitor<R, P> extends
SimpleAnnotationValueVisitor9<R, P> {
          /**
           * Constructor for concrete subclasses; uses {@code null} for the
@@ -208,7 +202,7 @@
          }
      }

-    @SupportedSourceVersion(RELEASE_9)
+    @SupportedSourceVersion(RELEASE_10)
      public static class SimpleElementVisitor<R, P> extends
SimpleElementVisitor9<R, P> {
          /**
           * Constructor for concrete subclasses; uses {@code null} for the
@@ -229,7 +223,7 @@
          }
      }

-    @SupportedSourceVersion(RELEASE_9)
+    @SupportedSourceVersion(RELEASE_10)
      public static class SimpleTypeVisitor<R, P> extends
SimpleTypeVisitor9<R, P> {
          /**
           * Constructor for concrete subclasses; uses {@code null} for the
@@ -250,7 +244,7 @@
          }
      }

-    @SupportedSourceVersion(RELEASE_9)
+    @SupportedSourceVersion(RELEASE_10)
      public static class TypeKindVisitor<R, P> extends
TypeKindVisitor9<R, P> {
          /**
           * Constructor for concrete subclasses to call; uses {@code null}

Reply | Threaded
Open this post in threaded view
|

Re: JDK 10 RFR of JDK-8193191: Update JavacTestingAbstractProcessor for JDK 10

Jonathan Gibbons
+1

-- Jon


On 12/7/17 9:12 AM, joe darcy wrote:

> Hello,
>
> Please review the straightforward patch below to update the
> JavacTestingAbstractProcessor utility superclass to JDK 10.
>
>      JDK-8193191: Update JavacTestingAbstractProcessor for JDK 10
>
> Besides the use of Set.of, most of the updates are just bumping
> @SupportedSourceVersion annotation from 9 to 10.
>
> Thanks,
>
> -Joe
>
> diff -r 56d3576aadd5
> test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java
> ---
> a/test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java
> Mon Dec 04 19:12:57 2017 +0100
> +++
> b/test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java
> Thu Dec 07 09:04:27 2017 -0800
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights
> reserved.
> + * Copyright (c) 2010, 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
> @@ -31,13 +31,7 @@
>   * An abstract annotation processor tailored to {@code javac}
> regression testing.
>   */
>  public abstract class JavacTestingAbstractProcessor extends
> AbstractProcessor {
> -    private static final Set<String> allAnnotations;
> -
> -    static {
> -        Set<String> tmp = new HashSet<>();
> -        tmp.add("*");
> -        allAnnotations = Collections.unmodifiableSet(tmp);
> -    }
> +    private static final Set<String> allAnnotations = Set.of("*");
>
>      protected Elements eltUtils;
>      protected Elements elements;
> @@ -116,7 +110,7 @@
>       * corresponding platform visitor type.
>       */
>
> -    @SupportedSourceVersion(RELEASE_9)
> +    @SupportedSourceVersion(RELEASE_10)
>      public static abstract class AbstractAnnotationValueVisitor<R, P>
> extends AbstractAnnotationValueVisitor9<R, P> {
>
>          /**
> @@ -127,7 +121,7 @@
>          }
>      }
>
> -    @SupportedSourceVersion(RELEASE_9)
> +    @SupportedSourceVersion(RELEASE_10)
>      public static abstract class AbstractElementVisitor<R, P> extends
> AbstractElementVisitor9<R, P> {
>          /**
>           * Constructor for concrete subclasses to call.
> @@ -137,7 +131,7 @@
>          }
>      }
>
> -    @SupportedSourceVersion(RELEASE_9)
> +    @SupportedSourceVersion(RELEASE_10)
>      public static abstract class AbstractTypeVisitor<R, P> extends
> AbstractTypeVisitor9<R, P> {
>          /**
>           * Constructor for concrete subclasses to call.
> @@ -147,7 +141,7 @@
>          }
>      }
>
> -    @SupportedSourceVersion(RELEASE_9)
> +    @SupportedSourceVersion(RELEASE_10)
>      public static class ElementKindVisitor<R, P> extends
> ElementKindVisitor9<R, P> {
>          /**
>           * Constructor for concrete subclasses; uses {@code null} for
> the
> @@ -168,7 +162,7 @@
>          }
>      }
>
> -    @SupportedSourceVersion(RELEASE_9)
> +    @SupportedSourceVersion(RELEASE_10)
>      public static class ElementScanner<R, P> extends
> ElementScanner9<R, P> {
>          /**
>           * Constructor for concrete subclasses; uses {@code null} for
> the
> @@ -187,7 +181,7 @@
>          }
>      }
>
> -    @SupportedSourceVersion(RELEASE_9)
> +    @SupportedSourceVersion(RELEASE_10)
>      public static class SimpleAnnotationValueVisitor<R, P> extends
> SimpleAnnotationValueVisitor9<R, P> {
>          /**
>           * Constructor for concrete subclasses; uses {@code null} for
> the
> @@ -208,7 +202,7 @@
>          }
>      }
>
> -    @SupportedSourceVersion(RELEASE_9)
> +    @SupportedSourceVersion(RELEASE_10)
>      public static class SimpleElementVisitor<R, P> extends
> SimpleElementVisitor9<R, P> {
>          /**
>           * Constructor for concrete subclasses; uses {@code null} for
> the
> @@ -229,7 +223,7 @@
>          }
>      }
>
> -    @SupportedSourceVersion(RELEASE_9)
> +    @SupportedSourceVersion(RELEASE_10)
>      public static class SimpleTypeVisitor<R, P> extends
> SimpleTypeVisitor9<R, P> {
>          /**
>           * Constructor for concrete subclasses; uses {@code null} for
> the
> @@ -250,7 +244,7 @@
>          }
>      }
>
> -    @SupportedSourceVersion(RELEASE_9)
> +    @SupportedSourceVersion(RELEASE_10)
>      public static class TypeKindVisitor<R, P> extends
> TypeKindVisitor9<R, P> {
>          /**
>           * Constructor for concrete subclasses to call; uses {@code
> null}
>