Duplicate :
|
FULL PRODUCT VERSION : java version "1.5.0_05" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05) Java HotSpot(TM) Client VM (build 1.5.0_05-b05, mixed mode, sharing) ADDITIONAL OS VERSION INFORMATION : Microsoft Windows XP [Version 5.1.2600] A DESCRIPTION OF THE PROBLEM : When Javadoc tags "see" and "link" are used with generic parameters, they fail to generate valid links. This is similar to bug 5096551, but that bug described the case where the <angle bracket> characters were used. My example doesn't use angle brackets at all, but the bug still shows up. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Process the supplied sample code with javadocs. You'll get error messages for all @see and @link tags that specify the generic parameter "GenType" EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - The javadoc tool should produce no errors or warnings, and I should get five valid links and five valid "See Also" links. ACTUAL - I only get valid links where I don't specify the generic parameter. For each tag, three of my links succeed and two fail. The four that fail produce warnings. ERROR MESSAGES/STACK TRACES THAT OCCUR : JavadocGenericSigBug.java:26: warning - Tag @see: can't find overloadedMethod(GenType) in com.arciem.app.bugs.JavadocGenericSigBug JavadocGenericSigBug.java:26: warning - Tag @see: can't find methodTwo(GenType) in com.arciem.app.bugs.JavadocGenericSigBug JavadocGenericSigBug.java:26: warning - Tag @link: can't find overloadedMethod(GenType) in com.arciem.app.bugs.JavadocGenericSigBug JavadocGenericSigBug.java:26: warning - Tag @link: can't find methodTwo(GenType) in com.arciem.app.bugs.JavadocGenericSigBug REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- public class JavadocGenericSigBug<GenType> { public void overloadedMethod(GenType y) { } public void overloadedMethod(String x) { } public void methodOne(String x) { } public void methodTwo(GenType x) { } /** * Javadoc comment trying to refer to all previous methods. First * is {@link #overloadedMethod(String)}, second * is {@link #overloadedMethod(GenType)}, (which fails) third * is {@link #methodOne(String)}, and last * is {@link #methodTwo(GenType)}, (which also fails). Try this in * Javadocs and you'll get an error for both methods that take a * generic type as a parameter. However, this works for * non-overloaded methods: {@link #methodTwo}. With overloaded * methods, {@link #overloadedMethod} can't know which one to link * to, so it defaults to the first one it finds. The following "see" * tags also fail when they specify * the generic parameter "GenType": * @see #overloadedMethod(String) * @see #overloadedMethod(GenType) * @see #methodOne(String) * @see #methodTwo(GenType) * @see #methodTwo */ public void methodThree() { } } ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : Where possible, don't specify any parameter. This fails with overloaded methods but works fine when the method names aren't duplicated.