Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4673477

regression: Duplicate classes not documented

XMLWordPrintable

    • mantis
    • generic
    • generic


      It appears that javadoc now fails to document duplicate .java files
      in the sourcepath. In JDK 1.3.1 and prior, javadoc behaved similarly
      to javac: The first occurrence found in the sourcepath is processed.
      Now if duplicate class definitions are found, the class is not documented
      and subsequent references to the class are broken.

      This is a problem because products in J2ME are often composed of a
      stack of source bases, where superset class definitions are given priority
      in the classpath. The 1.4.x javadoc tool doesn't do this, so it seems
      to break compatibility with previous versions and no longer behave
      similarly to javac.


      Sample: 3 files

      ./one/a/Foo.java
      ./two/a/Foo.java
      ./three/b/Bar.java

      --- ./one/a/Foo.java ---
      package a;

      public class Foo {

      }
      ---

      --- ./two/a/Foo.java ---
      package a;

      public class Foo {

      }
      ---

      --- ./three/b/Bar.java ---
      package b;

      import a.Foo;

      public class Bar extends Foo {

      }
      ---

      % javadoc -d docs -sourcepath one:two:three a b
      Loading source files for package a...
      Loading source files for package b...
      Constructing Javadoc information...
      /home/courtney/test/javadoc/two/a/Foo.java:3: duplicate class: a.Foo
      public class Foo {
             ^
      /home/courtney/test/javadoc/three/b/Bar.java:5: cannot resolve symbol
      symbol : class Foo
      location: class b.Bar
      public class Bar extends Foo {
                               ^
      Standard Doclet version 1.4.1

      Generating docs/constant-values.html...
      Building tree for all the packages and classes...
      Building index for all the packages and classes...
      Generating docs/overview-tree.html...
      Generating docs/index-all.html...
      Generating docs/deprecated-list.html...
      Building index for all classes...
      Generating docs/allclasses-frame.html...
      Generating docs/allclasses-noframe.html...
      Generating docs/index.html...
      Generating docs/packages.html...
      Generating docs/overview-summary.html...
      Generating docs/overview-frame.html...
      Generating docs/a/package-frame.html...
      Generating docs/a/package-summary.html...
      Generating docs/a/package-tree.html...
      Generating docs/b/package-frame.html...
      Generating docs/b/package-summary.html...
      Generating docs/b/package-tree.html...
      Generating docs/b/Bar.html...
      Generating docs/serialized-form.html...
      Generating docs/package-list...
      Generating docs/help-doc.html...
      Generating docs/stylesheet.css...
      2 warnings

            gafter Neal Gafter (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: