Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 357325 - [render] Method parameter annotations are not shown in Javadoc hover/view
Summary: [render] Method parameter annotations are not shown in Javadoc hover/view
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.8   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.8 M4   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks:
 
Reported: 2011-09-11 08:15 EDT by Andrey Loskutov CLA
Modified: 2011-12-06 08:41 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Loskutov CLA 2011-09-11 08:15:28 EDT
Build Identifier: 3.7.1 or any previous 3.5 - 3.7 builds

AS IS:
Given the example class below, javadoc hover shown for both methods (toString()/main()) does NOT include parameter annotations information.

#################################
import static java.lang.annotation.ElementType.*;

import java.lang.annotation.*;

public class TestParameterAnnotations {

	@NonNull
	String x;

	/**
	 * @param y any
	 * @return given value as string or empty string
	 */
	@NonNull
	public String toString(@NonNull Object y) {
		return  y != null ? y.toString() : "";
	}

	/**
	 * @param args any parameters
	 */
	public static void main(@NonNull String[] args) {
		String s = new TestParameterAnnotations().toString(null);
		System.err.println(s);
	}
}

@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE})
@Retention(RetentionPolicy.CLASS)
@interface NonNull {
}
######################################

TO BE:
As annotations like above are often very important for the code documentation, they should be shown for method parameters.
Interestingly, method return value annotation and class field annotations are shown in the javadoc hover/view.

Reproducible: Always
Comment 1 Markus Keller CLA 2011-09-12 07:08:55 EDT
Yes, we need to add these. They also show up in generated Javadoc, but only if you add @Documented to NonNull.

We currently show all annotations in the hovers, and I think we should keep it that way.

Needs new API in JavaElementLabels, since we shouldn't add this in all labels.
Comment 2 Markus Keller CLA 2011-12-05 10:56:07 EST
Fixed in master with commit b441737900fbbd3fe2346d6c05daa02ec061f6c1.
Comment 3 Raksha Vasisht CLA 2011-12-06 08:41:16 EST
Verified for Juno M4 with 4.2 I20111205-2330.