changeset 51410:cf0898a6441e

8205455: jdeprscan issues annotation processor warning regarding RELEASE_10 Reviewed-by: jjg
author smarks
date Mon, 25 Jun 2018 18:49:30 -0700
parents afbcf72c389d
children 11e7eb8cb583
files src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/LoadProc.java src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/TraverseProc.java test/langtools/tools/jdeprscan/tests/jdk/jdeprscan/TestRelease.java
diffstat 3 files changed, 21 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/LoadProc.java	Mon Jun 25 18:01:42 2018 -0700
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/LoadProc.java	Mon Jun 25 18:49:30 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -38,6 +38,7 @@
 import javax.annotation.processing.SupportedAnnotationTypes;
 import javax.annotation.processing.SupportedSourceVersion;
 
+import javax.lang.model.SourceVersion;
 import javax.lang.model.element.Element;
 import javax.lang.model.element.ElementKind;
 import javax.lang.model.element.ExecutableElement;
@@ -50,15 +51,12 @@
 
 import javax.tools.Diagnostic;
 
-import static javax.lang.model.SourceVersion.RELEASE_11;
-
 /**
  * Annotation processor for the Deprecation Scanner tool.
  * Examines APIs for deprecated elements and records information
  *
  */
 @SupportedAnnotationTypes("java.lang.Deprecated")
-@SupportedSourceVersion(RELEASE_11)
 public class LoadProc extends AbstractProcessor {
     Elements elements;
     Messager messager;
@@ -75,6 +73,11 @@
     }
 
     @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+    @Override
     public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
         if (roundEnv.processingOver()) {
             return false;
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/TraverseProc.java	Mon Jun 25 18:01:42 2018 -0700
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/TraverseProc.java	Mon Jun 25 18:49:30 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -41,18 +41,16 @@
 import javax.annotation.processing.SupportedAnnotationTypes;
 import javax.annotation.processing.SupportedSourceVersion;
 
-import javax.lang.model.element.ModuleElement;
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.util.Elements;
-
-import static javax.lang.model.SourceVersion.RELEASE_10;
+import javax.lang.model.SourceVersion;
 import javax.lang.model.element.Element;
 import javax.lang.model.element.ElementKind;
 import javax.lang.model.element.Modifier;
+import javax.lang.model.element.ModuleElement;
 import javax.lang.model.element.PackageElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.util.Elements;
 import javax.tools.Diagnostic;
 
-@SupportedSourceVersion(RELEASE_10)
 @SupportedAnnotationTypes("*")
 public class TraverseProc extends AbstractProcessor {
     Elements elements;
@@ -72,6 +70,11 @@
     }
 
     @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+    @Override
     public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
         if (roundEnv.processingOver()) {
             return false;
--- a/test/langtools/tools/jdeprscan/tests/jdk/jdeprscan/TestRelease.java	Mon Jun 25 18:01:42 2018 -0700
+++ b/test/langtools/tools/jdeprscan/tests/jdk/jdeprscan/TestRelease.java	Mon Jun 25 18:49:30 2018 -0700
@@ -44,7 +44,10 @@
 
 public class TestRelease {
     static boolean invoke(String arg) {
-        return Main.call(System.out, System.err, "--list", "--release", arg);
+        System.err.println(">>> invoking Main.call with arguments: --list --release " + arg);
+        boolean r = Main.call(System.out, System.err, "--list", "--release", arg);
+        System.err.println(">>> Main.call returned " + r);
+        return r;
     }
 
     @Test