Sat, 10 Aug 2013 13:27:38 +0100
8009640: -profile <compact> does not work when -bootclasspath specified
Reviewed-by: jjg
1.1 --- a/src/share/classes/com/sun/tools/javac/main/Main.java Fri Aug 09 15:01:33 2013 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javac/main/Main.java Sat Aug 10 13:27:38 2013 +0100 1.3 @@ -262,6 +262,11 @@ 1.4 } 1.5 } 1.6 1.7 + if (options.get(PROFILE) != null && options.get(BOOTCLASSPATH) != null) { 1.8 + error("err.profile.bootclasspath.conflict"); 1.9 + return null; 1.10 + } 1.11 + 1.12 if (this.classnames != null && classNames != null) { 1.13 this.classnames.addAll(Arrays.asList(classNames)); 1.14 }
2.1 --- a/src/share/classes/com/sun/tools/javac/resources/javac.properties Fri Aug 09 15:01:33 2013 -0700 2.2 +++ b/src/share/classes/com/sun/tools/javac/resources/javac.properties Sat Aug 10 13:27:38 2013 +0100 2.3 @@ -185,6 +185,8 @@ 2.4 key in annotation processor option ''{0}'' is not a dot-separated sequence of identifiers 2.5 javac.err.invalid.flag=\ 2.6 invalid flag: {0} 2.7 +javac.err.profile.bootclasspath.conflict=\ 2.8 + profile and bootclasspath options cannot be used together 2.9 javac.err.invalid.profile=\ 2.10 invalid profile: {0} 2.11 javac.err.invalid.target=\
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/test/tools/javac/T8009640/CheckRejectProfileBCPOptionsIfUsedTogetherTest.java Sat Aug 10 13:27:38 2013 +0100 3.3 @@ -0,0 +1,66 @@ 3.4 +/* 3.5 + * Copyright (c) 2013, Oracle and/or its affiliates. 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. Oracle designates this 3.11 + * particular file as subject to the "Classpath" exception as provided 3.12 + * by Oracle in the LICENSE file that accompanied this code. 3.13 + * 3.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 3.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 3.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 3.17 + * version 2 for more details (a copy is included in the LICENSE file that 3.18 + * accompanied this code). 3.19 + * 3.20 + * You should have received a copy of the GNU General Public License version 3.21 + * 2 along with this work; if not, write to the Free Software Foundation, 3.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 3.23 + * 3.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 3.25 + * or visit www.oracle.com if you need additional information or have any 3.26 + * questions. 3.27 + */ 3.28 + 3.29 +/* 3.30 + * @test 3.31 + * @bug 8009640 3.32 + * @summary -profile <compact> does not work when -bootclasspath specified 3.33 + * @library /tools/javac/lib 3.34 + * @build ToolBox 3.35 + * @run main CheckRejectProfileBCPOptionsIfUsedTogetherTest 3.36 + */ 3.37 + 3.38 +import com.sun.tools.javac.util.Assert; 3.39 +import java.util.ArrayList; 3.40 +import java.util.List; 3.41 + 3.42 +public class CheckRejectProfileBCPOptionsIfUsedTogetherTest { 3.43 + 3.44 + private static final String TestSrc = 3.45 + "public class Test {\n" + 3.46 + " javax.swing.JButton b;\n" + 3.47 + "}"; 3.48 + 3.49 + public static void main(String args[]) throws Exception { 3.50 + List<String> errOutput = new ArrayList<>(); 3.51 + String testJDK = ToolBox.jdkUnderTest; 3.52 + ToolBox.createJavaFileFromSource(TestSrc); 3.53 + 3.54 + ToolBox.AnyToolArgs javacParams = 3.55 + new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL) 3.56 + .appendArgs(ToolBox.javacBinary) 3.57 + .appendArgs(ToolBox.testToolVMOpts) 3.58 + .appendArgs("-profile", "compact1", "-bootclasspath", 3.59 + testJDK + "/jre/lib/rt.jar", "Test.java") 3.60 + .setErrOutput(errOutput); 3.61 + 3.62 + ToolBox.executeCommand(javacParams); 3.63 + 3.64 + Assert.check(errOutput.get(0).startsWith( 3.65 + "javac: profile and bootclasspath options cannot be used together"), 3.66 + "Incorrect javac error output"); 3.67 + } 3.68 + 3.69 +}