8006972: jtreg test fails: test/tools/javac/processing/model/element/TestMissingElement/TestMissingElement.java
authorjjg
Mon, 09 Sep 2013 17:36:23 -0700
changeset 19932 1386f12ad4b9
parent 19931 f82b95ab8015
child 19933 5182bc65845b
8006972: jtreg test fails: test/tools/javac/processing/model/element/TestMissingElement/TestMissingElement.java Reviewed-by: darcy
langtools/test/tools/javac/processing/model/element/TestMissingElement/TestMissingElement.java
langtools/test/tools/javac/processing/model/element/TestMissingElement/TestMissingElement.ref
--- a/langtools/test/tools/javac/processing/model/element/TestMissingElement/TestMissingElement.java	Mon Sep 09 17:11:55 2013 -0400
+++ b/langtools/test/tools/javac/processing/model/element/TestMissingElement/TestMissingElement.java	Mon Sep 09 17:36:23 2013 -0700
@@ -31,6 +31,7 @@
  * @compile/fail/ref=TestMissingElement.ref -proc:only -XprintRounds -XDrawDiagnostics -processor TestMissingElement InvalidSource.java
  */
 
+import java.io.PrintWriter;
 import java.util.*;
 import javax.annotation.processing.*;
 import javax.lang.model.element.*;
@@ -38,7 +39,18 @@
 import javax.lang.model.util.*;
 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 {
+    private PrintWriter out;
+
+    @Override
+    public void init(ProcessingEnvironment env) {
+        super.init(env);
+        out = ((JavacProcessingEnvironment) env).getContext().get(Log.outKey);
+    }
+
     @Override
     public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
         for (TypeElement te: ElementFilter.typesIn(roundEnv.getRootElements())) {
@@ -70,13 +82,13 @@
     }
 
     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(), ", ");
         checkEqual("interfaces", te, found, 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());
         checkEqual("supertype", te, found, expect);
     }
@@ -85,7 +97,7 @@
         if (found.equals(expect)) {
 //            messager.printMessage(NOTE, "expected " + label + " found: " + expect, te);
         } else {
-            System.err.println("unexpected " + label + ": " + te + "\n"
+            out.println("unexpected " + label + ": " + te + "\n"
                     + " found: " + found + "\n"
                     + "expect: " + expect);
             messager.printMessage(ERROR, "unexpected " + label + " found: " + found + "; expected: " + expect, te);
--- a/langtools/test/tools/javac/processing/model/element/TestMissingElement/TestMissingElement.ref	Mon Sep 09 17:11:55 2013 -0400
+++ b/langtools/test/tools/javac/processing/model/element/TestMissingElement/TestMissingElement.ref	Mon Sep 09 17:36:23 2013 -0700
@@ -2,6 +2,24 @@
 	input files: {ExpectInterfaces, ExpectSupertype, OK, InvalidSource}
 	annotations: [ExpectSupertype, ExpectInterfaces]
 	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:
 	input files: {}
 	annotations: []
@@ -28,22 +46,4 @@
 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:106:58: compiler.err.cant.resolve.location: kindname.class, X, , , (compiler.misc.location: kindname.class, InvalidSource, null)
-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!>
\ No newline at end of file
+22 errors
\ No newline at end of file