8006972: jtreg test fails: test/tools/javac/processing/model/element/TestMissingElement/TestMissingElement.java
Reviewed-by: darcy
This commit is contained in:
parent
b03e5fc290
commit
810c76f567
@ -31,6 +31,7 @@
|
|||||||
* @compile/fail/ref=TestMissingElement.ref -proc:only -XprintRounds -XDrawDiagnostics -processor TestMissingElement InvalidSource.java
|
* @compile/fail/ref=TestMissingElement.ref -proc:only -XprintRounds -XDrawDiagnostics -processor TestMissingElement InvalidSource.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.io.PrintWriter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import javax.annotation.processing.*;
|
import javax.annotation.processing.*;
|
||||||
import javax.lang.model.element.*;
|
import javax.lang.model.element.*;
|
||||||
@ -38,7 +39,18 @@ import javax.lang.model.type.*;
|
|||||||
import javax.lang.model.util.*;
|
import javax.lang.model.util.*;
|
||||||
import static javax.tools.Diagnostic.Kind.*;
|
import static javax.tools.Diagnostic.Kind.*;
|
||||||
|
|
||||||
|
import com.sun.tools.javac.processing.JavacProcessingEnvironment;
|
||||||
|
import com.sun.tools.javac.util.Log;
|
||||||
|
|
||||||
public class TestMissingElement extends JavacTestingAbstractProcessor {
|
public class TestMissingElement extends JavacTestingAbstractProcessor {
|
||||||
|
private PrintWriter out;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(ProcessingEnvironment env) {
|
||||||
|
super.init(env);
|
||||||
|
out = ((JavacProcessingEnvironment) env).getContext().get(Log.outKey);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
|
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
|
||||||
for (TypeElement te: ElementFilter.typesIn(roundEnv.getRootElements())) {
|
for (TypeElement te: ElementFilter.typesIn(roundEnv.getRootElements())) {
|
||||||
@ -70,13 +82,13 @@ public class TestMissingElement extends JavacTestingAbstractProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkInterfaces(TypeElement te, String expect) {
|
private void checkInterfaces(TypeElement te, String expect) {
|
||||||
System.err.println("check interfaces: " + te + " -- " + expect);
|
out.println("check interfaces: " + te + " -- " + expect);
|
||||||
String found = asString(te.getInterfaces(), ", ");
|
String found = asString(te.getInterfaces(), ", ");
|
||||||
checkEqual("interfaces", te, found, expect);
|
checkEqual("interfaces", te, found, expect);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkSupertype(TypeElement te, String expect) {
|
private void checkSupertype(TypeElement te, String expect) {
|
||||||
System.err.println("check supertype: " + te + " -- " + expect);
|
out.println("check supertype: " + te + " -- " + expect);
|
||||||
String found = asString(te.getSuperclass());
|
String found = asString(te.getSuperclass());
|
||||||
checkEqual("supertype", te, found, expect);
|
checkEqual("supertype", te, found, expect);
|
||||||
}
|
}
|
||||||
@ -85,7 +97,7 @@ public class TestMissingElement extends JavacTestingAbstractProcessor {
|
|||||||
if (found.equals(expect)) {
|
if (found.equals(expect)) {
|
||||||
// messager.printMessage(NOTE, "expected " + label + " found: " + expect, te);
|
// messager.printMessage(NOTE, "expected " + label + " found: " + expect, te);
|
||||||
} else {
|
} else {
|
||||||
System.err.println("unexpected " + label + ": " + te + "\n"
|
out.println("unexpected " + label + ": " + te + "\n"
|
||||||
+ " found: " + found + "\n"
|
+ " found: " + found + "\n"
|
||||||
+ "expect: " + expect);
|
+ "expect: " + expect);
|
||||||
messager.printMessage(ERROR, "unexpected " + label + " found: " + found + "; expected: " + expect, te);
|
messager.printMessage(ERROR, "unexpected " + label + " found: " + found + "; expected: " + expect, te);
|
||||||
|
@ -2,6 +2,24 @@ Round 1:
|
|||||||
input files: {ExpectInterfaces, ExpectSupertype, OK, InvalidSource}
|
input files: {ExpectInterfaces, ExpectSupertype, OK, InvalidSource}
|
||||||
annotations: [ExpectSupertype, ExpectInterfaces]
|
annotations: [ExpectSupertype, ExpectInterfaces]
|
||||||
last round: false
|
last round: false
|
||||||
|
check supertype: InvalidSource.TestClassMissingClassA -- !:empty clss A!
|
||||||
|
check supertype: InvalidSource.TestClassMissingClassAB -- !:empty clss (pkg A).B!
|
||||||
|
check supertype: InvalidSource.TestClassMissingClass_juA -- !:empty clss (pkg java.util).A!
|
||||||
|
check supertype: InvalidSource.TestClassTMissingClassAT -- !:empty clss A!<tvar T>
|
||||||
|
check interfaces: InvalidSource.TestClassMissingIntfA -- !:empty intf A!
|
||||||
|
check interfaces: InvalidSource.TestClassMissingIntfAB -- !:empty intf (pkg A).B!
|
||||||
|
check interfaces: InvalidSource.TestClassMissingIntfAOK -- !:empty intf A!, intf OK
|
||||||
|
check interfaces: InvalidSource.TestClassOKMissingIntfA -- intf OK, !:empty intf A!
|
||||||
|
check interfaces: InvalidSource.TestClassMissingIntfA_B -- !:empty intf A!, !:empty intf B!
|
||||||
|
check interfaces: InvalidSource.TestIntfMissingIntfA -- !:empty intf A!
|
||||||
|
check interfaces: InvalidSource.TestIntfMissingIntfAOK -- !:empty intf A!, intf OK
|
||||||
|
check interfaces: InvalidSource.TestIntfOKMissingIntfA -- intf OK, !:empty intf A!
|
||||||
|
check interfaces: InvalidSource.TestIntfMissingIntfAB -- !:empty intf A!, !:empty intf B!
|
||||||
|
check interfaces: InvalidSource.TestClassTMissingIntfAT -- !:empty intf A!<tvar T>
|
||||||
|
check interfaces: InvalidSource.TestClassTMissingIntfAT_B -- !:empty intf A!<tvar T>, !:empty intf B!
|
||||||
|
check interfaces: InvalidSource.TestIntfTMissingIntfAT -- !:empty intf A!<tvar T>
|
||||||
|
check interfaces: InvalidSource.TestIntfTMissingIntfAT_B -- !:empty intf A!<tvar T>, !:empty intf B!
|
||||||
|
check interfaces: InvalidSource.TestClassListMissingX -- intf (pkg java.util).List<!:empty clss X!>
|
||||||
Round 2:
|
Round 2:
|
||||||
input files: {}
|
input files: {}
|
||||||
annotations: []
|
annotations: []
|
||||||
@ -28,22 +46,4 @@ InvalidSource.java:100:49: compiler.err.cant.resolve.location: kindname.class, A
|
|||||||
InvalidSource.java:103:51: compiler.err.cant.resolve.location: kindname.class, A, , , (compiler.misc.location: kindname.class, InvalidSource, null)
|
InvalidSource.java:103:51: compiler.err.cant.resolve.location: kindname.class, A, , , (compiler.misc.location: kindname.class, InvalidSource, null)
|
||||||
InvalidSource.java:103:57: compiler.err.cant.resolve.location: kindname.class, B, , , (compiler.misc.location: kindname.class, InvalidSource, null)
|
InvalidSource.java:103:57: compiler.err.cant.resolve.location: kindname.class, B, , , (compiler.misc.location: kindname.class, InvalidSource, null)
|
||||||
InvalidSource.java:106:58: compiler.err.cant.resolve.location: kindname.class, X, , , (compiler.misc.location: kindname.class, InvalidSource, null)
|
InvalidSource.java:106:58: compiler.err.cant.resolve.location: kindname.class, X, , , (compiler.misc.location: kindname.class, InvalidSource, null)
|
||||||
22 errors
|
22 errors
|
||||||
check supertype: InvalidSource.TestClassMissingClassA -- !:empty clss A!
|
|
||||||
check supertype: InvalidSource.TestClassMissingClassAB -- !:empty clss (pkg A).B!
|
|
||||||
check supertype: InvalidSource.TestClassMissingClass_juA -- !:empty clss (pkg java.util).A!
|
|
||||||
check supertype: InvalidSource.TestClassTMissingClassAT -- !:empty clss A!<tvar T>
|
|
||||||
check interfaces: InvalidSource.TestClassMissingIntfA -- !:empty intf A!
|
|
||||||
check interfaces: InvalidSource.TestClassMissingIntfAB -- !:empty intf (pkg A).B!
|
|
||||||
check interfaces: InvalidSource.TestClassMissingIntfAOK -- !:empty intf A!, intf OK
|
|
||||||
check interfaces: InvalidSource.TestClassOKMissingIntfA -- intf OK, !:empty intf A!
|
|
||||||
check interfaces: InvalidSource.TestClassMissingIntfA_B -- !:empty intf A!, !:empty intf B!
|
|
||||||
check interfaces: InvalidSource.TestIntfMissingIntfA -- !:empty intf A!
|
|
||||||
check interfaces: InvalidSource.TestIntfMissingIntfAOK -- !:empty intf A!, intf OK
|
|
||||||
check interfaces: InvalidSource.TestIntfOKMissingIntfA -- intf OK, !:empty intf A!
|
|
||||||
check interfaces: InvalidSource.TestIntfMissingIntfAB -- !:empty intf A!, !:empty intf B!
|
|
||||||
check interfaces: InvalidSource.TestClassTMissingIntfAT -- !:empty intf A!<tvar T>
|
|
||||||
check interfaces: InvalidSource.TestClassTMissingIntfAT_B -- !:empty intf A!<tvar T>, !:empty intf B!
|
|
||||||
check interfaces: InvalidSource.TestIntfTMissingIntfAT -- !:empty intf A!<tvar T>
|
|
||||||
check interfaces: InvalidSource.TestIntfTMissingIntfAT_B -- !:empty intf A!<tvar T>, !:empty intf B!
|
|
||||||
check interfaces: InvalidSource.TestClassListMissingX -- intf (pkg java.util).List<!:empty clss X!>
|
|
Loading…
x
Reference in New Issue
Block a user