| [news.eclipse.tools.jdt] Re: Full Java 1.5 ASTParser |
That would also be my answer. You don't specify any context, so the ASTParser cannot guess that you need to 1.5 mode.AFAICanTell, you need to parser.setCompilerOptions and pass in the options to set source level to 1.5ASTParser parser = ASTParser.newParser(AST.JLS3); parser.setSource("@Init class X { int y; }".toCharArray()); parser.setKind(ASTParser.K_COMPILATION_UNIT); CompilationUnit rootAST = (CompilationUnit) parser.createAST(null); System.out.println(rootAST.getProblems()[0]);