Summary: | Enum in AST seems to fail | ||
---|---|---|---|
Product: | [Tools] AspectJ | Reporter: | Wojto <jestem.wojtek> |
Component: | Compiler | Assignee: | aspectj inbox <aspectj-inbox> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | aclement |
Version: | 1.5.3 | ||
Target Milestone: | 1.6.0 M2 | ||
Hardware: | PC | ||
OS: | Windows Vista | ||
Whiteboard: |
Description
Wojto
You didn't include the code you were using to actually build the Ast, but I vaguely remember it was based on the wiki contents at the eclipse.org AJDT wiki page. The code that actually works fine is: import java.util.*; import org.aspectj.org.eclipse.jdt.core.dom.*; import org.aspectj.org.eclipse.jdt.internal.compiler.impl.*; public class Program { public static void main(String []argv) { ASTParser parser = ASTParser.newParser(AST.JLS3); Map options = new HashMap(); options.put(CompilerOptions.OPTION_Source, "1.5"); parser.setCompilerOptions(options); parser.setSource(argv[0].toCharArray()); CompilationUnit cu2 = (CompilationUnit) parser.createAST(null); AjNaiveASTFlattener visitor = new AjNaiveASTFlattener(); cu2.accept(visitor); System.err.println(visitor.getResult()); } } It must: use AST.JLS3 *and* pass a Source level of 1.5, otherwise the callbacks for the enum type will not occur. Using that code I can run: ast\>java Program "public enum E { A=1,B=2,C=3; }}" public enum E {A, B, C} whereas before (with JLS2 and not specifying the source level) it would print nothing. |