5093723: REGRESSION: ClassCastException in SingleIndexWriter

Tue, 08 Sep 2009 13:53:10 -0700

author
jjg
date
Tue, 08 Sep 2009 13:53:10 -0700
changeset 405
ebb6ad5a95bb
parent 402
261c54b2312e
child 406
071a4e36cd87

5093723: REGRESSION: ClassCastException in SingleIndexWriter
Reviewed-by: jjg
Contributed-by: ahe@google.com

src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties file | annotate | diff | comparison | revisions
test/com/sun/javadoc/5093723/DocumentedClass.java file | annotate | diff | comparison | revisions
test/com/sun/javadoc/5093723/T5093723.java file | annotate | diff | comparison | revisions
test/com/sun/javadoc/5093723/UndocumentedClass.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Tue Sep 08 11:43:57 2009 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Tue Sep 08 13:53:10 2009 -0700
     1.3 @@ -1435,7 +1435,17 @@
     1.4                  // documented, this must be an inherited link.  Redirect it.
     1.5                  // The current class either overrides the referenced member or
     1.6                  // inherits it automatically.
     1.7 -                containing = ((ClassWriterImpl) this).getClassDoc();
     1.8 +                if (this instanceof ClassWriterImpl) {
     1.9 +                    containing = ((ClassWriterImpl) this).getClassDoc();
    1.10 +                } else if (!containing.isPublic()){
    1.11 +                    configuration.getDocletSpecificMsg().warning(
    1.12 +                        see.position(), "doclet.see.class_or_package_not_accessible",
    1.13 +                        tagName, containing.qualifiedName());
    1.14 +                } else {
    1.15 +                    configuration.getDocletSpecificMsg().warning(
    1.16 +                        see.position(), "doclet.see.class_or_package_not_found",
    1.17 +                        tagName, seetext);
    1.18 +                }
    1.19              }
    1.20              if (configuration.currentcd != containing) {
    1.21                  refMemName = containing.name() + "." + refMemName;
     2.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties	Tue Sep 08 11:43:57 2009 -0700
     2.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties	Tue Sep 08 13:53:10 2009 -0700
     2.3 @@ -69,6 +69,7 @@
     2.4  doclet.No_Package_Comment_File=For Package {0} Package.Comment file not found
     2.5  doclet.No_Source_For_Class=Source information for class {0} not available.
     2.6  doclet.see.class_or_package_not_found=Tag {0}: reference not found: {1}
     2.7 +doclet.see.class_or_package_not_accessible=Tag {0}: reference not accessible: {1}
     2.8  doclet.see.malformed_tag=Tag {0}: Malformed: {1}
     2.9  doclet.Inherited_API_Summary=Inherited API Summary
    2.10  doclet.Deprecated_API=Deprecated API
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/test/com/sun/javadoc/5093723/DocumentedClass.java	Tue Sep 08 13:53:10 2009 -0700
     3.3 @@ -0,0 +1,34 @@
     3.4 +/*
     3.5 + * Copyright 2009 Google, Inc.  All Rights Reserved.
     3.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.7 + *
     3.8 + * This code is free software; you can redistribute it and/or modify it
     3.9 + * under the terms of the GNU General Public License version 2 only, as
    3.10 + * published by the Free Software Foundation.
    3.11 + *
    3.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    3.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    3.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    3.15 + * version 2 for more details (a copy is included in the LICENSE file that
    3.16 + * accompanied this code).
    3.17 + *
    3.18 + * You should have received a copy of the GNU General Public License version
    3.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    3.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    3.21 + *
    3.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    3.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
    3.24 + * have any questions.
    3.25 + */
    3.26 +
    3.27 +/** A documented class. */
    3.28 +public class DocumentedClass extends UndocumentedClass {
    3.29 +  /** {@link #method} */
    3.30 +  public void m1() {}
    3.31 +  /** {@link #publicMethod} */
    3.32 +  public void m2() {}
    3.33 +  /** {@link #protectedMethod} */
    3.34 +  public void m3() {}
    3.35 +  /** {@link #privateMethod} */
    3.36 +  public void m4() {}
    3.37 +}
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/test/com/sun/javadoc/5093723/T5093723.java	Tue Sep 08 13:53:10 2009 -0700
     4.3 @@ -0,0 +1,57 @@
     4.4 +/*
     4.5 + * Copyright 2009 Google, Inc.  All Rights Reserved.
     4.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.7 + *
     4.8 + * This code is free software; you can redistribute it and/or modify it
     4.9 + * under the terms of the GNU General Public License version 2 only, as
    4.10 + * published by the Free Software Foundation.
    4.11 + *
    4.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    4.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    4.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    4.15 + * version 2 for more details (a copy is included in the LICENSE file that
    4.16 + * accompanied this code).
    4.17 + *
    4.18 + * You should have received a copy of the GNU General Public License version
    4.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    4.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    4.21 + *
    4.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    4.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
    4.24 + * have any questions.
    4.25 + */
    4.26 +
    4.27 +/*
    4.28 + * @test
    4.29 + * @bug      5093723
    4.30 + * @summary  REGRESSION: ClassCastException in SingleIndexWriter
    4.31 + * @library  ../lib/
    4.32 + * @build    JavadocTester
    4.33 + * @build    T5093723
    4.34 + * @run main T5093723
    4.35 + */
    4.36 +
    4.37 +public class T5093723 extends JavadocTester {
    4.38 +
    4.39 +    private static final String BUG_ID = "5093723";
    4.40 +
    4.41 +    private static final String[] ARGS = new String[] {
    4.42 +        "-d", BUG_ID + ".out", "-source", "5",
    4.43 +        SRC_DIR + "/DocumentedClass.java",
    4.44 +        SRC_DIR + "/UndocumentedClass.java"
    4.45 +    };
    4.46 +
    4.47 +    public static void main(String... args) {
    4.48 +        T5093723 tester = new T5093723();
    4.49 +        if (tester.runJavadoc(ARGS) != 0)
    4.50 +          throw new AssertionError("non-zero return code from javadoc");
    4.51 +    }
    4.52 +
    4.53 +    public String getBugId() {
    4.54 +        return BUG_ID;
    4.55 +    }
    4.56 +
    4.57 +    public String getBugName() {
    4.58 +        return getClass().getName();
    4.59 +    }
    4.60 +}
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/test/com/sun/javadoc/5093723/UndocumentedClass.java	Tue Sep 08 13:53:10 2009 -0700
     5.3 @@ -0,0 +1,29 @@
     5.4 +/*
     5.5 + * Copyright 2009 Google, Inc.  All Rights Reserved.
     5.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.7 + *
     5.8 + * This code is free software; you can redistribute it and/or modify it
     5.9 + * under the terms of the GNU General Public License version 2 only, as
    5.10 + * published by the Free Software Foundation.
    5.11 + *
    5.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    5.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    5.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    5.15 + * version 2 for more details (a copy is included in the LICENSE file that
    5.16 + * accompanied this code).
    5.17 + *
    5.18 + * You should have received a copy of the GNU General Public License version
    5.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    5.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    5.21 + *
    5.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    5.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
    5.24 + * have any questions.
    5.25 + */
    5.26 +
    5.27 +class UndocumentedClass {
    5.28 +    void method() {}
    5.29 +    public void publicMethod() {}
    5.30 +    protected void protectedMethod() {}
    5.31 +    private void privateMethod() {}
    5.32 +}

mercurial