# HG changeset patch # User michaelm # Date 1327568010 0 # Node ID 1bee7edbb4b455dd6c2a4ef9d08d28dd63fde59b # Parent d8e7e2ccbd4104a78d5ff1e4b4ef6d4ba051bbec# Parent 7ca6d8cb4cc7628cbe9b463c7358873b9c525b90 Merge diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java Tue Jan 24 10:24:42 2012 -0800 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java Thu Jan 26 08:53:30 2012 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2012, 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 @@ -195,10 +195,7 @@ ClassUseWriter clsgen; String path = DirectoryManager.getDirectoryPath(classdoc. containingPackage()); - if (path.length() > 0) { - path += File.separator; - } - path += "class-use"; + path += "class-use" + DirectoryManager.URL_FILE_SEPARATOR; String filename = classdoc.name() + ".html"; String pkgname = classdoc.containingPackage().name(); pkgname += (pkgname.length() > 0)? ".class-use": "class-use"; diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java Tue Jan 24 10:24:42 2012 -0800 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java Thu Jan 26 08:53:30 2012 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2012, 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 @@ -302,7 +302,9 @@ Content constHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, getResource("doclet.Constants_Summary")); Content liConst = HtmlTree.LI(HtmlStyle.blockList, constHead); - Content line29 = getResource("doclet.Help_line_29"); + Content line29 = getResource("doclet.Help_line_29", + getHyperLinkString("constant-values.html", + configuration.getText("doclet.Constants_Summary"))); Content constPara = HtmlTree.P(line29); liConst.addContent(constPara); ul.addContent(liConst); diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties --- a/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties Tue Jan 24 10:24:42 2012 -0800 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties Thu Jan 26 08:53:30 2012 +0000 @@ -160,7 +160,7 @@ doclet.Help_line_26=These links show and hide the HTML frames. All pages are available with or without frames. doclet.Help_line_27=The {0} link shows all classes and interfaces except non-static nested types. doclet.Help_line_28=Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description. -doclet.Help_line_29=The Constant Field Values page lists the static final fields and their values. +doclet.Help_line_29=The {0} page lists the static final fields and their values. doclet.Help_line_30=This help file applies to API documentation generated using the standard doclet. doclet.Help_enum_line_1=Each enum has its own separate page with the following sections: doclet.Help_enum_line_2=Enum declaration diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java --- a/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java Tue Jan 24 10:24:42 2012 -0800 +++ b/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java Thu Jan 26 08:53:30 2012 +0000 @@ -70,6 +70,7 @@ private JavaCompiler compiler; private Locale locale; private String[] args; + private String[] classNames; private Context context; private List fileObjects; private Map notYetEntered; @@ -82,11 +83,13 @@ JavacTaskImpl(Main compilerMain, String[] args, + String[] classNames, Context context, List fileObjects) { this.ccw = ClientCodeWrapper.instance(context); this.compilerMain = compilerMain; this.args = args; + this.classNames = classNames; this.context = context; this.fileObjects = fileObjects; setLocale(Locale.getDefault()); @@ -101,17 +104,14 @@ Context context, Iterable classes, Iterable fileObjects) { - this(compilerMain, toArray(flags, classes), context, toList(fileObjects)); + this(compilerMain, toArray(flags), toArray(classes), context, toList(fileObjects)); } - static private String[] toArray(Iterable flags, Iterable classes) { + static private String[] toArray(Iterable iter) { ListBuffer result = new ListBuffer(); - if (flags != null) - for (String flag : flags) - result.append(flag); - if (classes != null) - for (String cls : classes) - result.append(cls); + if (iter != null) + for (String s : iter) + result.append(s); return result.toArray(new String[result.length()]); } @@ -129,7 +129,7 @@ initContext(); notYetEntered = new HashMap(); compilerMain.setAPIMode(true); - result = compilerMain.compile(args, context, fileObjects, processors); + result = compilerMain.compile(args, classNames, context, fileObjects, processors); cleanup(); return result == 0; } else { @@ -159,7 +159,7 @@ initContext(); compilerMain.setOptions(Options.instance(context)); compilerMain.filenames = new LinkedHashSet(); - Collection filenames = compilerMain.processArgs(CommandLine.parse(args)); + Collection filenames = compilerMain.processArgs(CommandLine.parse(args), classNames); if (!filenames.isEmpty()) throw new IllegalArgumentException("Malformed arguments " + toString(filenames, " ")); compiler = JavaCompiler.instance(context); @@ -174,6 +174,7 @@ // endContext will be called when all classes have been generated // TODO: should handle the case after each phase if errors have occurred args = null; + classNames = null; } } @@ -204,6 +205,7 @@ compiler = null; compilerMain = null; args = null; + classNames = null; context = null; fileObjects = null; notYetEntered = null; diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 src/share/classes/com/sun/tools/javac/comp/Infer.java --- a/src/share/classes/com/sun/tools/javac/comp/Infer.java Tue Jan 24 10:24:42 2012 -0800 +++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java Thu Jan 26 08:53:30 2012 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2012, 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 @@ -336,25 +336,29 @@ //replace uninferred type-vars targs = types.subst(targs, that.tvars, - instaniateAsUninferredVars(undetvars, that.tvars)); + instantiateAsUninferredVars(undetvars, that.tvars)); } return chk.checkType(warn.pos(), that.inst(targs, types), to); } //where - private List instaniateAsUninferredVars(List undetvars, List tvars) { + private List instantiateAsUninferredVars(List undetvars, List tvars) { + Assert.check(undetvars.length() == tvars.length()); ListBuffer new_targs = ListBuffer.lb(); - //step 1 - create syntethic captured vars + //step 1 - create synthetic captured vars for (Type t : undetvars) { UndetVar uv = (UndetVar)t; Type newArg = new CapturedType(t.tsym.name, t.tsym, uv.inst, syms.botType, null); new_targs = new_targs.append(newArg); } //step 2 - replace synthetic vars in their bounds + List formals = tvars; for (Type t : new_targs.toList()) { CapturedType ct = (CapturedType)t; ct.bound = types.subst(ct.bound, tvars, new_targs.toList()); - WildcardType wt = new WildcardType(ct.bound, BoundKind.EXTENDS, syms.boundClass); + WildcardType wt = new WildcardType(syms.objectType, BoundKind.UNBOUND, syms.boundClass); + wt.bound = (TypeVar)formals.head; ct.wildcard = wt; + formals = formals.tail; } return new_targs.toList(); } diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 src/share/classes/com/sun/tools/javac/comp/MemberEnter.java --- a/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Tue Jan 24 10:24:42 2012 -0800 +++ b/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Thu Jan 26 08:53:30 2012 +0000 @@ -42,6 +42,7 @@ import static com.sun.tools.javac.code.Flags.*; import static com.sun.tools.javac.code.Kinds.*; import static com.sun.tools.javac.code.TypeTags.*; +import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag; import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; /** This is the second phase of Enter, in which classes are completed @@ -140,7 +141,7 @@ JCDiagnostic msg = diags.fragment("fatal.err.no.java.lang"); throw new FatalError(msg); } else { - log.error(pos, "doesnt.exist", tsym); + log.error(DiagnosticFlag.RESOLVE_ERROR, pos, "doesnt.exist", tsym); } } env.toplevel.starImportScope.importAll(tsym.members()); diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 src/share/classes/com/sun/tools/javac/main/Main.java --- a/src/share/classes/com/sun/tools/javac/main/Main.java Tue Jan 24 10:24:42 2012 -0800 +++ b/src/share/classes/com/sun/tools/javac/main/Main.java Thu Jan 26 08:53:30 2012 +0000 @@ -31,6 +31,7 @@ import java.net.URL; import java.security.DigestInputStream; import java.security.MessageDigest; +import java.util.Arrays; import java.util.Collection; import java.util.LinkedHashSet; import java.util.MissingResourceException; @@ -205,6 +206,10 @@ * @param flags The array of command line arguments. */ public Collection processArgs(String[] flags) { // XXX sb protected + return processArgs(flags, null); + } + + public Collection processArgs(String[] flags, String[] classNames) { // XXX sb protected int ac = 0; while (ac < flags.length) { String flag = flags[ac]; @@ -245,6 +250,10 @@ } } + if (this.classnames != null && classNames != null) { + this.classnames.addAll(Arrays.asList(classNames)); + } + if (!checkDirectory(D)) return null; if (!checkDirectory(S)) @@ -341,6 +350,15 @@ List fileObjects, Iterable processors) { + return compile(args, null, context, fileObjects, processors); + } + + public int compile(String[] args, + String[] classNames, + Context context, + List fileObjects, + Iterable processors) + { if (options == null) options = Options.instance(context); // creates a new one @@ -353,14 +371,16 @@ * into account. */ try { - if (args.length == 0 && fileObjects.isEmpty()) { + if (args.length == 0 + && (classNames == null || classNames.length == 0) + && fileObjects.isEmpty()) { help(); return EXIT_CMDERR; } Collection files; try { - files = processArgs(CommandLine.parse(args)); + files = processArgs(CommandLine.parse(args), classNames); if (files == null) { // null signals an error in options, abort return EXIT_CMDERR; diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 test/com/sun/javadoc/testHelpFile/TestHelpFile.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/javadoc/testHelpFile/TestHelpFile.java Thu Jan 26 08:53:30 2012 +0000 @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2012, 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 7132631 + * @summary Make sure that the help file is generated correctly. + * @author Bhavesh Patel + * @library ../lib/ + * @build JavadocTester TestHelpFile + * @run main TestHelpFile + */ + +public class TestHelpFile extends JavadocTester { + + //Test information. + private static final String BUG_ID = "7132631"; + + //Javadoc arguments. + private static final String[] ARGS = new String[] { + "-d", BUG_ID, "-sourcepath", SRC_DIR, + SRC_DIR + FS + "TestHelpFile.java" + }; + + private static final String[][] NEGATED_TEST = NO_TEST; + + private static final String[][] TEST = { + {BUG_ID + FS + "help-doc.html", + "Constant Field Values" + }, + }; + + /** + * The entry point of the test. + * @param args the array of command line arguments. + */ + public static void main(String[] args) { + TestHelpFile tester = new TestHelpFile(); + run(tester, ARGS, TEST, NEGATED_TEST); + tester.printSummary(); + } + + /** + * {@inheritDoc} + */ + public String getBugId() { + return BUG_ID; + } + + /** + * {@inheritDoc} + */ + public String getBugName() { + return getClass().getName(); + } +} diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 test/com/sun/javadoc/testUseOption/TestUseOption.java --- a/test/com/sun/javadoc/testUseOption/TestUseOption.java Tue Jan 24 10:24:42 2012 -0800 +++ b/test/com/sun/javadoc/testUseOption/TestUseOption.java Thu Jan 26 08:53:30 2012 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 4496290 4985072 7006178 + * @bug 4496290 4985072 7006178 7068595 * @summary A simple test to determine if -use works. * @author jamieh * @library ../lib/ @@ -34,7 +34,7 @@ public class TestUseOption extends JavadocTester { - private static final String BUG_ID = "4496290-4985072-7006178"; + private static final String BUG_ID = "4496290-4985072-7006178-7068595"; //Input for string search tests. private static final String[] TEST2 = { @@ -64,6 +64,13 @@ } }; + private static final String[][] TEST4 = { + {BUG_ID + "-4" + FS + "pkg2" + FS + "class-use" + FS + "C3.html", "" + + "Frames" + } + }; + private static final String[] ARGS = new String[] { "-d", BUG_ID, "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2" }; @@ -76,6 +83,10 @@ "-d", BUG_ID + "-3", "-sourcepath", SRC_DIR, "-use", SRC_DIR + FS + "C.java", SRC_DIR + FS + "UsedInC.java" }; + private static final String[] ARGS4 = new String[] { + "-d", BUG_ID + "-4", "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2" + }; + /** * The entry point of the test. * @param args the array of command line arguments. @@ -108,6 +119,7 @@ } tester.printSummary(); run(tester, ARGS3, TEST3, NO_TEST); + run(tester, ARGS4, TEST4, NO_TEST); tester.printSummary(); } diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 test/tools/javac/7129225/Anno.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/7129225/Anno.java Thu Jan 26 08:53:30 2012 +0000 @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2012, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +@Target(ElementType.TYPE) +public @interface Anno { +} diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 test/tools/javac/7129225/AnnoProcessor.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/7129225/AnnoProcessor.java Thu Jan 26 08:53:30 2012 +0000 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2012, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +import java.util.Set; +import javax.annotation.processing.*; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.TypeElement; +import javax.tools.Diagnostic.Kind; + +@SupportedAnnotationTypes("Anno") +public class AnnoProcessor extends JavacTestingAbstractProcessor { + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } + + @Override + public boolean process(Set set, RoundEnvironment re) { + messager.printMessage(Kind.NOTE, "RUNNING - lastRound = " + re.processingOver()); + return true; + } +} + diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 test/tools/javac/7129225/NegTest.ref --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/7129225/NegTest.ref Thu Jan 26 08:53:30 2012 +0000 @@ -0,0 +1,2 @@ +TestImportStar.java:39:1: compiler.err.doesnt.exist: xxx +1 error diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 test/tools/javac/7129225/TestImportStar.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/7129225/TestImportStar.java Thu Jan 26 08:53:30 2012 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2012, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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 7129225 + * @summary import xxx.* isn't handled correctly by annotation processing + * @library ../lib + * @build JavacTestingAbstractProcessor + * @compile/fail/ref=NegTest.ref -XDrawDiagnostics TestImportStar.java + * @compile Anno.java AnnoProcessor.java + * @compile/ref=TestImportStar.ref -XDrawDiagnostics -processor AnnoProcessor -proc:only TestImportStar.java + */ + + //The @compile/fail... verifies that the fix doesn't break the normal compilation of import xxx.* + //The @comple/ref... verifies the fix fixes the bug + +import xxx.*; + +@Anno +public class TestImportStar { +} diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 test/tools/javac/7129225/TestImportStar.ref --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/7129225/TestImportStar.ref Thu Jan 26 08:53:30 2012 +0000 @@ -0,0 +1,3 @@ +- compiler.note.proc.messager: RUNNING - lastRound = false +TestImportStar.java:39:1: compiler.err.doesnt.exist: xxx +- compiler.note.proc.messager: RUNNING - lastRound = true diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 test/tools/javac/cast/7123100/T7123100a.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/cast/7123100/T7123100a.java Thu Jan 26 08:53:30 2012 +0000 @@ -0,0 +1,16 @@ +/* + * @test /nodynamiccopyright/ + * @bug 7123100 + * @summary javac fails with java.lang.StackOverflowError + * @compile/fail/ref=T7123100a.out -Werror -Xlint:unchecked -XDrawDiagnostics T7123100a.java + */ + +class T7123100a { + > E m() { + return null; + } + + void test() { + Z z = (Z)m(); + } +} diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 test/tools/javac/cast/7123100/T7123100a.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/cast/7123100/T7123100a.out Thu Jan 26 08:53:30 2012 +0000 @@ -0,0 +1,4 @@ +T7123100a.java:14:19: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), compiler.misc.type.captureof: 1, ?, Z +- compiler.err.warnings.and.werror +1 error +1 warning diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 test/tools/javac/cast/7123100/T7123100b.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/cast/7123100/T7123100b.java Thu Jan 26 08:53:30 2012 +0000 @@ -0,0 +1,12 @@ +/* + * @test /nodynamiccopyright/ + * @bug 7123100 + * @summary javac fails with java.lang.StackOverflowError + * @compile/fail/ref=T7123100b.out -Werror -Xlint:unchecked -XDrawDiagnostics T7123100b.java + */ + +class T7123100b { + void test(Enum e) { + Z z = (Z)e; + } +} diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 test/tools/javac/cast/7123100/T7123100b.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/cast/7123100/T7123100b.out Thu Jan 26 08:53:30 2012 +0000 @@ -0,0 +1,4 @@ +T7123100b.java:10:18: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), java.lang.Enum, Z +- compiler.err.warnings.and.werror +1 error +1 warning diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 test/tools/javac/cast/7123100/T7123100c.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/cast/7123100/T7123100c.java Thu Jan 26 08:53:30 2012 +0000 @@ -0,0 +1,16 @@ +/* + * @test /nodynamiccopyright/ + * @bug 7123100 + * @summary javac fails with java.lang.StackOverflowError + * @compile/fail/ref=T7123100c.out -Werror -Xlint:unchecked -XDrawDiagnostics T7123100c.java + */ + +class T7123100c { + E m(E e) { + return null; + } + + void test(Enum e) { + Z z = (Z)m(e); + } +} diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 test/tools/javac/cast/7123100/T7123100c.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/cast/7123100/T7123100c.out Thu Jan 26 08:53:30 2012 +0000 @@ -0,0 +1,4 @@ +T7123100c.java:14:19: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), java.lang.Enum, Z +- compiler.err.warnings.and.werror +1 error +1 warning diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 test/tools/javac/cast/7123100/T7123100d.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/cast/7123100/T7123100d.java Thu Jan 26 08:53:30 2012 +0000 @@ -0,0 +1,16 @@ +/* + * @test /nodynamiccopyright/ + * @bug 7123100 + * @summary javac fails with java.lang.StackOverflowError + * @compile/fail/ref=T7123100d.out -Werror -Xlint:unchecked -XDrawDiagnostics T7123100d.java + */ + +class T7123100d { + > E m(Enum e) { + return null; + } + + void test(Enum e) { + Z z = (Z)m(e); + } +} diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 test/tools/javac/cast/7123100/T7123100d.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/cast/7123100/T7123100d.out Thu Jan 26 08:53:30 2012 +0000 @@ -0,0 +1,4 @@ +T7123100d.java:14:19: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), compiler.misc.type.captureof: 1, ?, Z +- compiler.err.warnings.and.werror +1 error +1 warning diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 test/tools/javac/diags/CheckExamples.java --- a/test/tools/javac/diags/CheckExamples.java Tue Jan 24 10:24:42 2012 -0800 +++ b/test/tools/javac/diags/CheckExamples.java Thu Jan 26 08:53:30 2012 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2012, 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 @@ -23,10 +23,13 @@ /* * @test - * @bug 6968063 + * @bug 6968063 7127924 * @summary provide examples of code that generate diagnostics * @build Example CheckExamples - * @run main CheckExamples + * @run main/othervm CheckExamples + */ +/* + * See CR 7127924 for info on why othervm is used. */ import java.io.*; diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 test/tools/javac/diags/MessageInfo.java --- a/test/tools/javac/diags/MessageInfo.java Tue Jan 24 10:24:42 2012 -0800 +++ b/test/tools/javac/diags/MessageInfo.java Thu Jan 26 08:53:30 2012 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2012, 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 @@ -23,10 +23,13 @@ /** * @test - * @bug 7013272 + * @bug 7013272 7127924 * @summary Automatically generate info about how compiler resource keys are used * @build Example ArgTypeCompilerFactory MessageFile MessageInfo - * @run main MessageInfo + * @run main/othervm MessageInfo + */ +/* + * See CR 7127924 for info on why othervm is used. */ import java.io.*; diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 test/tools/javac/diags/RunExamples.java --- a/test/tools/javac/diags/RunExamples.java Tue Jan 24 10:24:42 2012 -0800 +++ b/test/tools/javac/diags/RunExamples.java Thu Jan 26 08:53:30 2012 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2012, 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 @@ -23,10 +23,13 @@ /** * @test - * @bug 6968063 + * @bug 6968063 7127924 * @summary provide examples of code that generate diagnostics * @build ArgTypeCompilerFactory Example HTMLWriter RunExamples - * @run main RunExamples + * @run main/othervm RunExamples + */ +/* + * See CR 7127924 for info on why othervm is used. */ import java.io.*; diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 test/tools/javah/T7126832/T7126832.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javah/T7126832/T7126832.java Thu Jan 26 08:53:30 2012 +0000 @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2012, 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 7126832 + * @compile java.java + * @summary com.sun.tools.javac.api.ClientCodeWrapper$WrappedJavaFileManager cannot be cast + * @run main T7126832 + */ + +import java.io.*; +import java.util.*; + +public class T7126832 { + public static void main(String... args) throws Exception { + new T7126832().run(); + } + + void run() throws Exception { + Locale prev = Locale.getDefault(); + Locale.setDefault(Locale.ENGLISH); + try { + // Verify that a .java file is correctly diagnosed + File ff = writeFile(new File("JavahTest.java"), "class JavahTest {}"); + test(Arrays.asList(ff.getPath()), 1, "Could not find class file for 'JavahTest.java'."); + + // Verify that a class named 'xx.java' is accepted. + // Note that ./xx/java.class exists, so this should work ok + test(Arrays.asList("xx.java"), 0, null); + + if (errors > 0) { + throw new Exception(errors + " errors occurred"); + } + } finally { + Locale.setDefault(prev); + } + } + + void test(List args, int expectRC, String expectOut) { + System.err.println("Test: " + args + + " rc:" + expectRC + + ((expectOut != null) ? " out:" + expectOut : "")); + + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + int rc = 0; + String out = null; + try { + rc = com.sun.tools.javah.Main.run(args.toArray(new String[args.size()]), pw); + out = sw.toString(); + } catch(Exception ee) { + rc = 1; + out = ee.toString();; + } + pw.close(); + if (!out.isEmpty()) { + System.err.println(out); + } + if (rc != expectRC) { + error("Unexpected exit code: " + rc + "; expected: " + expectRC); + } + if (expectOut != null && !out.contains(expectOut)) { + error("Expected string not found: " + expectOut); + } + + System.err.println(); + } + + File writeFile(File ff, String ss) throws IOException { + if (ff.getParentFile() != null) + ff.getParentFile().mkdirs(); + + try (FileWriter out = new FileWriter(ff)) { + out.write(ss); + } + return ff; + } + + void error(String msg) { + System.err.println(msg); + errors++; + } + + int errors; +} + diff -r d8e7e2ccbd41 -r 1bee7edbb4b4 test/tools/javah/T7126832/java.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javah/T7126832/java.java Thu Jan 26 08:53:30 2012 +0000 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2012, 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 xx; +class java { + int fred; +}