# HG changeset patch # User michaelm # Date 1323981585 28800 # Node ID 8851e7f3721f8f756cc9f5731600a152506542db # Parent e424ab0b2e00f6d64b28b938a8296639f87d1d1f# Parent 3ff13f513bc2478e05ff229fd5139989596d1850 Merge diff -r e424ab0b2e00 -r 8851e7f3721f .hgtags --- a/.hgtags Tue Dec 06 08:39:21 2011 -0800 +++ b/.hgtags Thu Dec 15 12:39:45 2011 -0800 @@ -139,4 +139,5 @@ ee94565d9f57ee9885e3af44891877163b637cc3 jdk7u1-b08 d37897312d318c18b0a855ce80f70c410865d105 jdk7u2-b11 f0802d8a0909f66ce19d3d44b33ddf4943aee076 jdk7u2-b12 -ce1da478667107c3da6222ae66a5bc5928d62f46 jdk7u4-b01 +f474527e77e4797d78bd6c3b31923fddcfd9d5c6 jdk7u2-b13 +fc0769df8cd03fffc38c7a1ab6b2e2e7cc2506a8 jdk7u2-b21 diff -r e424ab0b2e00 -r 8851e7f3721f src/share/classes/com/sun/tools/javac/code/Kinds.java --- a/src/share/classes/com/sun/tools/javac/code/Kinds.java Tue Dec 06 08:39:21 2011 -0800 +++ b/src/share/classes/com/sun/tools/javac/code/Kinds.java Thu Dec 15 12:39:45 2011 -0800 @@ -103,6 +103,8 @@ VAL("kindname.value"), METHOD("kindname.method"), CLASS("kindname.class"), + STATIC_INIT("kindname.static.init"), + INSTANCE_INIT("kindname.instance.init"), PACKAGE("kindname.package"); private String name; @@ -170,9 +172,11 @@ return KindName.CONSTRUCTOR; case METHOD: + return KindName.METHOD; case STATIC_INIT: + return KindName.STATIC_INIT; case INSTANCE_INIT: - return KindName.METHOD; + return KindName.INSTANCE_INIT; default: if (sym.kind == VAL) diff -r e424ab0b2e00 -r 8851e7f3721f src/share/classes/com/sun/tools/javac/code/Printer.java --- a/src/share/classes/com/sun/tools/javac/code/Printer.java Tue Dec 06 08:39:21 2011 -0800 +++ b/src/share/classes/com/sun/tools/javac/code/Printer.java Thu Dec 15 12:39:45 2011 -0800 @@ -311,7 +311,7 @@ @Override public String visitMethodSymbol(MethodSymbol s, Locale locale) { - if ((s.flags() & BLOCK) != 0) { + if (s.isStaticOrInstanceInit()) { return s.owner.name.toString(); } else { String ms = (s.name == s.name.table.names.init) diff -r e424ab0b2e00 -r 8851e7f3721f src/share/classes/com/sun/tools/javac/code/Symbol.java --- a/src/share/classes/com/sun/tools/javac/code/Symbol.java Tue Dec 06 08:39:21 2011 -0800 +++ b/src/share/classes/com/sun/tools/javac/code/Symbol.java Thu Dec 15 12:39:45 2011 -0800 @@ -149,7 +149,8 @@ * the default package; otherwise, the owner symbol is returned */ public Symbol location() { - if (owner.name == null || (owner.name.isEmpty() && owner.kind != PCK && owner.kind != TYP)) { + if (owner.name == null || (owner.name.isEmpty() && + (owner.flags() & BLOCK) == 0 && owner.kind != PCK && owner.kind != TYP)) { return null; } return owner; @@ -1299,10 +1300,17 @@ return ElementKind.CONSTRUCTOR; else if (name == name.table.names.clinit) return ElementKind.STATIC_INIT; + else if ((flags() & BLOCK) != 0) + return isStatic() ? ElementKind.STATIC_INIT : ElementKind.INSTANCE_INIT; else return ElementKind.METHOD; } + public boolean isStaticOrInstanceInit() { + return getKind() == ElementKind.STATIC_INIT || + getKind() == ElementKind.INSTANCE_INIT; + } + public Attribute getDefaultValue() { return defaultValue; } diff -r e424ab0b2e00 -r 8851e7f3721f src/share/classes/com/sun/tools/javac/comp/Check.java --- a/src/share/classes/com/sun/tools/javac/comp/Check.java Tue Dec 06 08:39:21 2011 -0800 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Thu Dec 15 12:39:45 2011 -0800 @@ -306,7 +306,16 @@ */ void duplicateError(DiagnosticPosition pos, Symbol sym) { if (!sym.type.isErroneous()) { - log.error(pos, "already.defined", sym, sym.location()); + Symbol location = sym.location(); + if (location.kind == MTH && + ((MethodSymbol)location).isStaticOrInstanceInit()) { + log.error(pos, "already.defined.in.clinit", kindName(sym), sym, + kindName(sym.location()), kindName(sym.location().enclClass()), + sym.location().enclClass()); + } else { + log.error(pos, "already.defined", kindName(sym), sym, + kindName(sym.location()), sym.location()); + } } } diff -r e424ab0b2e00 -r 8851e7f3721f src/share/classes/com/sun/tools/javac/resources/compiler.properties --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties Tue Dec 06 08:39:21 2011 -0800 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties Thu Dec 15 12:39:45 2011 -0800 @@ -68,9 +68,13 @@ compiler.err.already.annotated=\ {0} {1} has already been annotated -# 0: symbol, 1: symbol +# 0: symbol kind, 1: symbol, 2: symbol kind, 3: symbol compiler.err.already.defined=\ - {0} is already defined in {1} + {0} {1} is already defined in {2} {3} + +# 0: symbol kind, 1: symbol, 2: symbol kind, 3: symbol kind, 4: symbol +compiler.err.already.defined.in.clinit=\ + {0} {1} is already defined in {2} of {3} {4} # 0: string compiler.err.already.defined.single.import=\ @@ -1761,6 +1765,12 @@ compiler.misc.kindname.package=\ package +compiler.misc.kindname.static.init=\ + static initializer + +compiler.misc.kindname.instance.init=\ + instance initializer + ##### compiler.misc.no.args=\ diff -r e424ab0b2e00 -r 8851e7f3721f src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java --- a/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java Tue Dec 06 08:39:21 2011 -0800 +++ b/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java Thu Dec 15 12:39:45 2011 -0800 @@ -412,7 +412,7 @@ @Override public String visitMethodSymbol(MethodSymbol s, Locale locale) { String ownerName = visit(s.owner, locale); - if ((s.flags() & BLOCK) != 0) { + if (s.isStaticOrInstanceInit()) { return ownerName; } else { String ms = (s.name == s.name.table.names.init) diff -r e424ab0b2e00 -r 8851e7f3721f src/share/classes/com/sun/tools/javadoc/JavadocTool.java --- a/src/share/classes/com/sun/tools/javadoc/JavadocTool.java Tue Dec 06 08:39:21 2011 -0800 +++ b/src/share/classes/com/sun/tools/javadoc/JavadocTool.java Thu Dec 15 12:39:45 2011 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. 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 @@ -257,24 +257,15 @@ for (String p: excludedPackages) includedPackages.put(p, false); - if (docenv.fileManager.hasLocation(StandardLocation.SOURCE_PATH)) { - searchSubPackages(subPackages, - includedPackages, - packages, packageFiles, - StandardLocation.SOURCE_PATH, - EnumSet.of(JavaFileObject.Kind.SOURCE)); - searchSubPackages(subPackages, - includedPackages, - packages, packageFiles, - StandardLocation.CLASS_PATH, - EnumSet.of(JavaFileObject.Kind.CLASS)); - } else { - searchSubPackages(subPackages, - includedPackages, - packages, packageFiles, - StandardLocation.CLASS_PATH, - EnumSet.of(JavaFileObject.Kind.SOURCE, JavaFileObject.Kind.CLASS)); - } + StandardLocation path = docenv.fileManager.hasLocation(StandardLocation.SOURCE_PATH) + ? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH; + + searchSubPackages(subPackages, + includedPackages, + packages, packageFiles, + path, + EnumSet.of(JavaFileObject.Kind.SOURCE)); + return packageFiles; } diff -r e424ab0b2e00 -r 8851e7f3721f test/tools/javac/7086595/T7086595.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/7086595/T7086595.java Thu Dec 15 12:39:45 2011 -0800 @@ -0,0 +1,32 @@ +/* + * @test /nodynamiccopyright/ + * @bug 7086595 + * @summary Error message bug: name of initializer is 'null' + * @compile/fail/ref=T7086595.out -XDrawDiagnostics T7086595.java + */ + +class T7086595 { + + String s = "x"; + String s = nonExistent; + + int foo() { + String s = "x"; + String s = nonExistent; + } + + static int bar() { + String s = "x"; + String s = nonExistent; + } + + { + String s = "x"; + String s = nonExistent; + } + + static { + String s = "x"; + String s = nonExistent; + } +} diff -r e424ab0b2e00 -r 8851e7f3721f test/tools/javac/7086595/T7086595.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/7086595/T7086595.out Thu Dec 15 12:39:45 2011 -0800 @@ -0,0 +1,11 @@ +T7086595.java:11:12: compiler.err.already.defined: kindname.variable, s, kindname.class, T7086595 +T7086595.java:11:16: compiler.err.cant.resolve.location: kindname.variable, nonExistent, , , (compiler.misc.location: kindname.class, T7086595, null) +T7086595.java:15:16: compiler.err.already.defined: kindname.variable, s, kindname.method, foo() +T7086595.java:15:20: compiler.err.cant.resolve.location: kindname.variable, nonExistent, , , (compiler.misc.location: kindname.class, T7086595, null) +T7086595.java:20:16: compiler.err.already.defined: kindname.variable, s, kindname.method, bar() +T7086595.java:20:20: compiler.err.cant.resolve.location: kindname.variable, nonExistent, , , (compiler.misc.location: kindname.class, T7086595, null) +T7086595.java:25:16: compiler.err.already.defined.in.clinit: kindname.variable, s, kindname.instance.init, kindname.class, T7086595 +T7086595.java:25:20: compiler.err.cant.resolve.location: kindname.variable, nonExistent, , , (compiler.misc.location: kindname.class, T7086595, null) +T7086595.java:30:16: compiler.err.already.defined.in.clinit: kindname.variable, s, kindname.static.init, kindname.class, T7086595 +T7086595.java:30:20: compiler.err.cant.resolve.location: kindname.variable, nonExistent, , , (compiler.misc.location: kindname.class, T7086595, null) +10 errors diff -r e424ab0b2e00 -r 8851e7f3721f test/tools/javac/Diagnostics/6860795/T6860795.out --- a/test/tools/javac/Diagnostics/6860795/T6860795.out Tue Dec 06 08:39:21 2011 -0800 +++ b/test/tools/javac/Diagnostics/6860795/T6860795.out Thu Dec 15 12:39:45 2011 -0800 @@ -1,2 +1,2 @@ -T6860795.java:10:27: compiler.err.already.defined: x, foo +T6860795.java:10:27: compiler.err.already.defined: kindname.variable, x, kindname.method, foo 1 error diff -r e424ab0b2e00 -r 8851e7f3721f test/tools/javac/LocalClasses_2.out --- a/test/tools/javac/LocalClasses_2.out Tue Dec 06 08:39:21 2011 -0800 +++ b/test/tools/javac/LocalClasses_2.out Thu Dec 15 12:39:45 2011 -0800 @@ -1,2 +1,2 @@ -LocalClasses_2.java:15:13: compiler.err.already.defined: Local, foo() +LocalClasses_2.java:15:13: compiler.err.already.defined: kindname.class, Local, kindname.method, foo() 1 error diff -r e424ab0b2e00 -r 8851e7f3721f test/tools/javac/NestedInnerClassNames.out --- a/test/tools/javac/NestedInnerClassNames.out Tue Dec 06 08:39:21 2011 -0800 +++ b/test/tools/javac/NestedInnerClassNames.out Thu Dec 15 12:39:45 2011 -0800 @@ -1,18 +1,18 @@ -NestedInnerClassNames.java:16:5: compiler.err.already.defined: NestedInnerClassNames, compiler.misc.unnamed.package -NestedInnerClassNames.java:23:9: compiler.err.already.defined: NestedInnerClassNames.foo, NestedInnerClassNames -NestedInnerClassNames.java:34:9: compiler.err.already.defined: NestedInnerClassNames, compiler.misc.unnamed.package -NestedInnerClassNames.java:45:9: compiler.err.already.defined: NestedInnerClassNames.baz, NestedInnerClassNames -NestedInnerClassNames.java:46:13: compiler.err.already.defined: NestedInnerClassNames.baz.baz, NestedInnerClassNames.baz -NestedInnerClassNames.java:59:9: compiler.err.already.defined: NestedInnerClassNames.foo$bar, NestedInnerClassNames -NestedInnerClassNames.java:76:13: compiler.err.already.defined: NestedInnerClassNames.$bar, NestedInnerClassNames -NestedInnerClassNames.java:90:13: compiler.err.already.defined: NestedInnerClassNames.bar$bar.bar, NestedInnerClassNames.bar$bar +NestedInnerClassNames.java:16:5: compiler.err.already.defined: kindname.class, NestedInnerClassNames, kindname.package, compiler.misc.unnamed.package +NestedInnerClassNames.java:23:9: compiler.err.already.defined: kindname.class, NestedInnerClassNames.foo, kindname.class, NestedInnerClassNames +NestedInnerClassNames.java:34:9: compiler.err.already.defined: kindname.class, NestedInnerClassNames, kindname.package, compiler.misc.unnamed.package +NestedInnerClassNames.java:45:9: compiler.err.already.defined: kindname.class, NestedInnerClassNames.baz, kindname.class, NestedInnerClassNames +NestedInnerClassNames.java:46:13: compiler.err.already.defined: kindname.class, NestedInnerClassNames.baz.baz, kindname.class, NestedInnerClassNames.baz +NestedInnerClassNames.java:59:9: compiler.err.already.defined: kindname.class, NestedInnerClassNames.foo$bar, kindname.class, NestedInnerClassNames +NestedInnerClassNames.java:76:13: compiler.err.already.defined: kindname.class, NestedInnerClassNames.$bar, kindname.class, NestedInnerClassNames +NestedInnerClassNames.java:90:13: compiler.err.already.defined: kindname.class, NestedInnerClassNames.bar$bar.bar, kindname.class, NestedInnerClassNames.bar$bar NestedInnerClassNames.java:109:5: compiler.err.duplicate.class: NestedInnerClassNames.foo.foo -NestedInnerClassNames.java:19:9: compiler.err.already.defined: NestedInnerClassNames, compiler.misc.unnamed.package -NestedInnerClassNames.java:28:13: compiler.err.already.defined: foo, m2() -NestedInnerClassNames.java:40:13: compiler.err.already.defined: NestedInnerClassNames, compiler.misc.unnamed.package -NestedInnerClassNames.java:52:13: compiler.err.already.defined: baz, m4() -NestedInnerClassNames.java:53:17: compiler.err.already.defined: baz.baz, baz -NestedInnerClassNames.java:67:13: compiler.err.already.defined: foo$bar, m5() -NestedInnerClassNames.java:83:17: compiler.err.already.defined: $bar, m6() -NestedInnerClassNames.java:97:17: compiler.err.already.defined: bar$bar.bar, bar$bar +NestedInnerClassNames.java:19:9: compiler.err.already.defined: kindname.class, NestedInnerClassNames, kindname.package, compiler.misc.unnamed.package +NestedInnerClassNames.java:28:13: compiler.err.already.defined: kindname.class, foo, kindname.method, m2() +NestedInnerClassNames.java:40:13: compiler.err.already.defined: kindname.class, NestedInnerClassNames, kindname.package, compiler.misc.unnamed.package +NestedInnerClassNames.java:52:13: compiler.err.already.defined: kindname.class, baz, kindname.method, m4() +NestedInnerClassNames.java:53:17: compiler.err.already.defined: kindname.class, baz.baz, kindname.class, baz +NestedInnerClassNames.java:67:13: compiler.err.already.defined: kindname.class, foo$bar, kindname.method, m5() +NestedInnerClassNames.java:83:17: compiler.err.already.defined: kindname.class, $bar, kindname.method, m6() +NestedInnerClassNames.java:97:17: compiler.err.already.defined: kindname.class, bar$bar.bar, kindname.class, bar$bar 17 errors diff -r e424ab0b2e00 -r 8851e7f3721f test/tools/javac/TryWithResources/BadTwr.out --- a/test/tools/javac/TryWithResources/BadTwr.out Tue Dec 06 08:39:21 2011 -0800 +++ b/test/tools/javac/TryWithResources/BadTwr.out Thu Dec 15 12:39:45 2011 -0800 @@ -1,5 +1,5 @@ -BadTwr.java:13:46: compiler.err.already.defined: r1, main(java.lang.String...) -BadTwr.java:18:20: compiler.err.already.defined: args, main(java.lang.String...) +BadTwr.java:13:46: compiler.err.already.defined: kindname.variable, r1, kindname.method, main(java.lang.String...) +BadTwr.java:18:20: compiler.err.already.defined: kindname.variable, args, kindname.method, main(java.lang.String...) BadTwr.java:21:13: compiler.err.cant.assign.val.to.final.var: thatsIt -BadTwr.java:26:24: compiler.err.already.defined: name, main(java.lang.String...) +BadTwr.java:26:24: compiler.err.already.defined: kindname.variable, name, kindname.method, main(java.lang.String...) 4 errors diff -r e424ab0b2e00 -r 8851e7f3721f test/tools/javac/TryWithResources/DuplicateResourceDecl.out --- a/test/tools/javac/TryWithResources/DuplicateResourceDecl.out Tue Dec 06 08:39:21 2011 -0800 +++ b/test/tools/javac/TryWithResources/DuplicateResourceDecl.out Thu Dec 15 12:39:45 2011 -0800 @@ -1,2 +1,2 @@ -DuplicateResourceDecl.java:12:56: compiler.err.already.defined: c, main(java.lang.String[]) +DuplicateResourceDecl.java:12:56: compiler.err.already.defined: kindname.variable, c, kindname.method, main(java.lang.String[]) 1 error diff -r e424ab0b2e00 -r 8851e7f3721f test/tools/javac/diags/examples/AlreadyDefinedClinit.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/AlreadyDefinedClinit.java Thu Dec 15 12:39:45 2011 -0800 @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// key: compiler.err.already.defined.in.clinit + +class AlreadyDefinedClinit { + static { + int i; + int i; + } +} diff -r e424ab0b2e00 -r 8851e7f3721f test/tools/javac/diags/examples/KindnameInstanceInit.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/KindnameInstanceInit.java Thu Dec 15 12:39:45 2011 -0800 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// key: compiler.err.already.defined.in.clinit +// key: compiler.misc.kindname.instance.init +// key: compiler.misc.kindname.class +// key: compiler.misc.kindname.variable +// key: compiler.misc.count.error +// key: compiler.err.error +// run: backdoor + +class KindnameInstanceInit { + { + int i; + int i; + } +} diff -r e424ab0b2e00 -r 8851e7f3721f test/tools/javac/diags/examples/KindnameStaticInit.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/KindnameStaticInit.java Thu Dec 15 12:39:45 2011 -0800 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// key: compiler.err.already.defined.in.clinit +// key: compiler.misc.kindname.static.init +// key: compiler.misc.kindname.class +// key: compiler.misc.kindname.variable +// key: compiler.misc.count.error +// key: compiler.err.error +// run: backdoor + +class KindnameStaticInit { + static { + int i; + int i; + } +} diff -r e424ab0b2e00 -r 8851e7f3721f test/tools/javac/generics/6910550/T6910550d.out --- a/test/tools/javac/generics/6910550/T6910550d.out Tue Dec 06 08:39:21 2011 -0800 +++ b/test/tools/javac/generics/6910550/T6910550d.out Thu Dec 15 12:39:45 2011 -0800 @@ -1,2 +1,2 @@ -T6910550d.java:12:14: compiler.err.already.defined: m(X), T6910550d +T6910550d.java:12:14: compiler.err.already.defined: kindname.method, m(X), kindname.class, T6910550d 1 error diff -r e424ab0b2e00 -r 8851e7f3721f test/tools/javac/javazip/Test.sh --- a/test/tools/javac/javazip/Test.sh Tue Dec 06 08:39:21 2011 -0800 +++ b/test/tools/javac/javazip/Test.sh Thu Dec 15 12:39:45 2011 -0800 @@ -47,7 +47,7 @@ ;; CYGWIN* ) FS="/" - SCR=`pwd | cygpath -d` + SCR=`pwd | cygpath -d -f -` ;; Windows* ) FS="\\" diff -r e424ab0b2e00 -r 8851e7f3721f test/tools/javadoc/parser/7091528/T7091528.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javadoc/parser/7091528/T7091528.java Thu Dec 15 12:39:45 2011 -0800 @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 7091528 + * @summary javadoc attempts to parse .class files + * @compile p/C1.java p/q/C2.java + * @run main T7091528 + */ + +import java.io.File; +import java.io.PrintWriter; +import java.io.StringWriter; + +public class T7091528 { + public static void main(String... args) { + new T7091528().run(); + } + + void run() { + File testSrc = new File(System.getProperty("test.src")); + File testClasses = new File(System.getProperty("test.classes")); + String[] args = { + "-d", ".", + "-sourcepath", testClasses + File.pathSeparator + testSrc, + "-subpackages", + "p" + }; + + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + String doclet = com.sun.tools.doclets.standard.Standard.class.getName(); + int rc = com.sun.tools.javadoc.Main.execute("javadoc", pw, pw, pw, doclet, args); + pw.close(); + + String out = sw.toString(); + if (!out.isEmpty()) { + System.err.println(out); + } + + if (rc != 0) + System.err.println("javadoc failed: exit code = " + rc); + + if (out.matches("(?s).*p/[^ ]+\\.class.*")) + throw new Error("reading .class files"); + + if (!new File("index.html").exists()) + throw new Error("index.html not found"); + } +} diff -r e424ab0b2e00 -r 8851e7f3721f test/tools/javadoc/parser/7091528/p/C1.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javadoc/parser/7091528/p/C1.java Thu Dec 15 12:39:45 2011 -0800 @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package p1; + +/** This is class C1. */ +public class C1 { } + diff -r e424ab0b2e00 -r 8851e7f3721f test/tools/javadoc/parser/7091528/p/q/C2.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javadoc/parser/7091528/p/q/C2.java Thu Dec 15 12:39:45 2011 -0800 @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package p.q; + +/** This is class p.q.C2. */ +public class C2 { } +