1 19 20 package soot.javaToJimple; 21 import java.util.*; 22 23 public class ClassLiteralChecker extends polyglot.visit.NodeVisitor { 24 25 private ArrayList list; 26 27 public ArrayList getList() { 28 return list; 29 } 30 31 public ClassLiteralChecker(){ 32 list = new ArrayList(); 33 } 34 35 public polyglot.ast.Node override(polyglot.ast.Node parent, polyglot.ast.Node n){ 36 if (n instanceof polyglot.ast.ClassDecl){ 37 return n; 38 } 39 if ((n instanceof polyglot.ast.New) && (((polyglot.ast.New)n).anonType() != null)){ 40 return n; 41 } 42 return null; 43 } 44 45 public polyglot.visit.NodeVisitor enter(polyglot.ast.Node parent, polyglot.ast.Node n) { 46 47 if (n instanceof polyglot.ast.ClassLit) { 48 polyglot.ast.ClassLit lit = (polyglot.ast.ClassLit)n; 49 if (!lit.typeNode().type().isPrimitive()){ 51 list.add(n); 52 } 53 } 54 return enter(n); 55 } 56 } 57 | Popular Tags |