Bug 23054 - DOM - TypeDeclaration.getJavadoc() can find incorrect javadoc
Summary: DOM - TypeDeclaration.getJavadoc() can find incorrect javadoc
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 23264 31626 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-08-30 16:37 EDT by mark_dixon CLA
Modified: 2003-02-28 12:47 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mark_dixon CLA 2002-08-30 16:37:17 EDT
Running 200208270833

This code
IWorkspace ws = testcasesPlugin.getWorkspace();
IWorkspaceRoot root = ws.getRoot();
IProject project = root.getProjects()[0];
IJavaProject jp = JavaCore.create(project);
		
CompilationUnit cu = AST.parseCompilationUnit(
   "public class Class {/** Method theMethod.*/ void theMethod()  
{} }".toCharArray(),
   "Class", jp);
cu.accept(new ASTVisitor() {
   public boolean visit(TypeDeclaration node) {
      Javadoc doc = node.getJavadoc();
      // Javadoc must start before the type name!
      if (node.getName().getStartPosition() < doc.getStartPosition()) {
         System.out.println("Incorrect javadoc associated with type");
      }
      return true;
   }
});

produces
Incorrect javadoc associated with type

The problem is that ASTConverter.setJavaDocComment finds the *first* javadoc in 
the type - if the type doesn't have javadoc but a member does then that'll be 
returned as the type's doc.  I think ASTConverter.setJavaDocComment should stop 
searching for javadoc once it finds a token other than a comment or whitespace.

Thanks
Mark
Comment 1 Olivier Thomann CLA 2002-09-04 13:41:07 EDT
Thank you for all your nice reports.
Fixed and released in 2.1 stream.
Comment 2 Olivier Thomann CLA 2002-09-06 10:06:51 EDT
*** Bug 23264 has been marked as a duplicate of this bug. ***
Comment 3 David Audel CLA 2002-09-19 04:46:46 EDT
Verified.
Comment 4 Olivier Thomann CLA 2002-09-19 11:04:54 EDT
Regression test added (test0381)
Comment 5 Olivier Thomann CLA 2003-02-28 12:45:51 EST
Backported to 2.0.x stream.
Regression test added in 2.0.x stream.
Comment 6 Olivier Thomann CLA 2003-02-28 12:47:08 EST
*** Bug 31626 has been marked as a duplicate of this bug. ***