Bug 195374 - [javadoc] Missing Javadoc warning for required qualification for inner types at 1.4 level
Summary: [javadoc] Missing Javadoc warning for required qualification for inner types ...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M3   Edit
Assignee: Eric Jodet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 238020 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-07-04 08:12 EDT by Martin Aeschlimann CLA
Modified: 2008-06-23 01:08 EDT (History)
7 users (show)

See Also:


Attachments
[screen shot] Generate Javadoc wizard (47.80 KB, image/jpeg)
2007-09-05 01:10 EDT, Eric Jodet CLA
no flags Details
screenshot (22.81 KB, image/png)
2007-09-05 04:46 EDT, Martin Aeschlimann CLA
no flags Details
[proposed patch + test case] on top v810 - all jdt.core tests OK (3.54 KB, patch)
2007-09-07 07:23 EDT, Eric Jodet CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Aeschlimann CLA 2007-07-04 08:12:41 EDT
In the example below, the Javadoc tool complaines about the missing qualification, but the JDT compiler doesn't.


public class IntroduceParameterObjectDescriptor {
        public static class Parameter {
           /**
             * The position in the new method signature depends on the
             * position in the array passed to
             * {@link IntroduceParameterObjectDescriptor#setParameters(Parameter[])}
             */
             public int getIndex() {
                        return 0;
             }
        }
}
Should be 
{@link
IntroduceParameterObjectDescriptor#setParameters(IntroduceParameterObjectDescriptor.Parameter[])}
Comment 1 Eric Jodet CLA 2007-07-12 04:47:35 EDT
(In reply to comment #0)
this difference of behavior can be observed with the 1.4.2 Javadoc Tool
(Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_15-b02))

The problem is not present at 1.5 or 1.6 level.
Comment 2 Philipe Mulet CLA 2007-08-31 12:51:46 EDT
So are you saying this was a bug in javadoc tool which got resolved in 1.5/1.6 ? If so, pls try to find bug entry in bugparade.
Comment 3 Eric Jodet CLA 2007-09-03 03:21:53 EDT
(In reply to comment #2)
Correct Philippe.
At the time I wrote comment #1, I tried to find corresponding issue in the bug database, without success.
As per a new search, I found several fixed candidates which could explain the difference of behavior observed between versions:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4976957
Other ones:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4686734
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4464323

Steps to reproduce:
- Have a new Java project containing the code below
public class IntroduceParameterObjectDescriptor {
        public static class Parameter {
           /**
             * The position in the new method signature depends on the
             * position in the array passed to
             * {@link IntroduceParameterObjectDescriptor#setParameters(Parameter[])}
             * {@link IntroduceParameterObjectDescriptor#setParameters(IntroduceParameterObjectDescriptor.Parameter[])}
             */
             public int getIndex() {
                        return 0;
             }
        }
        public void setParameters(Parameter[] params) {
    	}
}

- Project --> Generate Javadoc...
- keep defaults

With the 1.4.2 JRE, 2 warnings:
warning - Tag @link: can't find setParameters(Parameter[]) in IntroduceParameterObjectDescriptor
warning - Tag @link: can't find setParameters(Parameter[]) in IntroduceParameterObjectDescriptor

With the 1.6 JRE, no warning.

Martin, may you please have a go and try?
Comment 4 Martin Aeschlimann CLA 2007-09-03 04:56:20 EDT
Oh, I trust you. So I guess we would have to make it a configurable option if the compiler warns about unqualified inner types in Javadoc.
It's still important to have this as not everybody wants to use the latest JDK version and the missing warning already caused us several rebuilds in the Eclipse builds.
Comment 5 Eric Jodet CLA 2007-09-03 06:18:57 EDT
(In reply to comment #4)
A new preference might not be necessary, if we only intend to mimic the Javadoc tool behavior.
We could decide to raise a warning or not depending on JDK level (that is, raise a warning when level < 1.5)
Philippe?
Comment 6 Martin Aeschlimann CLA 2007-09-03 06:35:20 EDT
I don't think we should conclude from the source compliance to the behaviour of the Javadoc tool used. It's no problem to use a Javadoc command of a 1.6 SDK to generate documentation for 1.4 projects.
It's also not clear how Javadoc implementations from other VM vendors (IBM, BEA) behave. Maybe they already fixed the problem or have not done so yet in 1.5 or 1.6.
Comment 7 Jerome Lanneluc CLA 2007-09-03 11:51:28 EDT
My understanding is that it is a bug in Sun's Javadoc tool found in the 1.4.2 JDK. The 1.5 and 1.6 JDKs don't have this problem. And as Marting said, other vendors may not even have this bug. 

So I don't think it is worth adding a new option to be bug compatible with JDK1.4.2. We already have too many options. It is too bad that we use a buggy Javadoc tool for Eclipse builds, but we don't want to impact every Eclipse users just to avoid breaking Eclipse builds (btw how many were broken by this ?)
Comment 8 Martin Aeschlimann CLA 2007-09-03 12:19:47 EDT
I believe the 'bug' (better call it a behavior) existed in all JDK versions until 1.5. So adding support for this makes sense.

I didnt't investigate here but its possible that other Javadoc tool vendors still warn on qualified inner types, even in 1.5 and 1.6.

I think we 5 or more rebuilds because of such problems. I'm sure Olivier knows more as usually he has to run after these bugs.

I doubt that adding that option takes more than half a day. I also believe the option fits nicely in the Javadoc page: Report unqualified references to inner types.
So lets please fill this gap now.


Comment 9 Philipe Mulet CLA 2007-09-03 13:07:56 EDT
The question really is do we want to be bug compatible or not.
My vote is no since this is a demonstrated bug in some implementation (like it seems here).


Comment 10 Dani Megert CLA 2007-09-04 05:22:21 EDT
See also bug 175839. We need to resolve both the same way (in fact they are treated as dup by Sun).

Maybe we can convince releng to use 'javadoc' tool from 5.0 or IBM 1.4 - but first we'd need to figure out the differences.
Comment 11 Eric Jodet CLA 2007-09-04 09:01:03 EDT
Using Eclipse SDK Version: 3.3.0 Build id: I20070821-0800
Observed behavior summary

1.4.2 Level
Eclipse - compliance 1.4: no warning
Sun JDK 1.4.2: 1 warning (Tag @link: can't find setParameters(Parameter[]) in IntroduceParameterObjectDescriptor)
IBM JDK 1.4.2: 1 warning (Tag @link: can't find setParameters(Parameter[]) in IntroduceParameterObjectDescriptor)

5.0 Level
Eclipse - compliance 5.0: no warning
Sun JDK 1.5: no warning
IBM JDK 1.5: no warning
JRockit 1.5: no warning
Comment 12 Martin Aeschlimann CLA 2007-09-04 13:04:24 EDT
I still get the problem in 1.5 and 1.6. I wonder, what did we do different?

I used the Javadoc wizard with the different Javadoc commands and I also tried the command line.


SUN jdk 1.2.2:
javadoc: warning - d.IntroduceParameterObjectDescriptor.Parameter.getIndex(): Tag @link: can't find setParameters(Parameter[]) in d.IntroduceParameterObjectDescriptor

SUN jdk 1.3.1:
javadoc: warning - d.IntroduceParameterObjectDescriptor.Parameter.getIndex(): Tag @link: can't find setParameters(Parameter[]) in d.IntroduceParameterObjectDescriptor

IBM 1.3.1
javadoc: warning - d.IntroduceParameterObjectDescriptor.Parameter.getIndex(): Tag @link: can't find setParameters(Parameter[]) in d.IntroduceParameterObjectDescriptor

IBM 1.4.2
C:\workspaces\runtime-workspace\JUnit\src\d\IntroduceParameterObjectDescriptor.java:9: warning - Tag @link: can't find setParameters(Parameter[]) in d.IntroduceParameterObjectDescriptor

Sun 1.5.0_05
C:\workspaces\runtime-workspace\JUnit\src\d\IntroduceParameterObjectDescriptor.java:9: warning - Tag @link: can't find setParameters(Parameter[]) in d.IntroduceParameterObjectDescriptor

Sun 1.5.0_10

C:\workspaces\runtime-workspace\JUnit\src\d\IntroduceParameterObjectDescriptor.java:9: warning - Tag @link: can't find setParameters(Parameter[]) in d.IntroduceParameterObjectDescriptor

Sun 1.6.0_01

C:\workspaces\runtime-workspace\JUnit\src\d\IntroduceParameterObjectDescriptor.java:9: warning - Tag @link: can't find setParameters(Parameter[]) in d.IntroduceParameterObjectDescriptor

Sun 1.6.0_02
C:\workspaces\runtime-workspace\JUnit\src\d\IntroduceParameterObjectDescriptor.java:9: warning - Tag @link: can't find setParameters(Parameter[]) in d.IntroduceParameterObjectDescriptor

Sun 1.7.0-ea
C:\workspaces\runtime-workspace\JUnit\src\d\IntroduceParameterObjectDescriptor.java:9: warning - Tag @link: can't find setParameters(Parameter[]) in d.IntroduceParameterObjectDescriptor
Comment 13 Eric Jodet CLA 2007-09-05 01:10:36 EDT
Created attachment 77679 [details]
[screen shot] Generate Javadoc wizard

(In reply to comment #12)
Martin,
with corresponding project selected and Java editor opened, I use the pull down menu "Project --> Generate Javadoc..."
(as per attached screen shot)

I then select the path to the javadoc.exe I wish to use.
I keep the default settings and click the Finish button.

I had another quick go with Sun 1.5 and 1.6, to confirm the results posted in comment #11: warning are only raised when using javadoc 1.4.2, though no warning in Eclipse (which is the issue at hand).
Comment 14 Martin Aeschlimann CLA 2007-09-05 04:46:50 EDT
Created attachment 77695 [details]
screenshot

What's the exact versions of your JDK's?
Comment 15 Eric Jodet CLA 2007-09-05 04:53:09 EDT
(In reply to comment #14)
Sun
java version "1.4.2_15"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_15-b02)
Java HotSpot(TM) Client VM (build 1.4.2_15-b02, mixed mode)

java version "1.5.0_12"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04)
Java HotSpot(TM) Client VM (build 1.5.0_12-b04, mixed mode)

java version "1.6.0_03-ea"
Java(TM) SE Runtime Environment (build 1.6.0_03-ea-b01)
Java HotSpot(TM) Client VM (build 1.6.0_03-ea-b01, mixed mode)

IBM
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2)
Classic VM (build 1.4.2, J2RE 1.4.2 IBM Windows 32 build cndev-20040524 (JIT ena
bled: jitc))

java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build pwi32dev-20070511 (SR5))

IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Windows XP x86-32 j9vmwi3223-2007042
6 (JIT enabled)
J9VM - 20070420_12448_lHdSMR
JIT  - 20070419_1806_r8
GC   - 200704_19)
JCL  - 20070511
Comment 16 Dani Megert CLA 2007-09-05 05:49:14 EDT
Eric, can you confirm Martin's findings i.e. current (i.e. not early access) 1.6  and older 1.5 shows the bug. Also 1.7 seens to have the bug. What does JRocket 1.4 do?
Comment 17 Eric Jodet CLA 2007-09-05 06:30:45 EDT
(In reply to comment #16)
Dani,
had a go and tried with various "current" versions, no way I could reproduce the behavior observed by Martin :-(
May be we're not using the same source code.
Martin, may you please provide me with IntroduceParameterObjectDescriptor.java?
Comment 18 Dani Megert CLA 2007-09-05 06:46:03 EDT
>Martin, may you please provide me with IntroduceParameterObjectDescriptor.java?
The code from comment 0.
Comment 19 Eric Jodet CLA 2007-09-05 08:01:28 EDT
(In reply to comment #18)
that's what I suspected.
Then, our test cases are different.

If I copy/paste the code from comment #0 to a new Java project (with javadoc comment validation on), I get a warning:
Javadoc: The method setParameters(IntroduceParameterObjectDescriptor.Parameter[]) is undefined for the type IntroduceParameterObjectDescriptor

In a same way, if I use the Javadoc tool (any version), I get a similar warning:
warning - Tag @link: can't find setParameters(Parameter[]) in IntroduceParameterObjectDescriptor

As far as I can see in comment #0, this is true that there is no setParameters method in IntroduceParameterObjectDescriptor class, hence we have an unsatisfied link.

In order to get rid of this warning, irrelevant for the issue at hand (in comment #0, Martin complained "the Javadoc tool complaines about the missing qualification but the JDT compiler doesn't"), I created the missing method as shown in comment #3.
Which clears the warning in the Java editor.
But any javadoc tool < 5.0 will still complain about the missing reference:
warning - Tag @link: can't find setParameters(Parameter[]) in IntroduceParameterObjectDescriptor

Martin, may you please confirm that if you use the fixed code as shown in comment #3, you get the same behavior as described in the above comment?

If this is the case, then the fix would consist in taking the compliance into account, to raise a warning when < 5.0
Comment 20 Martin Aeschlimann CLA 2007-09-05 09:50:16 EDT
Oh, you're right. I should use the fixed version... Sorry for that!
1.4.2: warning
1.5.0_10: no warning
1.6.0_02: no warning
1.7.0-ea: no warning
Comment 21 Eric Jodet CLA 2007-09-05 10:13:56 EDT
(In reply to comment #20)
no pb. 
So, agreed on expected behavior after fixing this one would be to raise a warning only when compliance < 5.0?
Comment 22 Dani Megert CLA 2007-09-05 10:18:45 EDT
Yep.
Comment 23 Jerome Lanneluc CLA 2007-09-05 10:35:45 EDT
(In reply to comment #21)
> (In reply to comment #20)
> no pb. 
> So, agreed on expected behavior after fixing this one would be to raise a
> warning only when compliance < 5.0?
> 
Agreed as well. Just check that JDK 1.3.1 has the bug also. If it doesn't, then the condition would be to raise a warning when compliance == 1.4
Comment 24 Eric Jodet CLA 2007-09-07 02:37:08 EDT
(In reply to comment #23)
Once work around for bug 202572 applied, same issue with the 1.3.1 javadoc tool.
So, this confirms the expected behavior (raise a warning only when compliance < 5.0)
Comment 25 Eric Jodet CLA 2007-09-07 07:23:58 EDT
Created attachment 77878 [details]
[proposed patch + test case] on top v810 - all jdt.core tests OK

Flag unqualified referenced type when this type is defined in an inner class, and Compliance level < 5.0 in order to conform with observed javadoc tool behavior
Comment 26 Eric Jodet CLA 2007-09-07 07:25:13 EDT
(In reply to comment #25)
Frederic, Jerome, Olivier: please review proposed patch
Comment 27 Jerome Lanneluc CLA 2007-09-11 04:23:35 EDT
(In reply to comment #26)
Patch looks good to me, so +1 for this patch.
Comment 28 Olivier Thomann CLA 2007-09-11 08:56:14 EDT
+1
Comment 29 Frederic Fusier CLA 2007-09-28 09:35:50 EDT
(In reply to comment #26)
> (In reply to comment #25)
> Frederic, Jerome, Olivier: please review proposed patch
> 
Patch looks good: +1
Comment 30 Eric Jodet CLA 2007-10-04 09:07:02 EDT
Released for 3.4M3 in HEAD stream
Comment 31 David Audel CLA 2007-10-29 07:55:54 EDT
Verified for 3.4M3 using I20071029-0010 build.
Comment 32 Eric Jodet CLA 2008-06-23 01:08:51 EDT
*** Bug 238020 has been marked as a duplicate of this bug. ***