Community
Participate
Working Groups
Hi, when using ASTParser class of "org.eclipse.jdt.core_3.3.1.v_780_R33x.jar" to create an AST of a java source file using the default options (COMPILER_SOURCE = "1.3"), an AnnotationTypeDeclaration is recognized and can be visited using an ASTVisitor extension. I think that should not be possible since AnnotationTypeDeclarations are new to "1.5". An EnumDeclaration which is also new to "1.5" in comparasion does not get recognized (keyword enum gets scanned as identifer in internal Scanner class). I attached a small demo project that shows the described effects. Greetings Robert
Created attachment 111043 [details] Demo Project to illustrate problem
Indeed, we should return an empty CompilationUnit (since the source contains syntax errors) with getProblems() that would return the syntax errors.
Note that we still return the syntax error in the compilation unit's problems.
In case the scanner source is < 1.5, we should not convert annotation declarations.
Created attachment 111087 [details] Proposed fix + regression tests
Released for 3.5M2. Regression tests added in org.eclipse.jdt.core.tests.dom.ASTConverterTestAST3_2#test0695 org.eclipse.jdt.core.tests.dom.ASTConverterTestAST3_2#test0696
Verified for 3.5M2 using I20080914-2000