United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 4957170 Javadoc: Case Of Dissapearing Methods When Being Overloaded
4957170 : Javadoc: Case Of Dissapearing Methods When Being Overloaded

Details
Type:
Bug
Submit Date:
2003-11-20
Status:
Closed
Updated Date:
2003-11-20
Project Name:
JDK
Resolved Date:
2003-11-20
Component:
docs
OS:
windows_xp
Sub-Component:
doclet
CPU:
x86
Priority:
P4
Resolution:
Duplicate
Affected Versions:
1.4.2
Fixed Versions:

Related Reports
Duplicate:

Sub Tasks

Description

Name: rmT116609			Date: 11/19/2003


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 :
Microsoft 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 symbol
symbol  : class Fake
location: class com.taglets.EmailTaglet
	public void method_m (Fake x) { }
                             ^

This symbol 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) 
======================================================================

                                    

Comments



Hardware and Software, Engineered to Work Together