Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4957170
Votes 0
Synopsis Javadoc: Case Of Dissapearing Methods When Being Overloaded
Category doclet:tbd
Reported Against 1.4.2
Release Fixed
State 11-Closed, duplicate of 4836189, bug
Priority: 4-Low
Related Bugs 4836189
Submit Date 20-NOV-2003
Description




FULL PRODUCT VERSION :
java version "1.4.2_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_01-b06)
Java HotSpot(TM) Client VM (build 1.4.2_01-b06, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
 customer  Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
When generating a doclet using Javadoc, methods dissapear under very few conditions (do not appear in the generated doclet), although they should be there.

Generating a doclet for this code segment will result in the exclusion of the second method from the doclet (Class Fake does not exist)

private void method_m (Fake x) { }
private void method_m (Fake[] x) { }

Only the first method [void method_m (Fake)] appears in the generated doclet.

I have tested several other cases, and have included them along with what appeats in the generated doclet:

1)
-private void method_m (int x) { }
-private void method_m (int[] x) { }
Both methods appear

2) Object is defined
-private void method_m (int x) { }
-private void method_m (Object[] x) { }
Both methods appear

3) Object is defined
-private void method_m (Object x) { }
-private void method_m (Object[] x) { }
Both methods appear

4) Fake is define and imported ("import package.Fake;"), but not passed into Javadoc using the -classpath command-line option (or Fake does not exist)
-private void method_m (int x) { }
-private void method_m (Fake x) { }
Only the first method [void method_m (int)] appears

5) Fake is define and imported ("import package.Fake;"), but not passed into Javadoc using the -classpath command-line option (or Fake does not exist)
-private void method_m (int x) { }
-private void method_m (Fake[] x) { }
Only the first method [void method_m (int)] appears

6) Fake is define and imported ("import package.Fake;"), but not passed into Javadoc using the -classpath command-line option
-private void method_m (Fake x) { }
-private void method_m (Fake[] x) { }
Only the first method [void method_m (Fake)] appears

6) Fake is define and imported ("import package.Fake;") and now passed into Javadoc using the -classpath command-line option
-private void method_m (Fake x) { }
-private void method_m (Fake[] x) { }
Both methods appear

6) Fake is define and imported ("import package.Fake;") and now passed into Javadoc using the -classpath command-line option
-public void method_m (int x) { }
-public void method_m (double x) { }
-public void method_m (Fake x) { }
The first two methods appear, the last one is ommited

8) If two methods are overloaded with different number of parameters, then it works as expected. (Fake is undefined)
-private void method_m (Fake x) { }
-private void method_m (Fake[] x, Fake x) { }
Both methods appear


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
include~
private void method_m (Fake x) { }
private void method_m (Fake[] x) { }
~in a class, Fake can be defined but not passed in as a class using the Javadoc -classpath option.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
In the generated doclet, only the first method~
void method_m (Fake)
~will appear, the second method is not included at all.
ACTUAL -
In the generated doclet:
public void method_m(Fake x)

The statement (and all other information regarding)
public void method_m(Fake[] x)
was missing

ERROR MESSAGES/STACK TRACES THAT OCCUR :
SourceFile.java:50: cannot resolve  customer 
 customer   : class Fake
location: class com.taglets.EmailTaglet
	public void method_m (Fake x) { }
                             ^

This  customer  was not found because the -classpath option did not specify the location of class Fake. When Fake was specified with -classpath, Javadoc generated no errors and the doclet was as expected (with two methods)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
Either classes...

class SourceFile {
  public void method_m (Fake x) { }
  public void method_m (Fake[] x) { }
}

class AnotherSourceFile {
  public void method_m (int x) { }
  public void method_m (double x) { }
  public void method_m (Fake x) { }
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Add the Fake class to the -classpath commandline option when calling Javadoc.
I discovered this bug when I was compiling the source with javac and the correct -classpath option, but when I tried to generate the doclet without the option it gave me two warnings and the second method was excluded form the doclet.
This workaround will not work if the classpath of Fake is unknown, however then the file will not compile. The compilation of a file is not necessary for Javadoc to generate a doclet for the class though.
(Incident Review ID: 225724) 
======================================================================
Work Around
N/A
Evaluation
N/A
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang