| [news.eclipse.tools.jdt] Re: Full Java 1.5 ASTParser |
Adam Kiezun a écrit :
ASTParser 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]);
AFAICanTell, you need to parser.setCompilerOptions and pass in the options to set source level to 1.5
That would also be my answer. You don't specify any context, so the ASTParser cannot guess that you need to 1.5 mode.
--
Olivier
Thanks. I tried that and it works. This is now linked to a bug report. https://bugs.eclipse.org/bugs/show_bug.cgi?id=98750