5093723: REGRESSION: ClassCastException in SingleIndexWriter

Reviewed-by: jjg
This commit is contained in:
Peter von der Ahe 2009-09-08 13:53:10 -07:00 committed by Jonathan Gibbons
parent e21ea57f72
commit f4883897ce
5 changed files with 132 additions and 1 deletions

View File

@ -1435,7 +1435,17 @@ public class HtmlDocletWriter extends HtmlDocWriter {
// documented, this must be an inherited link. Redirect it.
// The current class either overrides the referenced member or
// inherits it automatically.
containing = ((ClassWriterImpl) this).getClassDoc();
if (this instanceof ClassWriterImpl) {
containing = ((ClassWriterImpl) this).getClassDoc();
} else if (!containing.isPublic()){
configuration.getDocletSpecificMsg().warning(
see.position(), "doclet.see.class_or_package_not_accessible",
tagName, containing.qualifiedName());
} else {
configuration.getDocletSpecificMsg().warning(
see.position(), "doclet.see.class_or_package_not_found",
tagName, seetext);
}
}
if (configuration.currentcd != containing) {
refMemName = containing.name() + "." + refMemName;

View File

@ -69,6 +69,7 @@ doclet.URL_error=Error fetching URL: {0}
doclet.No_Package_Comment_File=For Package {0} Package.Comment file not found
doclet.No_Source_For_Class=Source information for class {0} not available.
doclet.see.class_or_package_not_found=Tag {0}: reference not found: {1}
doclet.see.class_or_package_not_accessible=Tag {0}: reference not accessible: {1}
doclet.see.malformed_tag=Tag {0}: Malformed: {1}
doclet.Inherited_API_Summary=Inherited API Summary
doclet.Deprecated_API=Deprecated API

View File

@ -0,0 +1,34 @@
/*
* Copyright 2009 Google, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/** A documented class. */
public class DocumentedClass extends UndocumentedClass {
/** {@link #method} */
public void m1() {}
/** {@link #publicMethod} */
public void m2() {}
/** {@link #protectedMethod} */
public void m3() {}
/** {@link #privateMethod} */
public void m4() {}
}

View File

@ -0,0 +1,57 @@
/*
* Copyright 2009 Google, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 5093723
* @summary REGRESSION: ClassCastException in SingleIndexWriter
* @library ../lib/
* @build JavadocTester
* @build T5093723
* @run main T5093723
*/
public class T5093723 extends JavadocTester {
private static final String BUG_ID = "5093723";
private static final String[] ARGS = new String[] {
"-d", BUG_ID + ".out", "-source", "5",
SRC_DIR + "/DocumentedClass.java",
SRC_DIR + "/UndocumentedClass.java"
};
public static void main(String... args) {
T5093723 tester = new T5093723();
if (tester.runJavadoc(ARGS) != 0)
throw new AssertionError("non-zero return code from javadoc");
}
public String getBugId() {
return BUG_ID;
}
public String getBugName() {
return getClass().getName();
}
}

View File

@ -0,0 +1,29 @@
/*
* Copyright 2009 Google, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
class UndocumentedClass {
void method() {}
public void publicMethod() {}
protected void protectedMethod() {}
private void privateMethod() {}
}