Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 318413

Summary: Javadoc view doesnt show comment when it is below an annotation
Product: [Eclipse Project] JDT Reporter: Prashant Deva <prashant.deva>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: deepakazad
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Prashant Deva CLA 2010-06-30 02:38:26 EDT
If I have a class declaration such as -


@SupressWarnings("mywarning")
/**
 * My Javadoc
 */
class MyClass{
}


when I place the caret over MyClass the JavaDoc view wont show the comment.

However, if I remove the annotation at the top (and place it after the comment), the javadoc for the class will show properly.
Comment 1 Deepak Azad CLA 2010-06-30 03:36:59 EDT
Annotations are part of the class/method declaration, and the Javadoc *must* appear immediately before the declaration.

For example, consider the following valid declaration for an abstract class

@SupressWarnings("mywarning") abstract
/**
 * Not a javadoc
 */
class MyClass{
}
Comment 2 Prashant Deva CLA 2010-07-01 06:35:15 EDT
Maybe you didnt get me, as you can see in my example, the comment does show 'exactly before' the class declaration.


What I am saying is that if I do this -



/**
 * My Javadoc
 */
@SupressWarnings("mywarning")
class MyClass{
}


then the Javadoc view shows the comment, however if I do this -


@SupressWarnings("mywarning")
/**
 * My Javadoc
 */
class MyClass{
}


then the Javadoc view doesnt show the comment.
Comment 3 Deepak Azad CLA 2010-07-01 06:56:12 EDT
(In reply to comment #2)
> @SupressWarnings("mywarning")  
> /**
>  * My Javadoc
>  */
> class MyClass{
> }
> 
> 
> then the Javadoc view doesnt show the comment.

@SupressWarnings("mywarning") is part of the declaration, hence your comment is also part of the declaration and hence not a javadoc.

/** Only this is a javadoc*/
@SupressWarnings("mywarning")
/** not javadoc*/
class /** not javadoc*/ MyClass /** not javadoc*/{

}