Community
Participate
Working Groups
20031023 set options.put(JavaCore.COMPILER_PB_INVALID_ANNOTATION, JavaCore.ERROR); options.put("org.eclipse.jdt.core.compiler.problem.missingAnnotation", JavaCore.ENABLED); and create AST for /** */ public class E { /** * @param b * comment on second line. * @param c */ public void foo(int a, int b, int c) { } CompilationUnit.getProblems() always contains errors 'No Annotation...' for E and 'No Annotation...' for foo (not true), but no error for missing param a.
Martin, I cannot reproduce this bug using build I200310230800. I've created the class in a new workspace after having set the javadoc options as described and I only got an error on missing @param tag for 'a'. May you provide me the code to create the AST for this class to help me to get this problem? Thanks
IPackageFragment pack1= sourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("/**\n"); buf.append(" */\n"); buf.append("public class E {\n"); buf.append(" /**\n"); buf.append(" * @param b\n"); buf.append(" * comment on second line.\n"); buf.append(" * @param c\n"); buf.append(" */\n"); buf.append(" public void foo(int a, int b, int c) {\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); CompilationUnit astRoot= AST.parseCompilationUnit(cu, true); IProblem[] problems= astRoot.getProblems(); assertTrue(problems.length == 1);
Problem comes from CompilerUnitResolver. This class create a specific Parser which overrides checkAnnotation() method. I forgot to modify this method in order to store the result of the annotation parse. As the annotation ast node was never set, then no error where reported when invalid annotation option was set and all public types, methods and fields were always report missing annotation error when this option was enabled.
Test case added: test0500 in ASTConverterTest2
Verified.