Bug 65180 - Spurious "Javadoc: xxx cannot be resolved or is not a field" error with inner classes
Summary: Spurious "Javadoc: xxx cannot be resolved or is not a field" error with inner...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.0 RC2   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-01 17:16 EDT by Avi Drissman CLA
Modified: 2004-07-19 13:45 EDT (History)
0 users

See Also:


Attachments
Patch files for fix and its tests (5.57 KB, application/octet-stream)
2004-06-03 11:46 EDT, Frederic Fusier CLA
no flags Details
Update patch for tests (6.84 KB, patch)
2004-06-04 08:00 EDT, Frederic Fusier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Avi Drissman CLA 2004-06-01 17:16:29 EDT
On code like:

public class Outer {
	public class Inner {
		/**
		 * Does something.
		 * 
		 * @see #outerFunc
		 */
		public void innerFunc() {}
	}
	
	public void outerFunc() {}
}

turning the preference Java > Compiler > Javadoc > Malformed Javadoc comments to Warning causes a 
spurious "outerFunc cannot be resolved or is not a field" error on the @see tag. The javadoc tool 
handles this just fine. Eclipse should too.

(On 3.0RC1)
Comment 1 Frederic Fusier CLA 2004-06-03 11:46:47 EDT
Created attachment 11542 [details]
Patch files for fix and its tests

Problem came from the fact that we always used scope.getMethod(...) while
resolving javadoc message send binding, even when this is an implicit
reference.
Fix by using scope.getImplicitMethod(...) when the receiver type is an implicit
javadoc type reference.

Fix also similar problem while resolving javadoc field references which fails
(returns a ProblemFieldBinding) when javadoc was in a nested type.
In this case, enlarge search with scope.getBinding(...) to see whether we have
an extra chance to get a valid binding in enclosing type.
Comment 2 Frederic Fusier CLA 2004-06-04 08:00:26 EDT
Created attachment 11588 [details]
Update patch for tests

While running AllJDTCore tests, Compliance_1_3 failed due to the fact that
tests 77 assume that error was not reported in Javadoc. With current fix, we
know report this error, so test was modified accordingly.

Patch pass all tests:
- AllJDTCore
- JDT/UI: Automated + Refactoring
- Massive: ASTConverterJavadoc + DefaultCommentMapper

Note that all tests were run with global patch including also fixes for bug
65174, bug 65253 and bug 65288
Comment 3 Frederic Fusier CLA 2004-06-08 13:37:24 EDT
Fixed.

Method and field javadoc references are now resolved in inner classes.

[jdt-core-internal]
See patch file for changes.
Test case added in JavadocTestMixed.
Also modify some existing test cases in Compiler_1_3 and JavaSearchJavadocTests 
impacted by the changes...
Comment 4 David Audel CLA 2004-06-11 09:36:18 EDT
Verified for 3.0RC2
Comment 5 Avi Drissman CLA 2004-06-14 12:09:13 EDT
I am still seeing this on RC2 (200406111814), in the code that I originally posted as a sample. Am I 
missing something?
Comment 6 Frederic Fusier CLA 2004-06-14 14:25:51 EDT
Yes, you're missing parenthesis in your reference...
You should have:
public class Outer {
	public class Inner {
		/**
		 * Does something.
		 * 
		 * @see #outerFunc()
		 */
		public void innerFunc() {}
	}
	
	public void outerFunc() {}
}
to see the warning disappearing...

Method reference without parenthesis are infered when there's only one
corresponding method in class, but it's only possible for top classes, not for
inner class...

As it was said in bug 51911, this inference is a luxary solution and
unfortunately has some currently some limitation...

Please set as VERIFIED if you agree... thx
Comment 7 Frederic Fusier CLA 2004-07-19 13:45:15 EDT
Verified in 3.0 final