Bug 45436 - Javadoc warnings: wrong errors in AST
Summary: Javadoc warnings: wrong errors in AST
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M5   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-23 09:00 EDT by Martin Aeschlimann CLA
Modified: 2003-11-20 10:09 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Aeschlimann CLA 2003-10-23 09:00:21 EDT
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.
Comment 1 Frederic Fusier CLA 2003-10-23 10:30:07 EDT
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
Comment 2 Martin Aeschlimann CLA 2003-10-23 10:48:56 EDT
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);
Comment 3 Frederic Fusier CLA 2003-10-27 05:03:23 EST
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.
Comment 4 Frederic Fusier CLA 2003-10-27 10:52:02 EST
Test case added: test0500 in ASTConverterTest2
Comment 5 David Audel CLA 2003-11-20 10:09:31 EST
Verified.