mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-19 10:34:38 +02:00
6926699: Annotation processing regression tests should typically return SourceVersion.latest
Reviewed-by: jjg
This commit is contained in:
parent
1fb4cb4242
commit
779ba4bd83
19 changed files with 90 additions and 21 deletions
|
@ -27,7 +27,6 @@ import javax.lang.model.*;
|
|||
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 @@ public class Anno extends AbstractProcessor {
|
|||
// System.err.println("annotation processing");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SourceVersion getSupportedSourceVersion() {
|
||||
return SourceVersion.latest();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import com.sun.source.tree.*;
|
|||
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 @@ public class T6406771 extends AbstractProcessor {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SourceVersion getSupportedSourceVersion() {
|
||||
return SourceVersion.latest();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ import com.sun.source.tree.*;
|
|||
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 @@ public class T6411379 extends AbstractProcessor {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SourceVersion getSupportedSourceVersion() {
|
||||
return SourceVersion.latest();
|
||||
}
|
||||
|
||||
public void checkNull(Object o) {
|
||||
if (o != null)
|
||||
throw new AssertionError("expected null");
|
||||
|
|
|
@ -37,7 +37,6 @@ import com.sun.source.tree.*;
|
|||
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 @@ public class T6423583 extends AbstractProcessor {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SourceVersion getSupportedSourceVersion() {
|
||||
return SourceVersion.latest();
|
||||
}
|
||||
|
||||
private static class Test extends TreeScanner<Void,Void> {
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ import javax.lang.model.element.*;
|
|||
import com.sun.source.tree.*;
|
||||
import com.sun.source.util.*;
|
||||
|
||||
@SupportedSourceVersion(SourceVersion.RELEASE_6)
|
||||
@SupportedAnnotationTypes("*")
|
||||
public class T6855236 extends AbstractProcessor {
|
||||
|
||||
|
@ -63,6 +62,11 @@ public class T6855236 extends AbstractProcessor {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SourceVersion getSupportedSourceVersion() {
|
||||
return SourceVersion.latest();
|
||||
}
|
||||
|
||||
class CodeVisitor extends TreePathScanner<Object, Trees> {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -76,7 +76,6 @@ public class T6421111 extends ToolTester {
|
|||
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 @@ public class T6421111 extends ToolTester {
|
|||
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);
|
||||
|
|
|
@ -105,7 +105,6 @@ class DummyFO extends SimpleJavaFileObject {
|
|||
}
|
||||
|
||||
@SupportedAnnotationTypes("*")
|
||||
@SupportedSourceVersion(SourceVersion.RELEASE_6)
|
||||
class P extends AbstractProcessor {
|
||||
boolean ran = false;
|
||||
|
||||
|
@ -145,4 +144,9 @@ class P extends AbstractProcessor {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SourceVersion getSupportedSourceVersion() {
|
||||
return SourceVersion.latest();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ import com.sun.source.util.*;
|
|||
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 @@ public class T6412669 extends AbstractProcessor {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SourceVersion getSupportedSourceVersion() {
|
||||
return SourceVersion.latest();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,13 +34,12 @@ import java.util.Set;
|
|||
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 @@ public class T6424358 extends AbstractProcessor {
|
|||
scan.scan(e);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SourceVersion getSupportedSourceVersion() {
|
||||
return SourceVersion.latest();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ import javax.lang.model.*;
|
|||
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 @@ public class A extends AbstractProcessor {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public SourceVersion getSupportedSourceVersion() {
|
||||
return SourceVersion.latest();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ import javax.lang.model.element.*;
|
|||
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 @@ public class A extends AbstractProcessor {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SourceVersion getSupportedSourceVersion() {
|
||||
return SourceVersion.latest();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,6 @@ public class T6430209 {
|
|||
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);
|
||||
|
|
|
@ -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.*;
|
|||
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 @@ public class b6341534 extends AbstractProcessor {
|
|||
if( renv.errorRaised() ) { msgr.printMessage(ERROR, "FAILED");}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SourceVersion getSupportedSourceVersion() {
|
||||
return SourceVersion.latest();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,6 @@ import static javax.lang.model.util.ElementFilter.*;
|
|||
|
||||
|
||||
@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 @@ public class T6439826 extends AbstractProcessor {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SourceVersion getSupportedSourceVersion() {
|
||||
return SourceVersion.latest();
|
||||
}
|
||||
|
||||
private void writeBadFile() {
|
||||
Filer filer = processingEnv.getFiler();
|
||||
Messager messager = processingEnv.getMessager();
|
||||
|
|
|
@ -40,7 +40,6 @@ import javax.lang.model.element.*;
|
|||
import javax.lang.model.type.*;
|
||||
import javax.lang.model.util.*;
|
||||
|
||||
@SupportedSourceVersion(SourceVersion.RELEASE_6)
|
||||
@SupportedAnnotationTypes("*")
|
||||
public class TypeParamBounds extends AbstractProcessor {
|
||||
|
||||
|
@ -60,6 +59,11 @@ public class TypeParamBounds extends AbstractProcessor {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SourceVersion getSupportedSourceVersion() {
|
||||
return SourceVersion.latest();
|
||||
}
|
||||
|
||||
private void doit(Set<? extends TypeElement> annoTypes,
|
||||
RoundEnvironment round) {
|
||||
TypeElement gen = elements.getTypeElement("TypeParamBounds.Gen");
|
||||
|
|
|
@ -38,7 +38,6 @@ import javax.lang.model.type.*;
|
|||
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 @@ public class OverEager extends AbstractProcessor {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SourceVersion getSupportedSourceVersion() {
|
||||
return SourceVersion.latest();
|
||||
}
|
||||
|
||||
private void doit(Set<? extends TypeElement> annoTypes,
|
||||
RoundEnvironment round) {
|
||||
for (TypeElement t : typesIn(round.getRootElements())) {
|
||||
|
|
|
@ -39,8 +39,6 @@ import javax.lang.model.util.*;
|
|||
|
||||
import static javax.lang.model.type.TypeKind.*;
|
||||
|
||||
|
||||
@SupportedSourceVersion(SourceVersion.RELEASE_6)
|
||||
@SupportedAnnotationTypes("*")
|
||||
public class NoTypes extends AbstractProcessor {
|
||||
|
||||
|
@ -60,6 +58,11 @@ public class NoTypes extends AbstractProcessor {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SourceVersion getSupportedSourceVersion() {
|
||||
return SourceVersion.latest();
|
||||
}
|
||||
|
||||
private void doit(Set<? extends TypeElement> annoTypes,
|
||||
RoundEnvironment round) {
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ import javax.lang.model.element.*;
|
|||
import javax.lang.model.type.*;
|
||||
import javax.lang.model.util.*;
|
||||
|
||||
@SupportedSourceVersion(SourceVersion.RELEASE_6)
|
||||
@SupportedAnnotationTypes("*")
|
||||
public class GetTypeElemBadArg extends AbstractProcessor {
|
||||
|
||||
|
@ -64,6 +63,12 @@ public class GetTypeElemBadArg extends AbstractProcessor {
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SourceVersion getSupportedSourceVersion() {
|
||||
return SourceVersion.latest();
|
||||
}
|
||||
|
||||
private static void tellAbout(TypeElement t) {
|
||||
System.out.println(t);
|
||||
System.out.println(t.getClass());
|
||||
|
|
|
@ -40,7 +40,6 @@ import javax.lang.model.util.*;
|
|||
import static javax.lang.model.util.ElementFilter.*;
|
||||
|
||||
|
||||
@SupportedSourceVersion(SourceVersion.RELEASE_6)
|
||||
@SupportedAnnotationTypes("*")
|
||||
public class OverridesSpecEx extends AbstractProcessor {
|
||||
|
||||
|
@ -60,6 +59,11 @@ public class OverridesSpecEx extends AbstractProcessor {
|
|||
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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue