< prev index next >

test/langtools/tools/javac/tree/SourceTreeScannerTest.java

Print this page
rev 51258 : imported patch switch

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -45,15 +45,18 @@
  */
 
 import java.io.*;
 import java.lang.reflect.*;
 import java.util.*;
+
 import javax.tools.*;
 
+import com.sun.source.tree.CaseTree.CaseKind;
 import com.sun.source.tree.Tree;
 import com.sun.source.util.TreeScanner;
 import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.JCTree.JCCase;
 import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
 import com.sun.tools.javac.tree.JCTree.JCModuleDecl;
 import com.sun.tools.javac.tree.JCTree.TypeBoundKind;
 import com.sun.tools.javac.util.List;
 

@@ -148,10 +151,15 @@
                         //System.err.println("FIELD: " + f.getName());
                         if (tree instanceof JCModuleDecl && f.getName().equals("mods")) {
                             // The modifiers will not found by TreeScanner,
                             // but the embedded annotations will be.
                             reflectiveScan(((JCModuleDecl) tree).mods.annotations);
+                        } else if (tree instanceof JCCase &&
+                                   ((JCCase) tree).getCaseKind() == CaseKind.RULE &&
+                                   f.getName().equals("stats")) {
+                            //value case, visit value:
+                            reflectiveScan(((JCCase) tree).getBody());
                         } else {
                             reflectiveScan(f.get(tree));
                         }
                     } catch (IllegalAccessException e) {
                         error(e.toString());
< prev index next >