01: package test.net.sourceforge.pmd.symboltable;
02:
03: import net.sourceforge.pmd.TargetJDK1_4;
04: import net.sourceforge.pmd.TargetJDK1_5;
05: import net.sourceforge.pmd.TargetJDKVersion;
06: import net.sourceforge.pmd.ast.ASTCompilationUnit;
07: import net.sourceforge.pmd.ast.JavaParser;
08: import net.sourceforge.pmd.symboltable.SymbolFacade;
09:
10: import java.io.StringReader;
11:
12: public abstract class STBBaseTst {
13:
14: protected ASTCompilationUnit acu;
15: protected SymbolFacade stb;
16:
17: protected void parseCode(String code) {
18: parseCode(code, new TargetJDK1_4());
19: }
20:
21: protected void parseCode15(String code) {
22: parseCode(code, new TargetJDK1_5());
23: }
24:
25: protected void parseCode(String code, TargetJDKVersion jdk) {
26: JavaParser parser = jdk.createParser(new StringReader(code));
27: acu = parser.CompilationUnit();
28: stb = new SymbolFacade();
29: stb.initializeWith(acu);
30: }
31: }
|