93 }
94
95 return true;
96 }
97
98 @Override
99 void additionalChecks(Trees trees, CompilationUnitTree topLevel) throws IOException {
100 Matcher m = TOPLEVEL_SCOPE_DEF.matcher(topLevel.getSourceFile().getCharContent(false));
101 if (!m.find())
102 throw new AssertionError("Should have top-level scope def!");
103 check(trees.getScope(new TreePath(topLevel)), m.group(1));
104 }
105 //where:
106 Pattern TOPLEVEL_SCOPE_DEF = Pattern.compile("TOPLEVEL_SCOPE:(.*)");
107
108 private String getEnclosingName(Element e) {
109 Element encl = e.getEnclosingElement();
110 return encl == null ? "" : encl.accept(qualNameVisitor, null);
111 }
112
113 private ElementVisitor<String,Void> qualNameVisitor = new SimpleElementVisitor8<String,Void>() {
114 protected String defaultAction(Element e, Void ignore) {
115 return "";
116 }
117
118 public String visitPackage(PackageElement e, Void ignore) {
119 return e.getQualifiedName().toString();
120 }
121
122 public String visitType(TypeElement e, Void ignore) {
123 return e.getQualifiedName().toString();
124 }
125 };
126 }
|
93 }
94
95 return true;
96 }
97
98 @Override
99 void additionalChecks(Trees trees, CompilationUnitTree topLevel) throws IOException {
100 Matcher m = TOPLEVEL_SCOPE_DEF.matcher(topLevel.getSourceFile().getCharContent(false));
101 if (!m.find())
102 throw new AssertionError("Should have top-level scope def!");
103 check(trees.getScope(new TreePath(topLevel)), m.group(1));
104 }
105 //where:
106 Pattern TOPLEVEL_SCOPE_DEF = Pattern.compile("TOPLEVEL_SCOPE:(.*)");
107
108 private String getEnclosingName(Element e) {
109 Element encl = e.getEnclosingElement();
110 return encl == null ? "" : encl.accept(qualNameVisitor, null);
111 }
112
113 private ElementVisitor<String,Void> qualNameVisitor = new SimpleElementVisitor9<String,Void>() {
114 protected String defaultAction(Element e, Void ignore) {
115 return "";
116 }
117
118 public String visitPackage(PackageElement e, Void ignore) {
119 return e.getQualifiedName().toString();
120 }
121
122 public String visitType(TypeElement e, Void ignore) {
123 return e.getQualifiedName().toString();
124 }
125 };
126 }
|