test/tools/javac/processing/model/element/TestResourceVariable.java

Print this page

        

@@ -21,11 +21,11 @@
  * questions.
  */
 
 /*
  * @test
- * @bug  6911256 6964740 6967842 6961571
+ * @bug  6911256 6964740 6967842 6961571 7025809
  * @summary Test that the resource variable kind is appropriately set
  * @author  Joseph D. Darcy
  * @library ../../../lib
  * @build   JavacTestingAbstractProcessor TestResourceVariable
  * @compile -processor TestResourceVariable -proc:only TestResourceVariable.java

@@ -39,15 +39,16 @@
 import javax.lang.model.util.*;
 import java.util.*;
 import com.sun.source.tree.*;
 import com.sun.source.util.*;
 import static javax.tools.Diagnostic.Kind.*;
+import static JavacTestingAbstractProcessor.*;
 
 /**
  * Using the tree API, retrieve element representations of the
- * resource of an ARM block and verify their kind tags are set
- * appropriately.
+ * resource of a try-with-resources statement and verify their kind
+ * tags are set appropriately.
  */
 public class TestResourceVariable extends JavacTestingAbstractProcessor implements AutoCloseable {
     int resourceVariableCount = 0;
 
     public boolean process(Set<? extends TypeElement> annotations,

@@ -80,11 +81,11 @@
         try(TestResourceVariable trv1 = this; TestResourceVariable trv2 = trv1) {}
     }
 
     /**
      * Verify that a resource variable modeled as an element behaves
-     * as expected under 6 and 7 specific visitors.
+     * as expected under 6 and latest specific visitors.
      */
     private static void testResourceVariable(Element element) {
         ElementVisitor visitor6 = new ElementKindVisitor6<Void, Void>() {};
 
         try {

@@ -92,19 +93,20 @@
             throw new RuntimeException("Expected UnknownElementException not thrown.");
         } catch (UnknownElementException uee) {
             ; // Expected.
         }
 
-        ElementKindVisitor7 visitor7 = new ElementKindVisitor7<Object, Void>() {
+        ElementKindVisitor visitorLatest =
+            new ElementKindVisitor<Object, Void>() {
             @Override
             public Object visitVariableAsResourceVariable(VariableElement e,
                                                           Void p) {
                 return e; // a non-null value
             }
         };
 
-        if (visitor7.visit(element) == null) {
+        if (visitorLatest.visit(element) == null) {
             throw new RuntimeException("Null result of resource variable visitation.");
         }
     }
 
     class ResourceVariableScanner extends TreeScanner<Void, CompilationUnitTree> {