United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6926699 : Annotation processing regression tests should typically return SourceVersion.latest

Details
Type:
Bug
Submit Date:
2010-02-16
Status:
Closed
Updated Date:
2011-03-08
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
tools
OS:
generic
Sub-Component:
javac
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:

Related Reports

Sub Tasks

Description
Just as regression tests in langtools should generally accept the default compiler conversion, annotation processors that are part of the langtools regression tests should support the latest source version by default.

                                    

Comments
EVALUATION

Yes.
                                     
2010-02-16
PUBLIC COMMENTS

See
http://hg.openjdk.java.net/jdk7/tl/langtools/rev/fe17a9dbef03
                                     
2010-02-16
SUGGESTED FIX

--- old/test/tools/javac/6341866/Anno.java	2010-02-15 20:05:55.000000000 -0800
+++ new/test/tools/javac/6341866/Anno.java	2010-02-15 20:05:54.000000000 -0800
@@ -27,7 +27,6 @@
 import javax.lang.model.element.*;
 
 @SupportedAnnotationTypes("*")
-    @SupportedSourceVersion(SourceVersion.RELEASE_7)
 public class Anno extends AbstractProcessor {
     public boolean process(Set<? extends TypeElement> annotations,
                                     RoundEnvironment roundEnv) {
@@ -35,4 +34,9 @@
         //    System.err.println("annotation processing");
         return true;
     }
+
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
 }
--- old/test/tools/javac/T6406771.java	2010-02-15 20:05:55.000000000 -0800
+++ new/test/tools/javac/T6406771.java	2010-02-15 20:05:55.000000000 -0800
@@ -17,7 +17,7 @@
 import com.sun.source.util.*;
 import com.sun.tools.javac.tree.JCTree;
 
-@SupportedSourceVersion(SourceVersion.RELEASE_6)
+
 @SupportedAnnotationTypes("*")
 public class T6406771 extends AbstractProcessor {
     String[] tests = {
@@ -95,4 +95,8 @@
         return true;
     }
 
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
 }
--- old/test/tools/javac/T6411379.java	2010-02-15 20:05:56.000000000 -0800
+++ new/test/tools/javac/T6411379.java	2010-02-15 20:05:56.000000000 -0800
@@ -37,7 +37,6 @@
 import com.sun.source.util.*;
 
 @SupportedAnnotationTypes("*")
-@SupportedSourceVersion(SourceVersion.RELEASE_6)
 public class T6411379 extends AbstractProcessor {
 
     public boolean process(Set<? extends TypeElement> annoElems,
@@ -58,6 +57,11 @@
         return true;
     }
 
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
     public void checkNull(Object o) {
         if (o != null)
             throw new AssertionError("expected null");
--- old/test/tools/javac/T6423583.java	2010-02-15 20:05:56.000000000 -0800
+++ new/test/tools/javac/T6423583.java	2010-02-15 20:05:56.000000000 -0800
@@ -37,7 +37,6 @@
 import com.sun.source.util.*;
 
 @SupportedAnnotationTypes("*")
-@SupportedSourceVersion(SourceVersion.RELEASE_6)
 public class T6423583 extends AbstractProcessor {
     boolean b1 = true;
     boolean b2 = false;
@@ -59,6 +58,10 @@
         return true;
     }
 
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
 
     private static class Test extends TreeScanner<Void,Void> {
 
--- old/test/tools/javac/T6855236.java	2010-02-15 20:05:57.000000000 -0800
+++ new/test/tools/javac/T6855236.java	2010-02-15 20:05:57.000000000 -0800
@@ -38,7 +38,6 @@
 import com.sun.source.tree.*;
 import com.sun.source.util.*;
 
-@SupportedSourceVersion(SourceVersion.RELEASE_6)
 @SupportedAnnotationTypes("*")
 public class T6855236 extends AbstractProcessor {
 
@@ -63,6 +62,11 @@
         return true;
     }
 
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
     class CodeVisitor extends TreePathScanner<Object, Trees> {
 
         @Override
--- old/test/tools/javac/api/6421111/T6421111.java	2010-02-15 20:05:57.000000000 -0800
+++ new/test/tools/javac/api/6421111/T6421111.java	2010-02-15 20:05:57.000000000 -0800
@@ -76,7 +76,6 @@
             throw new AssertionError("Annotation processor failed");
     }
     @SupportedAnnotationTypes("*")
-    @SupportedSourceVersion(SourceVersion.RELEASE_6)
     static class MyProcessor extends AbstractProcessor {
         void test(TypeElement element, boolean fbound) {
             TypeParameterElement tpe = element.getTypeParameters().iterator().next();
@@ -96,6 +95,10 @@
             test(processingEnv.getElementUtils().getTypeElement("Test2"), true);
             return false;
         }
+        @Override
+        public SourceVersion getSupportedSourceVersion() {
+            return SourceVersion.latest();
+        }
     }
     public static void main(String... args) {
         new T6421111().test(args);
--- old/test/tools/javac/api/6468404/T6468404.java	2010-02-15 20:05:58.000000000 -0800
+++ new/test/tools/javac/api/6468404/T6468404.java	2010-02-15 20:05:58.000000000 -0800
@@ -105,7 +105,6 @@
 }
 
 @SupportedAnnotationTypes("*")
-@SupportedSourceVersion(SourceVersion.RELEASE_6)
 class P extends AbstractProcessor {
     boolean ran = false;
 
@@ -145,4 +144,9 @@
         }
         return true;
     }
+
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
 }
--- old/test/tools/javac/api/T6412669.java	2010-02-15 20:05:59.000000000 -0800
+++ new/test/tools/javac/api/T6412669.java	2010-02-15 20:05:59.000000000 -0800
@@ -38,7 +38,6 @@
 import com.sun.tools.javac.api.*;
 
 @SupportedAnnotationTypes("*")
-@SupportedSourceVersion(SourceVersion.RELEASE_6)
 public class T6412669 extends AbstractProcessor {
     public static void main(String... args) throws IOException {
         String testSrc = System.getProperty("test.src", ".");
@@ -72,4 +71,9 @@
         }
         return true;
     }
+
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
 }
--- old/test/tools/javac/enum/6424358/T6424358.java	2010-02-15 20:05:59.000000000 -0800
+++ new/test/tools/javac/enum/6424358/T6424358.java	2010-02-15 20:05:59.000000000 -0800
@@ -34,13 +34,12 @@
 import javax.annotation.processing.*;
 import javax.lang.model.element.*;
 import javax.lang.model.util.*;
+import javax.lang.model.SourceVersion;
 import static javax.tools.Diagnostic.Kind.*;
-import static javax.lang.model.SourceVersion.RELEASE_6;
 
 @interface TestMe {}
 
 @SupportedAnnotationTypes("*")
-@SupportedSourceVersion(RELEASE_6)
 public class T6424358 extends AbstractProcessor {
     @TestMe enum Test { FOO; }
 
@@ -66,4 +65,9 @@
             scan.scan(e);
         return true;
     }
+
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
 }
--- old/test/tools/javac/processing/6348499/A.java	2010-02-15 20:06:00.000000000 -0800
+++ new/test/tools/javac/processing/6348499/A.java	2010-02-15 20:06:00.000000000 -0800
@@ -28,7 +28,6 @@
 import javax.lang.model.element.*;
 
 @SupportedAnnotationTypes("*")
-@SupportedSourceVersion(SourceVersion.RELEASE_7)
 public class A extends AbstractProcessor {
     public boolean process(Set<? extends TypeElement> tes, RoundEnvironment renv) {
         Filer filer = processingEnv.getFiler();
@@ -40,4 +39,8 @@
         }
         return true;
     }
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
 }
--- old/test/tools/javac/processing/6414633/A.java	2010-02-15 20:06:00.000000000 -0800
+++ new/test/tools/javac/processing/6414633/A.java	2010-02-15 20:06:00.000000000 -0800
@@ -30,7 +30,6 @@
 import javax.tools.*;
 
 @SupportedAnnotationTypes("*")
-@SupportedSourceVersion(SourceVersion.RELEASE_7)
 public class A extends AbstractProcessor {
 
     public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
@@ -42,4 +41,9 @@
         }
         return true;
     }
+
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
 }
--- old/test/tools/javac/processing/6430209/T6430209.java	2010-02-15 20:06:01.000000000 -0800
+++ new/test/tools/javac/processing/6430209/T6430209.java	2010-02-15 20:06:01.000000000 -0800
@@ -63,7 +63,6 @@
             new File(testSrc, "test0.java"), new File(testSrc, "test1.java")));
         Iterable<String> opts = Arrays.asList("-proc:only",
                                               "-processor", "b6341534",
-                                              "-source", "1.6",
                                               "-processorpath", testClasses);
         StringWriter out = new StringWriter();
         JavacTask task = tool.getTask(out, fm, dl, opts, null, files);
--- old/test/tools/javac/processing/6430209/b6341534.java	2010-02-15 20:06:02.000000000 -0800
+++ new/test/tools/javac/processing/6430209/b6341534.java	2010-02-15 20:06:01.000000000 -0800
@@ -22,6 +22,7 @@
  */
 
 import javax.annotation.processing.*;
+import javax.lang.model.SourceVersion;
 import javax.lang.model.element.*;
 import javax.lang.model.util.*;
 import static javax.lang.model.util.ElementFilter.*;
@@ -30,7 +31,6 @@
 import java.util.Set;
 
 @SupportedAnnotationTypes({"*"})
-@SupportedSourceVersion(javax.lang.model.SourceVersion.RELEASE_7)
 public class b6341534 extends AbstractProcessor {
     static int r = 0;
     static Elements E = null;
@@ -62,4 +62,9 @@
         if( renv.errorRaised() ) {      msgr.printMessage(ERROR, "FAILED");}
         return true;
     }
+
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
 }
--- old/test/tools/javac/processing/T6439826.java	2010-02-15 20:06:02.000000000 -0800
+++ new/test/tools/javac/processing/T6439826.java	2010-02-15 20:06:02.000000000 -0800
@@ -39,7 +39,6 @@
 
 
 @SupportedAnnotationTypes("*")
-@SupportedSourceVersion(SourceVersion.RELEASE_7 )
 public class T6439826 extends AbstractProcessor {
     public static void main(String... args) {
         String testSrc = System.getProperty("test.src", ".");
@@ -76,6 +75,11 @@
         return false;
     }
 
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
     private void writeBadFile() {
         Filer filer = processingEnv.getFiler();
         Messager messager = processingEnv.getMessager();
--- old/test/tools/javac/processing/model/element/TypeParamBounds.java	2010-02-15 20:06:03.000000000 -0800
+++ new/test/tools/javac/processing/model/element/TypeParamBounds.java	2010-02-15 20:06:03.000000000 -0800
@@ -40,7 +40,6 @@
 import javax.lang.model.type.*;
 import javax.lang.model.util.*;
 
-@SupportedSourceVersion(SourceVersion.RELEASE_6)
 @SupportedAnnotationTypes("*")
 public class TypeParamBounds extends AbstractProcessor {
 
@@ -60,6 +59,11 @@
         return true;
     }
 
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
     private void doit(Set<? extends TypeElement> annoTypes,
                       RoundEnvironment round) {
         TypeElement gen = elements.getTypeElement("TypeParamBounds.Gen");
--- old/test/tools/javac/processing/model/type/MirroredTypeEx/OverEager.java	2010-02-15 20:06:03.000000000 -0800
+++ new/test/tools/javac/processing/model/type/MirroredTypeEx/OverEager.java	2010-02-15 20:06:03.000000000 -0800
@@ -38,7 +38,6 @@
 import javax.lang.model.util.*;
 import static javax.lang.model.util.ElementFilter.*;
 
-@SupportedSourceVersion(SourceVersion.RELEASE_6)
 @SupportedAnnotationTypes("IAm")
 @IAm(OverEager.class)
 public class OverEager extends AbstractProcessor {
@@ -59,6 +58,11 @@
         return true;
     }
 
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
     private void doit(Set<? extends TypeElement> annoTypes,
                       RoundEnvironment round) {
         for (TypeElement t : typesIn(round.getRootElements())) {
--- old/test/tools/javac/processing/model/type/NoTypes.java	2010-02-15 20:06:04.000000000 -0800
+++ new/test/tools/javac/processing/model/type/NoTypes.java	2010-02-15 20:06:04.000000000 -0800
@@ -39,8 +39,6 @@
 
 import static javax.lang.model.type.TypeKind.*;
 
-
-@SupportedSourceVersion(SourceVersion.RELEASE_6)
 @SupportedAnnotationTypes("*")
 public class NoTypes extends AbstractProcessor {
 
@@ -60,6 +58,11 @@
         return true;
     }
 
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
     private void doit(Set<? extends TypeElement> annoTypes,
                       RoundEnvironment round) {
 
--- old/test/tools/javac/processing/model/util/GetTypeElemBadArg.java	2010-02-15 20:06:04.000000000 -0800
+++ new/test/tools/javac/processing/model/util/GetTypeElemBadArg.java	2010-02-15 20:06:04.000000000 -0800
@@ -37,7 +37,6 @@
 import javax.lang.model.type.*;
 import javax.lang.model.util.*;
 
-@SupportedSourceVersion(SourceVersion.RELEASE_6)
 @SupportedAnnotationTypes("*")
 public class GetTypeElemBadArg extends AbstractProcessor {
 
@@ -64,6 +63,12 @@
         return true;
     }
 
+
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
     private static void tellAbout(TypeElement t) {
         System.out.println(t);
         System.out.println(t.getClass());
--- old/test/tools/javac/processing/model/util/OverridesSpecEx.java	2010-02-15 20:06:05.000000000 -0800
+++ new/test/tools/javac/processing/model/util/OverridesSpecEx.java	2010-02-15 20:06:05.000000000 -0800
@@ -40,7 +40,6 @@
 import static javax.lang.model.util.ElementFilter.*;
 
 
-@SupportedSourceVersion(SourceVersion.RELEASE_6)
 @SupportedAnnotationTypes("*")
 public class OverridesSpecEx extends AbstractProcessor {
 
@@ -60,6 +59,11 @@
         return true;
     }
 
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
     private void doit(Set<? extends TypeElement> annoTypes,
                       RoundEnvironment round) {
         TypeElement string = elements.getTypeElement("java.lang.String");
                                     
2010-02-16



Hardware and Software, Engineered to Work Together