Bug 45958

Summary: Compiler wrongly complains against valid @see constructor reference
Product: [Eclipse Project] JDT Reporter: Frederic Fusier <frederic_fusier>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: 3.0 M5   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Frederic Fusier CLA 2003-11-03 10:15:38 EST
Let's have following example:
public class X {
	int x;
	public X(int i) {
		x = i;
	}
	/**
	 * @see #X(int)
	 */
	void foo() {
	}
}

The compiler complains against the @see reference in Javadoc comment:
----------
1. WARNING in D:\usr\OTI\workspaces\dvpt-ffr\_Bug\X.java (at line 7)
	* @see #X(int)
	        ^
Annotation: The method X(int) is undefined for the type X
----------
1 problem (1 warning)

This wrong as the reference is valid. It seems that the compiler does not see 
that the reference might be on constructor and looks only for a method 
reference in this case...
Comment 1 Frederic Fusier CLA 2003-11-05 12:05:05 EST
All @see references <type>#<identifier>(<arguments>) were scanned as reference 
to a method.

Need to distinguish case when <identifier> is identical to type name (or 
enclosing type name when no type was specified).

In this case, then create an specific AnnotationAllocationExpression instead of 
an AnnotationMessageSend. This allow to resolve correctly the binding to 
constructor.

If the binding fails for constructor, then also try to get a method in case a 
method with constrcutor name was declared in the specified type...
Comment 2 Frederic Fusier CLA 2003-11-17 05:20:48 EST
Fixed.

Test cases added in AnnotationTestMixed:
 - testBug45958
 - testBug45958a
 - testBug45958b
 - testBug45958c
Comment 3 David Audel CLA 2003-11-21 07:49:48 EST
Verified.