Bug 222188 - [javadoc] Incorrect usage of inner type not reported
Summary: [javadoc] Incorrect usage of inner type not reported
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.7 M6   Edit
Assignee: Satyam Kandula CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 215193 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-03-11 05:14 EDT by Dani Megert CLA
Modified: 2011-03-08 02:05 EST (History)
6 users (show)

See Also:
jarthana: review+


Attachments
[proposed patch + test case] on top v865 - all jdt.core tests OK (52.04 KB, patch)
2008-05-19 10:12 EDT, Eric Jodet CLA
no flags Details | Diff
[proposed patch + test case] on top v_866 (52.04 KB, patch)
2008-05-21 08:27 EDT, Eric Jodet CLA
no flags Details | Diff
Patch on HEAD (35.06 KB, patch)
2011-02-18 05:02 EST, Satyam Kandula CLA
satyam.kandula: review?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2008-03-11 05:14:47 EDT
N20080308-0100.

This build has a Javadoc warning (see bug 222099). I would expect that JDT Core reported this but it doesn't. In a simple and similar example like this:

package pack2;
import pack.Test.Inner;
abstract class X {
	Inner f;
	/**
	 * See also {@link Test.Inner}.
	 */
	void f() {
	}
}
 
The warning is correctly issued.
Comment 1 Dani Megert CLA 2008-03-11 05:26:49 EDT
Actually it can be reproduced with the simple example:

1. setup your project to use 1.4

2. paste this into Package Explorer
---- %< -----
package pack2;

import pack.Test;
class X {
	/**
	 * See also {@link Test.Inner}.
	 */
	void f() {
	}
}
package pack;

public class Test {

	public interface Inner {
	}
}
---- %< -----
3. setup to warn about invalid refs in Javadoc
==> no warning

Create Javadoc using 1.4 or 1.5
==> warning is issued.

See also bug 96237 which seems to have fixed this when the stuff is in the same package.
Comment 2 Eric Jodet CLA 2008-03-11 08:17:37 EDT
sound similar (if not a real dup) to bug 221539
Comment 3 Eric Jodet CLA 2008-03-11 08:30:32 EDT
(In reply to comment #2)
the test case in bug 221539 uses the same package, whereas the above test case uses 2 separate packages
Comment 4 Boris Bokowski CLA 2008-03-11 08:36:10 EDT
Thanks Dani - I was staring at the Javadoc warning for a bit but didn't understand what was going on. Why is the Javadoc there in the first place?
Comment 5 Dani Megert CLA 2008-03-11 08:37:47 EDT
> Why is the Javadoc there in the first place?
Where?
Comment 6 Boris Bokowski CLA 2008-03-11 08:52:13 EDT
For example, in the case you came up with in comment 0. Why is {@link Test.Inner} wrong? Should it be {@link Inner}?

If we have two imports:
import pack.Test;
import pack.Test.Inner;
- would {@link Test.Inner} still be wrong?
Comment 7 Dani Megert CLA 2008-03-11 09:13:52 EDT
>For example, in the case you came up with in comment 0. Why is {@link
>Test.Inner} wrong? 
Because for inner classes you either need to use full qualification or just the class itself, so yes {@link Inner} would work if there wasn't a bug in the 1.4 version of the javadoc tool :-(

>If we have two imports:
>import pack.Test;
>import pack.Test.Inner;
>- would {@link Test.Inner} still be wrong?
Yep.
Comment 8 Boris Bokowski CLA 2008-03-11 09:43:13 EDT
Thanks. Now it all makes sense to me again.
Comment 9 Dani Megert CLA 2008-03-18 10:41:47 EDT
Just got another Eclipse build warning due to that (see bug 223083).
Comment 10 Eric Jodet CLA 2008-05-19 10:12:40 EDT
Created attachment 100910 [details]
[proposed patch + test case] on top v865 - all jdt.core tests OK
Comment 11 Eric Jodet CLA 2008-05-19 10:13:32 EDT
Frederic, please review
Comment 12 Eric Jodet CLA 2008-05-19 10:14:56 EDT
(In reply to comment #10)
same patch fixes bug 221539
Comment 13 Jerome Lanneluc CLA 2008-05-20 07:52:43 EDT
This is not a regression comparing to 3.3.2. Will fix in 3.5.
Comment 14 Eric Jodet CLA 2008-05-21 08:27:30 EDT
Created attachment 101236 [details]
[proposed patch + test case] on top v_866

previous patch was the wrong one
Comment 15 Eric Jodet CLA 2008-06-04 10:31:30 EDT
bug 215193 describes the exact same issue, and attached patch fixes it.
Comment 16 Dani Megert CLA 2008-06-16 11:12:33 EDT
*** Bug 215193 has been marked as a duplicate of this bug. ***
Comment 17 Frederic Fusier CLA 2008-09-12 12:06:47 EDT
Not sure I'll have enough time to review the proposed patch for 3.5...
Comment 18 Markus Keller CLA 2008-11-06 08:24:01 EST
See also bug 253750.
Comment 19 Srikanth Sankaran CLA 2010-01-13 01:45:27 EST
Satyam, please investigate, thanks!
Comment 20 Srikanth Sankaran CLA 2010-01-13 01:51:13 EST
Satyam, please investigate, thanks.
Comment 21 Dani Megert CLA 2011-01-06 05:58:09 EST
(In reply to comment #20)
> Satyam, please investigate, thanks.

Ping! This happened again.
Comment 22 Satyam Kandula CLA 2011-01-06 06:06:05 EST
(In reply to comment #21)
I have the changes but unfortunately many tests needs to be updated -- Will fix those tests and create a patch.
Comment 23 Satyam Kandula CLA 2011-02-18 05:02:25 EST
Created attachment 189260 [details]
Patch on HEAD

Cleaned up the previous patch.
Comment 24 Satyam Kandula CLA 2011-02-18 05:03:02 EST
Jay, Can you please review the patch?
Comment 25 Jay Arthanareeswaran CLA 2011-02-24 05:07:52 EST
+1 for the patch.
Comment 26 Satyam Kandula CLA 2011-02-28 01:52:53 EST
Thanks Jay for the Review.
Released the patch on HEAD.
Comment 27 Dani Megert CLA 2011-03-01 10:37:31 EST
Thanks! Verified in N20110228-2000.
Comment 28 Markus Keller CLA 2011-03-03 08:39:14 EST
Just for reference: According to http://download.oracle.com/javase/6/docs/technotes/tools/windows/javadoc.html#specifyingname , "{@link Test.Inner}" would be legal, but sadly, javadoc.exe has this long-standing bug:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4464323

Furthermore, "{@link Inner}" is incorrect according to the spec, but again, the javadoc.exe implementation is broken.

I've filed bug 338809 for a quick fix for this (since users shouldn't have to do all this investigation just to add workarounds that violate the spec).
Comment 29 Jay Arthanareeswaran CLA 2011-03-08 02:05:15 EST
Verified for 3.7M6 using build I20110301-1537.