Mon, 29 Nov 2010 14:15:36 -0800
6900037: javac should warn if earlier -source is used and bootclasspath not set
Reviewed-by: darcy
1.1 --- a/src/share/classes/com/sun/tools/javac/code/Lint.java Mon Nov 29 10:09:48 2010 -0800 1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Lint.java Mon Nov 29 14:15:36 2010 -0800 1.3 @@ -165,6 +165,11 @@ 1.4 FINALLY("finally"), 1.5 1.6 /** 1.7 + * Warn about issues relating to use of command line options 1.8 + */ 1.9 + OPTIONS("options"), 1.10 + 1.11 + /** 1.12 * Warn about issues regarding method overrides. 1.13 */ 1.14 OVERRIDES("overrides"), 1.15 @@ -182,39 +187,39 @@ 1.16 PROCESSING("processing"), 1.17 1.18 /** 1.19 + * Warn about unchecked operations on raw types. 1.20 + */ 1.21 + RAW("rawtypes"), 1.22 + 1.23 + /** 1.24 * Warn about Serializable classes that do not provide a serial version ID. 1.25 */ 1.26 SERIAL("serial"), 1.27 1.28 /** 1.29 + * Warn about issues relating to use of statics 1.30 + */ 1.31 + STATIC("static"), 1.32 + 1.33 + /** 1.34 + * Warn about proprietary API that may be removed in a future release. 1.35 + */ 1.36 + SUNAPI("sunapi", true), 1.37 + 1.38 + /** 1.39 + * Warn about issues relating to use of try blocks (i.e. try-with-resources) 1.40 + */ 1.41 + TRY("try"), 1.42 + 1.43 + /** 1.44 * Warn about unchecked operations on raw types. 1.45 */ 1.46 UNCHECKED("unchecked"), 1.47 1.48 /** 1.49 - * Warn about unchecked operations on raw types. 1.50 - */ 1.51 - RAW("rawtypes"), 1.52 - 1.53 - /** 1.54 - * Warn about proprietary API that may be removed in a future release. 1.55 - */ 1.56 - SUNAPI("sunapi", true), 1.57 - 1.58 - /** 1.59 - * Warn about issues relating to use of statics 1.60 - */ 1.61 - STATIC("static"), 1.62 - 1.63 - /** 1.64 * Warn about potentially unsafe vararg methods 1.65 */ 1.66 - VARARGS("varargs"), 1.67 - 1.68 - /** 1.69 - * Warn about issues relating to use of try blocks (i.e. try-with-resources) 1.70 - */ 1.71 - TRY("try"); 1.72 + VARARGS("varargs"); 1.73 1.74 LintCategory(String option) { 1.75 this(option, false);
2.1 --- a/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java Mon Nov 29 10:09:48 2010 -0800 2.2 +++ b/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java Mon Nov 29 14:15:36 2010 -0800 2.3 @@ -174,6 +174,11 @@ 2.4 } 2.5 } 2.6 2.7 + @Override 2.8 + public boolean isDefaultBootClassPath() { 2.9 + return paths.isDefaultBootClassPath(); 2.10 + } 2.11 + 2.12 public JavaFileObject getFileForInput(String name) { 2.13 return getRegularFile(new File(name)); 2.14 }
3.1 --- a/src/share/classes/com/sun/tools/javac/file/Paths.java Mon Nov 29 10:09:48 2010 -0800 3.2 +++ b/src/share/classes/com/sun/tools/javac/file/Paths.java Mon Nov 29 14:15:36 2010 -0800 3.3 @@ -114,6 +114,11 @@ 3.4 */ 3.5 private File bootClassPathRtJar = null; 3.6 3.7 + /** 3.8 + * Is bootclasspath the default? 3.9 + */ 3.10 + private boolean isDefaultBootClassPath; 3.11 + 3.12 Path getPathForLocation(Location location) { 3.13 Path path = pathsForLocation.get(location); 3.14 if (path == null) 3.15 @@ -129,7 +134,7 @@ 3.16 if (location == CLASS_PATH) 3.17 p = computeUserClassPath(); 3.18 else if (location == PLATFORM_CLASS_PATH) 3.19 - p = computeBootClassPath(); 3.20 + p = computeBootClassPath(); // sets isDefaultBootClassPath 3.21 else if (location == ANNOTATION_PROCESSOR_PATH) 3.22 p = computeAnnotationProcessorPath(); 3.23 else if (location == SOURCE_PATH) 3.24 @@ -138,6 +143,8 @@ 3.25 // no defaults for other paths 3.26 p = null; 3.27 } else { 3.28 + if (location == PLATFORM_CLASS_PATH) 3.29 + isDefaultBootClassPath = false; 3.30 p = new Path(); 3.31 for (File f: path) 3.32 p.addFile(f, warn); // TODO: is use of warn appropriate? 3.33 @@ -145,6 +152,11 @@ 3.34 pathsForLocation.put(location, p); 3.35 } 3.36 3.37 + boolean isDefaultBootClassPath() { 3.38 + lazy(); 3.39 + return isDefaultBootClassPath; 3.40 + } 3.41 + 3.42 protected void lazy() { 3.43 if (!inited) { 3.44 warn = lint.isEnabled(Lint.LintCategory.PATH); 3.45 @@ -262,9 +274,10 @@ 3.46 } 3.47 3.48 public Path addFiles(String files, boolean warn) { 3.49 - if (files != null) 3.50 + if (files != null) { 3.51 for (File file : getPathEntries(files, emptyPathDefault)) 3.52 addFile(file, warn); 3.53 + } 3.54 return this; 3.55 } 3.56 3.57 @@ -334,18 +347,23 @@ 3.58 3.59 private Path computeBootClassPath() { 3.60 bootClassPathRtJar = null; 3.61 - String optionValue; 3.62 Path path = new Path(); 3.63 3.64 - path.addFiles(options.get(XBOOTCLASSPATH_PREPEND)); 3.65 + String bootclasspathOpt = options.get(BOOTCLASSPATH); 3.66 + String endorseddirsOpt = options.get(ENDORSEDDIRS); 3.67 + String extdirsOpt = options.get(EXTDIRS); 3.68 + String xbootclasspathPrependOpt = options.get(XBOOTCLASSPATH_PREPEND); 3.69 + String xbootclasspathAppendOpt = options.get(XBOOTCLASSPATH_APPEND); 3.70 3.71 - if ((optionValue = options.get(ENDORSEDDIRS)) != null) 3.72 - path.addDirectories(optionValue); 3.73 + path.addFiles(xbootclasspathPrependOpt); 3.74 + 3.75 + if (endorseddirsOpt != null) 3.76 + path.addDirectories(endorseddirsOpt); 3.77 else 3.78 path.addDirectories(System.getProperty("java.endorsed.dirs"), false); 3.79 3.80 - if ((optionValue = options.get(BOOTCLASSPATH)) != null) { 3.81 - path.addFiles(optionValue); 3.82 + if (bootclasspathOpt != null) { 3.83 + path.addFiles(bootclasspathOpt); 3.84 } else { 3.85 // Standard system classes for this compiler's release. 3.86 String files = System.getProperty("sun.boot.class.path"); 3.87 @@ -357,16 +375,21 @@ 3.88 } 3.89 } 3.90 3.91 - path.addFiles(options.get(XBOOTCLASSPATH_APPEND)); 3.92 + path.addFiles(xbootclasspathAppendOpt); 3.93 3.94 // Strictly speaking, standard extensions are not bootstrap 3.95 // classes, but we treat them identically, so we'll pretend 3.96 // that they are. 3.97 - if ((optionValue = options.get(EXTDIRS)) != null) 3.98 - path.addDirectories(optionValue); 3.99 + if (extdirsOpt != null) 3.100 + path.addDirectories(extdirsOpt); 3.101 else 3.102 path.addDirectories(System.getProperty("java.ext.dirs"), false); 3.103 3.104 + isDefaultBootClassPath = 3.105 + (xbootclasspathPrependOpt == null) && 3.106 + (bootclasspathOpt == null) && 3.107 + (xbootclasspathAppendOpt == null); 3.108 + 3.109 return path; 3.110 } 3.111
4.1 --- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Mon Nov 29 10:09:48 2010 -0800 4.2 +++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Mon Nov 29 14:15:36 2010 -0800 4.3 @@ -51,6 +51,7 @@ 4.4 import com.sun.tools.javac.file.JavacFileManager; 4.5 import com.sun.tools.javac.util.*; 4.6 import com.sun.tools.javac.code.*; 4.7 +import com.sun.tools.javac.code.Lint.LintCategory; 4.8 import com.sun.tools.javac.code.Symbol.*; 4.9 import com.sun.tools.javac.tree.*; 4.10 import com.sun.tools.javac.tree.JCTree.*; 4.11 @@ -370,6 +371,15 @@ 4.12 processPcks = options.isSet("process.packages"); 4.13 werror = options.isSet(WERROR); 4.14 4.15 + if (source.compareTo(Source.DEFAULT) < 0) { 4.16 + if (options.isUnset(XLINT_CUSTOM, "-" + LintCategory.OPTIONS.option)) { 4.17 + if (fileManager instanceof BaseFileManager) { 4.18 + if (((BaseFileManager) fileManager).isDefaultBootClassPath()) 4.19 + log.warning(LintCategory.OPTIONS, "source.no.bootclasspath", source.name); 4.20 + } 4.21 + } 4.22 + } 4.23 + 4.24 verboseCompilePolicy = options.isSet("verboseCompilePolicy"); 4.25 4.26 if (attrParseOnly) 4.27 @@ -783,6 +793,7 @@ 4.28 hasBeenUsed = true; 4.29 4.30 start_msec = now(); 4.31 + 4.32 try { 4.33 initProcessAnnotations(processors); 4.34 4.35 @@ -797,7 +808,7 @@ 4.36 elapsed_msec = delegateCompiler.elapsed_msec; 4.37 } catch (Abort ex) { 4.38 if (devVerbose) 4.39 - ex.printStackTrace(); 4.40 + ex.printStackTrace(System.err); 4.41 } finally { 4.42 if (procEnvImpl != null) 4.43 procEnvImpl.close(); 4.44 @@ -841,7 +852,7 @@ 4.45 } 4.46 } catch (Abort ex) { 4.47 if (devVerbose) 4.48 - ex.printStackTrace(); 4.49 + ex.printStackTrace(System.err); 4.50 } 4.51 4.52 if (verbose) {
5.1 --- a/src/share/classes/com/sun/tools/javac/main/Main.java Mon Nov 29 10:09:48 2010 -0800 5.2 +++ b/src/share/classes/com/sun/tools/javac/main/Main.java Mon Nov 29 14:15:36 2010 -0800 5.3 @@ -420,7 +420,7 @@ 5.4 processors); 5.5 5.6 if (log.expectDiagKeys != null) { 5.7 - if (log.expectDiagKeys.size() == 0) { 5.8 + if (log.expectDiagKeys.isEmpty()) { 5.9 Log.printLines(log.noticeWriter, "all expected diagnostics found"); 5.10 return EXIT_OK; 5.11 } else { 5.12 @@ -506,7 +506,7 @@ 5.13 void apMessage(AnnotationProcessingError ex) { 5.14 Log.printLines(out, 5.15 getLocalizedString("msg.proc.annotation.uncaught.exception")); 5.16 - ex.getCause().printStackTrace(); 5.17 + ex.getCause().printStackTrace(out); 5.18 } 5.19 5.20 /** Display the location and checksum of a class. */ 5.21 @@ -563,6 +563,7 @@ 5.22 public static void useRawMessages(boolean enable) { 5.23 if (enable) { 5.24 messages = new JavacMessages(javacBundleName) { 5.25 + @Override 5.26 public String getLocalizedString(String key, Object... args) { 5.27 return key; 5.28 }
6.1 --- a/src/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java Mon Nov 29 10:09:48 2010 -0800 6.2 +++ b/src/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java Mon Nov 29 14:15:36 2010 -0800 6.3 @@ -172,6 +172,11 @@ 6.4 return getClassLoader(lb.toArray(new URL[lb.size()])); 6.5 } 6.6 6.7 + @Override 6.8 + public boolean isDefaultBootClassPath() { 6.9 + return searchPaths.isDefaultBootClassPath(); 6.10 + } 6.11 + 6.12 // <editor-fold defaultstate="collapsed" desc="Location handling"> 6.13 6.14 public boolean hasLocation(Location location) {
7.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties Mon Nov 29 10:09:48 2010 -0800 7.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties Mon Nov 29 14:15:36 2010 -0800 7.3 @@ -764,6 +764,9 @@ 7.4 compiler.warn.static.not.qualified.by.type=\ 7.5 static {0} should be qualified by type name, {1}, instead of by an expression 7.6 7.7 +compiler.warn.source.no.bootclasspath=\ 7.8 + bootstrap class path not set in conjunction with -source {0} 7.9 + 7.10 # Warnings related to annotation processing 7.11 compiler.warn.proc.package.does.not.exist=\ 7.12 package {0} does not exist
8.1 --- a/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java Mon Nov 29 10:09:48 2010 -0800 8.2 +++ b/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java Mon Nov 29 14:15:36 2010 -0800 8.3 @@ -59,7 +59,7 @@ 8.4 * There are no references here to file-system specific objects such as 8.5 * java.io.File or java.nio.file.Path. 8.6 */ 8.7 -public class BaseFileManager { 8.8 +public abstract class BaseFileManager { 8.9 protected BaseFileManager(Charset charset) { 8.10 this.charset = charset; 8.11 byteBufferCache = new ByteBufferCache(); 8.12 @@ -163,6 +163,9 @@ 8.13 } 8.14 return -1; 8.15 } 8.16 + 8.17 + public abstract boolean isDefaultBootClassPath(); 8.18 + 8.19 // </editor-fold> 8.20 8.21 // <editor-fold defaultstate="collapsed" desc="Encoding">
9.1 --- a/test/tools/javac/6341866/T6341866.java Mon Nov 29 10:09:48 2010 -0800 9.2 +++ b/test/tools/javac/6341866/T6341866.java Mon Nov 29 14:15:36 2010 -0800 9.3 @@ -97,7 +97,7 @@ 9.4 processorServices.delete(); 9.5 9.6 List<String> opts = new ArrayList<String>(); 9.7 - opts.addAll(Arrays.asList("-d", ".", "-sourcepath", testSrc, "-classpath", testClasses, "-source", "1.6")); 9.8 + opts.addAll(Arrays.asList("-d", ".", "-sourcepath", testSrc, "-classpath", testClasses, "-source", "1.6", "-Xlint:-options")); 9.9 if (implicitType.opt != null) 9.10 opts.add(implicitType.opt); 9.11
10.1 --- a/test/tools/javac/ClassFileModifiers/MemberModifiers.java Mon Nov 29 10:09:48 2010 -0800 10.2 +++ b/test/tools/javac/ClassFileModifiers/MemberModifiers.java Mon Nov 29 14:15:36 2010 -0800 10.3 @@ -26,7 +26,7 @@ 10.4 * @bug 4249112 4785453 10.5 * @summary Verify that implicit member modifiers are set correctly. 10.6 * 10.7 - * @compile/ref=MemberModifiers.out -source 1.4 -target 1.4.2 -XDdumpmodifiers=cfm MemberModifiers.java 10.8 + * @compile/ref=MemberModifiers.out -source 1.4 -target 1.4.2 -Xlint:-options -XDdumpmodifiers=cfm MemberModifiers.java 10.9 */ 10.10 10.11 // Currently, we check only that members of final classes are not final.
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 11.2 +++ b/test/tools/javac/T6900037.java Mon Nov 29 14:15:36 2010 -0800 11.3 @@ -0,0 +1,34 @@ 11.4 +/* 11.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 11.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 11.7 + * 11.8 + * This code is free software; you can redistribute it and/or modify it 11.9 + * under the terms of the GNU General Public License version 2 only, as 11.10 + * published by the Free Software Foundation. 11.11 + * 11.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 11.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11.15 + * version 2 for more details (a copy is included in the LICENSE file that 11.16 + * accompanied this code). 11.17 + * 11.18 + * You should have received a copy of the GNU General Public License version 11.19 + * 2 along with this work; if not, write to the Free Software Foundation, 11.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 11.21 + * 11.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 11.23 + * or visit www.oracle.com if you need additional information or have any 11.24 + * questions. 11.25 + */ 11.26 + 11.27 +/* 11.28 + * @test 11.29 + * @bug 6900037 11.30 + * @summary javac should warn if earlier -source is used and bootclasspath not set 11.31 + * @compile T6900037.java 11.32 + * @compile -source 1.6 T6900037.java 11.33 + * @compile/fail/ref=T6900037.out -XDrawDiagnostics -Werror -source 1.6 T6900037.java 11.34 + * @compile -Werror -source 1.6 -Xlint:-options T6900037.java 11.35 + */ 11.36 + 11.37 +class T6900037 { }
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 12.2 +++ b/test/tools/javac/T6900037.out Mon Nov 29 14:15:36 2010 -0800 12.3 @@ -0,0 +1,4 @@ 12.4 +- compiler.warn.source.no.bootclasspath: 1.6 12.5 +- compiler.err.warnings.and.werror 12.6 +1 error 12.7 +1 warning
13.1 --- a/test/tools/javac/TryWithResources/PlainTry.java Mon Nov 29 10:09:48 2010 -0800 13.2 +++ b/test/tools/javac/TryWithResources/PlainTry.java Mon Nov 29 14:15:36 2010 -0800 13.3 @@ -3,8 +3,8 @@ 13.4 * @bug 6911256 6964740 13.5 * @author Joseph D. Darcy 13.6 * @summary Test error messages for an unadorned try 13.7 - * @compile/fail/ref=PlainTry6.out -XDrawDiagnostics -source 6 PlainTry.java 13.8 - * @compile/fail/ref=PlainTry.out -XDrawDiagnostics PlainTry.java 13.9 + * @compile/fail/ref=PlainTry6.out -XDrawDiagnostics -source 6 -Xlint:-options PlainTry.java 13.10 + * @compile/fail/ref=PlainTry.out -XDrawDiagnostics PlainTry.java 13.11 */ 13.12 public class PlainTry { 13.13 public static void main(String... args) {
14.1 --- a/test/tools/javac/annotations/neg/Dep.java Mon Nov 29 10:09:48 2010 -0800 14.2 +++ b/test/tools/javac/annotations/neg/Dep.java Mon Nov 29 14:15:36 2010 -0800 14.3 @@ -27,9 +27,9 @@ 14.4 * @summary Please add annotation <at>Deprecated to supplant the javadoc tag 14.5 * @author gafter 14.6 * 14.7 - * @compile -source 1.4 -Xlint:dep-ann -Werror Dep.java 14.8 - * @compile/fail -Xlint:dep-ann -Werror Dep.java 14.9 - * @compile -Xlint:dep-ann Dep.java 14.10 + * @compile -source 1.4 -Xlint:-options -Xlint:dep-ann -Werror Dep.java 14.11 + * @compile/fail -Xlint:dep-ann -Werror Dep.java 14.12 + * @compile -Xlint:dep-ann Dep.java 14.13 */ 14.14 14.15 /** @deprecated */
15.1 --- a/test/tools/javac/diags/examples/AnnotationsNotSupported.java Mon Nov 29 10:09:48 2010 -0800 15.2 +++ b/test/tools/javac/diags/examples/AnnotationsNotSupported.java Mon Nov 29 14:15:36 2010 -0800 15.3 @@ -22,7 +22,7 @@ 15.4 */ 15.5 15.6 // key: compiler.err.annotations.not.supported.in.source 15.7 -// options: -source 1.4 15.8 +// options: -source 1.4 -Xlint:-options 15.9 15.10 @Deprecated 15.11 class AnnotationsNotSupported { }
16.1 --- a/test/tools/javac/diags/examples/AssertAsIdentifier.java Mon Nov 29 10:09:48 2010 -0800 16.2 +++ b/test/tools/javac/diags/examples/AssertAsIdentifier.java Mon Nov 29 14:15:36 2010 -0800 16.3 @@ -22,7 +22,7 @@ 16.4 */ 16.5 16.6 // key: compiler.warn.assert.as.identifier 16.7 -// options: -source 1.3 16.8 +// options: -source 1.3 -Xlint:-options 16.9 16.10 class AssertAsIdentifier { 16.11 int assert;
17.1 --- a/test/tools/javac/diags/examples/DiamondNotSupported.java Mon Nov 29 10:09:48 2010 -0800 17.2 +++ b/test/tools/javac/diags/examples/DiamondNotSupported.java Mon Nov 29 14:15:36 2010 -0800 17.3 @@ -22,7 +22,7 @@ 17.4 */ 17.5 17.6 // key: compiler.err.diamond.not.supported.in.source 17.7 -// options: -source 6 17.8 +// options: -source 6 -Xlint:-options 17.9 17.10 import java.util.*; 17.11
18.1 --- a/test/tools/javac/diags/examples/EnumAsIdentifier.java Mon Nov 29 10:09:48 2010 -0800 18.2 +++ b/test/tools/javac/diags/examples/EnumAsIdentifier.java Mon Nov 29 14:15:36 2010 -0800 18.3 @@ -22,7 +22,7 @@ 18.4 */ 18.5 18.6 // key: compiler.warn.enum.as.identifier 18.7 -// options: -source 1.3 18.8 +// options: -source 1.3 -Xlint:-options 18.9 18.10 class EnumAsIdentifier { 18.11 int enum;
19.1 --- a/test/tools/javac/diags/examples/EnumsNotSupported.java Mon Nov 29 10:09:48 2010 -0800 19.2 +++ b/test/tools/javac/diags/examples/EnumsNotSupported.java Mon Nov 29 14:15:36 2010 -0800 19.3 @@ -22,6 +22,6 @@ 19.4 */ 19.5 19.6 // key: compiler.err.enums.not.supported.in.source 19.7 -// options: -source 1.4 19.8 +// options: -source 1.4 -Xlint:-options 19.9 19.10 enum EnumsNotSupported { A, B, C }
20.1 --- a/test/tools/javac/diags/examples/Expected2.java Mon Nov 29 10:09:48 2010 -0800 20.2 +++ b/test/tools/javac/diags/examples/Expected2.java Mon Nov 29 14:15:36 2010 -0800 20.3 @@ -22,6 +22,6 @@ 20.4 */ 20.5 20.6 // key: compiler.err.expected2 20.7 -// options: -source 1.4 20.8 +// options: -source 1.4 -Xlint:-options 20.9 20.10 int Expected2;
21.1 --- a/test/tools/javac/diags/examples/ForeachNotSupported.java Mon Nov 29 10:09:48 2010 -0800 21.2 +++ b/test/tools/javac/diags/examples/ForeachNotSupported.java Mon Nov 29 14:15:36 2010 -0800 21.3 @@ -22,7 +22,7 @@ 21.4 */ 21.5 21.6 // key: compiler.err.foreach.not.supported.in.source 21.7 -// options: -source 1.4 21.8 +// options: -source 1.4 -Xlint:-options 21.9 21.10 class ForeachNotSupported { 21.11 void m(String[] args) {
22.1 --- a/test/tools/javac/diags/examples/GenericsNotSupported.java Mon Nov 29 10:09:48 2010 -0800 22.2 +++ b/test/tools/javac/diags/examples/GenericsNotSupported.java Mon Nov 29 14:15:36 2010 -0800 22.3 @@ -22,6 +22,6 @@ 22.4 */ 22.5 22.6 // key: compiler.err.generics.not.supported.in.source 22.7 -// options: -source 1.4 22.8 +// options: -source 1.4 -Xlint:-options 22.9 22.10 class GenericsNotSupported<T> { }
23.1 --- a/test/tools/javac/diags/examples/MulticatchNotSupported.java Mon Nov 29 10:09:48 2010 -0800 23.2 +++ b/test/tools/javac/diags/examples/MulticatchNotSupported.java Mon Nov 29 14:15:36 2010 -0800 23.3 @@ -22,7 +22,7 @@ 23.4 */ 23.5 23.6 // key: compiler.err.multicatch.not.supported.in.source 23.7 -// options: -source 1.6 23.8 +// options: -source 1.6 -Xlint:-options 23.9 23.10 class MulticatchNotSupported { 23.11 class E1 extends Exception { }
24.1 --- a/test/tools/javac/diags/examples/NeitherConditionalSubtype.java Mon Nov 29 10:09:48 2010 -0800 24.2 +++ b/test/tools/javac/diags/examples/NeitherConditionalSubtype.java Mon Nov 29 14:15:36 2010 -0800 24.3 @@ -22,7 +22,7 @@ 24.4 */ 24.5 24.6 // key: compiler.err.neither.conditional.subtype 24.7 -// options: -source 1.4 24.8 +// options: -source 1.4 -Xlint:-options 24.9 24.10 class X { 24.11 Object m(boolean b) {
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 25.2 +++ b/test/tools/javac/diags/examples/SourceNoBootclasspath.java Mon Nov 29 14:15:36 2010 -0800 25.3 @@ -0,0 +1,27 @@ 25.4 +/* 25.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 25.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 25.7 + * 25.8 + * This code is free software; you can redistribute it and/or modify it 25.9 + * under the terms of the GNU General Public License version 2 only, as 25.10 + * published by the Free Software Foundation. 25.11 + * 25.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 25.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 25.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 25.15 + * version 2 for more details (a copy is included in the LICENSE file that 25.16 + * accompanied this code). 25.17 + * 25.18 + * You should have received a copy of the GNU General Public License version 25.19 + * 2 along with this work; if not, write to the Free Software Foundation, 25.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 25.21 + * 25.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 25.23 + * or visit www.oracle.com if you need additional information or have any 25.24 + * questions. 25.25 + */ 25.26 + 25.27 +// key: compiler.warn.source.no.bootclasspath 25.28 +// options: -source 6 25.29 + 25.30 +class SourceNoBootclasspath { }
26.1 --- a/test/tools/javac/diags/examples/StaticImportNotSupported.java Mon Nov 29 10:09:48 2010 -0800 26.2 +++ b/test/tools/javac/diags/examples/StaticImportNotSupported.java Mon Nov 29 14:15:36 2010 -0800 26.3 @@ -22,7 +22,7 @@ 26.4 */ 26.5 26.6 // key: compiler.err.static.import.not.supported.in.source 26.7 -// options: -source 1.4 26.8 +// options: -source 1.4 -Xlint:-options 26.9 26.10 import static java.util.regex.Pattern.*; 26.11
27.1 --- a/test/tools/javac/diags/examples/StringSwitchNotSupported.java Mon Nov 29 10:09:48 2010 -0800 27.2 +++ b/test/tools/javac/diags/examples/StringSwitchNotSupported.java Mon Nov 29 14:15:36 2010 -0800 27.3 @@ -22,7 +22,7 @@ 27.4 */ 27.5 27.6 // key: compiler.err.string.switch.not.supported.in.source 27.7 -// options: -source 6 27.8 +// options: -source 6 -Xlint:-options 27.9 27.10 class StringSwitchNotSupported { 27.11 int m(String s) {
28.1 --- a/test/tools/javac/diags/examples/TryResourceNotSupported.java Mon Nov 29 10:09:48 2010 -0800 28.2 +++ b/test/tools/javac/diags/examples/TryResourceNotSupported.java Mon Nov 29 14:15:36 2010 -0800 28.3 @@ -22,7 +22,7 @@ 28.4 */ 28.5 28.6 // key: compiler.err.try.with.resources.not.supported.in.source 28.7 -// options: -source 1.6 28.8 +// options: -source 1.6 -Xlint:-options 28.9 28.10 import java.io.*; 28.11
29.1 --- a/test/tools/javac/diags/examples/TryWithoutCatchOrFinally.java Mon Nov 29 10:09:48 2010 -0800 29.2 +++ b/test/tools/javac/diags/examples/TryWithoutCatchOrFinally.java Mon Nov 29 14:15:36 2010 -0800 29.3 @@ -22,7 +22,7 @@ 29.4 */ 29.5 29.6 // key: compiler.err.try.without.catch.or.finally 29.7 -// options: -source 1.6 29.8 +// options: -source 1.6 -Xlint:-options 29.9 29.10 class TryWithoutCatchOrFinally { 29.11 void m() {
30.1 --- a/test/tools/javac/diags/examples/UnsupportedBinaryLiteral.java Mon Nov 29 10:09:48 2010 -0800 30.2 +++ b/test/tools/javac/diags/examples/UnsupportedBinaryLiteral.java Mon Nov 29 14:15:36 2010 -0800 30.3 @@ -22,7 +22,7 @@ 30.4 */ 30.5 30.6 // key: compiler.err.unsupported.binary.lit 30.7 -// options: -source 6 30.8 +// options: -source 6 -Xlint:-options 30.9 30.10 class UnsupportedBinaryLiteral { 30.11 int i = 0b01000010;
31.1 --- a/test/tools/javac/diags/examples/UnsupportedFpLit.java Mon Nov 29 10:09:48 2010 -0800 31.2 +++ b/test/tools/javac/diags/examples/UnsupportedFpLit.java Mon Nov 29 14:15:36 2010 -0800 31.3 @@ -22,7 +22,7 @@ 31.4 */ 31.5 31.6 // key: compiler.err.unsupported.fp.lit 31.7 -// options: -source 1.4 31.8 +// options: -source 1.4 -Xlint:-options 31.9 31.10 class UnsupportedFpLit { 31.11 float f = 0xCafe.BabeP1;
32.1 --- a/test/tools/javac/diags/examples/UnsupportedUnderscoreLiteral.java Mon Nov 29 10:09:48 2010 -0800 32.2 +++ b/test/tools/javac/diags/examples/UnsupportedUnderscoreLiteral.java Mon Nov 29 14:15:36 2010 -0800 32.3 @@ -22,7 +22,7 @@ 32.4 */ 32.5 32.6 // key: compiler.err.unsupported.underscore.lit 32.7 -// options: -source 6 32.8 +// options: -source 6 -Xlint:-options 32.9 32.10 class UnsupportedUnderscoreLiteral { 32.11 int i = 123_456_789;
33.1 --- a/test/tools/javac/diags/examples/VarargsNotSupported.java Mon Nov 29 10:09:48 2010 -0800 33.2 +++ b/test/tools/javac/diags/examples/VarargsNotSupported.java Mon Nov 29 14:15:36 2010 -0800 33.3 @@ -22,7 +22,7 @@ 33.4 */ 33.5 33.6 // key: compiler.err.varargs.not.supported.in.source 33.7 -// options: -source 1.4 33.8 +// options: -source 1.4 -Xlint:-options 33.9 33.10 class VarargsNotSupported { 33.11 void m(String... args) { }
34.1 --- a/test/tools/javac/enum/6384542/T6384542.java Mon Nov 29 10:09:48 2010 -0800 34.2 +++ b/test/tools/javac/enum/6384542/T6384542.java Mon Nov 29 14:15:36 2010 -0800 34.3 @@ -3,8 +3,8 @@ 34.4 * @bug 6384542 34.5 * @summary crash: test/tools/javac/versions/check.sh 34.6 * @author Peter von der Ah\u00e9 34.7 - * @compile/fail -source 1.4 T6384542.java 34.8 - * @compile/fail/ref=T6384542.out -source 1.4 -XDrawDiagnostics T6384542.java 34.9 + * @compile/fail -source 1.4 -Xlint:-options T6384542.java 34.10 + * @compile/fail/ref=T6384542.out -source 1.4 -Xlint:-options -XDrawDiagnostics T6384542.java 34.11 */ 34.12 34.13 import static java.lang.Math.sin;
35.1 --- a/test/tools/javac/enum/6384542/T6384542a.java Mon Nov 29 10:09:48 2010 -0800 35.2 +++ b/test/tools/javac/enum/6384542/T6384542a.java Mon Nov 29 14:15:36 2010 -0800 35.3 @@ -5,8 +5,8 @@ 35.4 * @author Peter von der Ah\u00e9 35.5 * @compile/fail -source 5 T6384542a.java 35.6 * @compile -source 1.4 T6384542a.java 35.7 - * @compile/fail/ref=T6384542a_5.out -source 5 -XDrawDiagnostics T6384542a.java 35.8 - * @compile/ref=T6384542a_1_4.out -source 1.4 -XDrawDiagnostics T6384542a.java 35.9 + * @compile/fail/ref=T6384542a_5.out -source 5 -Xlint:-options -XDrawDiagnostics T6384542a.java 35.10 + * @compile/ref=T6384542a_1_4.out -source 1.4 -Xlint:-options -XDrawDiagnostics T6384542a.java 35.11 */ 35.12 35.13 public class T6384542a {
36.1 --- a/test/tools/javac/literals/BadBinaryLiterals.java Mon Nov 29 10:09:48 2010 -0800 36.2 +++ b/test/tools/javac/literals/BadBinaryLiterals.java Mon Nov 29 14:15:36 2010 -0800 36.3 @@ -2,7 +2,7 @@ 36.4 * @test /nodynamiccopyright/ 36.5 * @bug 6860965 36.6 * @summary Project Coin: binary literals 36.7 - * @compile/fail/ref=BadBinaryLiterals.6.out -XDrawDiagnostics -source 6 BadBinaryLiterals.java 36.8 + * @compile/fail/ref=BadBinaryLiterals.6.out -XDrawDiagnostics -source 6 -Xlint:-options BadBinaryLiterals.java 36.9 * @compile/fail/ref=BadBinaryLiterals.7.out -XDrawDiagnostics BadBinaryLiterals.java 36.10 */ 36.11
37.1 --- a/test/tools/javac/literals/BadUnderscoreLiterals.java Mon Nov 29 10:09:48 2010 -0800 37.2 +++ b/test/tools/javac/literals/BadUnderscoreLiterals.java Mon Nov 29 14:15:36 2010 -0800 37.3 @@ -7,7 +7,7 @@ 37.4 * @compile/fail/ref=BadUnderscoreLiterals.7.out -XDrawDiagnostics BadUnderscoreLiterals.java 37.5 * 37.6 * @compile/fail -source 6 BadUnderscoreLiterals.java 37.7 - * @compile/fail/ref=BadUnderscoreLiterals.6.out -XDrawDiagnostics -source 6 BadUnderscoreLiterals.java 37.8 + * @compile/fail/ref=BadUnderscoreLiterals.6.out -XDrawDiagnostics -source 6 -Xlint:-options BadUnderscoreLiterals.java 37.9 */ 37.10 37.11 public class BadUnderscoreLiterals {
38.1 --- a/test/tools/javac/processing/warnings/TestSourceVersionWarnings.java Mon Nov 29 10:09:48 2010 -0800 38.2 +++ b/test/tools/javac/processing/warnings/TestSourceVersionWarnings.java Mon Nov 29 14:15:36 2010 -0800 38.3 @@ -27,15 +27,15 @@ 38.4 * @summary Test that warnings about source versions are output as expected. 38.5 * @author Joseph D. Darcy 38.6 * @compile TestSourceVersionWarnings.java 38.7 - * @compile/ref=gold_0.out -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -source 1.5 HelloWorld.java 38.8 - * @compile/ref=gold_sv_warn_0_2.out -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_0 -source 1.2 HelloWorld.java 38.9 - * @compile/ref=gold_sv_none.out -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_2 -source 1.2 HelloWorld.java 38.10 - * @compile/ref=gold_sv_warn_2_3.out -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_2 -source 1.3 HelloWorld.java 38.11 - * @compile/ref=gold_sv_none.out -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_5 -source 1.5 HelloWorld.java 38.12 - * @compile/ref=gold_sv_warn_5_6.out -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_5 -source 1.6 HelloWorld.java 38.13 - * @compile/ref=gold_sv_none.out -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_6 -source 1.6 HelloWorld.java 38.14 - * @compile/ref=gold_unsp_warn.out -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_6 -source 1.6 -Aunsupported HelloWorld.java 38.15 - * @compile/ref=gold_sv_none.out -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_7 -source 1.7 HelloWorld.java 38.16 + * @compile/ref=gold_0.out -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -source 1.5 -Xlint:-options HelloWorld.java 38.17 + * @compile/ref=gold_sv_warn_0_2.out -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_0 -source 1.2 -Xlint:-options HelloWorld.java 38.18 + * @compile/ref=gold_sv_none.out -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_2 -source 1.2 -Xlint:-options HelloWorld.java 38.19 + * @compile/ref=gold_sv_warn_2_3.out -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_2 -source 1.3 -Xlint:-options HelloWorld.java 38.20 + * @compile/ref=gold_sv_none.out -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_5 -source 1.5 -Xlint:-options HelloWorld.java 38.21 + * @compile/ref=gold_sv_warn_5_6.out -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_5 -source 1.6 -Xlint:-options HelloWorld.java 38.22 + * @compile/ref=gold_sv_none.out -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_6 -source 1.6 -Xlint:-options HelloWorld.java 38.23 + * @compile/ref=gold_unsp_warn.out -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_6 -source 1.6 -Xlint:-options -Aunsupported HelloWorld.java 38.24 + * @compile/ref=gold_sv_none.out -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_7 -source 1.7 HelloWorld.java 38.25 */ 38.26 38.27 import java.util.Set;
39.1 --- a/test/tools/javac/varargs/warning/Warn1.java Mon Nov 29 10:09:48 2010 -0800 39.2 +++ b/test/tools/javac/varargs/warning/Warn1.java Mon Nov 29 14:15:36 2010 -0800 39.3 @@ -27,7 +27,7 @@ 39.4 * @summary fixed-arity warning given too often 39.5 * @author gafter 39.6 * 39.7 - * @compile -Werror -source 1.4 Warn1.java 39.8 + * @compile -Werror -source 1.4 -Xlint:-options Warn1.java 39.9 */ 39.10 39.11 package varargs.warning.warn1;