changeset 756:c44234f680da

6900037: javac should warn if earlier -source is used and bootclasspath not set Reviewed-by: darcy
author jjg
date Mon, 29 Nov 2010 14:15:36 -0800
parents d44d6d8493ad
children bcbc86cc5b31 7e3e9f6d013f
files src/share/classes/com/sun/tools/javac/code/Lint.java src/share/classes/com/sun/tools/javac/file/JavacFileManager.java src/share/classes/com/sun/tools/javac/file/Paths.java src/share/classes/com/sun/tools/javac/main/JavaCompiler.java src/share/classes/com/sun/tools/javac/main/Main.java src/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java src/share/classes/com/sun/tools/javac/resources/compiler.properties src/share/classes/com/sun/tools/javac/util/BaseFileManager.java test/tools/javac/6341866/T6341866.java test/tools/javac/ClassFileModifiers/MemberModifiers.java test/tools/javac/T6900037.java test/tools/javac/T6900037.out test/tools/javac/TryWithResources/PlainTry.java test/tools/javac/annotations/neg/Dep.java test/tools/javac/diags/examples/AnnotationsNotSupported.java test/tools/javac/diags/examples/AssertAsIdentifier.java test/tools/javac/diags/examples/DiamondNotSupported.java test/tools/javac/diags/examples/EnumAsIdentifier.java test/tools/javac/diags/examples/EnumsNotSupported.java test/tools/javac/diags/examples/Expected2.java test/tools/javac/diags/examples/ForeachNotSupported.java test/tools/javac/diags/examples/GenericsNotSupported.java test/tools/javac/diags/examples/MulticatchNotSupported.java test/tools/javac/diags/examples/NeitherConditionalSubtype.java test/tools/javac/diags/examples/SourceNoBootclasspath.java test/tools/javac/diags/examples/StaticImportNotSupported.java test/tools/javac/diags/examples/StringSwitchNotSupported.java test/tools/javac/diags/examples/TryResourceNotSupported.java test/tools/javac/diags/examples/TryWithoutCatchOrFinally.java test/tools/javac/diags/examples/UnsupportedBinaryLiteral.java test/tools/javac/diags/examples/UnsupportedFpLit.java test/tools/javac/diags/examples/UnsupportedUnderscoreLiteral.java test/tools/javac/diags/examples/VarargsNotSupported.java test/tools/javac/enum/6384542/T6384542.java test/tools/javac/enum/6384542/T6384542a.java test/tools/javac/literals/BadBinaryLiterals.java test/tools/javac/literals/BadUnderscoreLiterals.java test/tools/javac/processing/warnings/TestSourceVersionWarnings.java test/tools/javac/varargs/warning/Warn1.java
diffstat 39 files changed, 199 insertions(+), 78 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/code/Lint.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/src/share/classes/com/sun/tools/javac/code/Lint.java	Mon Nov 29 14:15:36 2010 -0800
@@ -165,6 +165,11 @@
         FINALLY("finally"),
 
         /**
+         * Warn about issues relating to use of command line options
+         */
+        OPTIONS("options"),
+
+        /**
          * Warn about issues regarding method overrides.
          */
         OVERRIDES("overrides"),
@@ -182,39 +187,39 @@
         PROCESSING("processing"),
 
         /**
+         * Warn about unchecked operations on raw types.
+         */
+        RAW("rawtypes"),
+
+        /**
          * Warn about Serializable classes that do not provide a serial version ID.
          */
         SERIAL("serial"),
 
         /**
+         * Warn about issues relating to use of statics
+         */
+        STATIC("static"),
+
+        /**
+         * Warn about proprietary API that may be removed in a future release.
+         */
+        SUNAPI("sunapi", true),
+
+        /**
+         * Warn about issues relating to use of try blocks (i.e. try-with-resources)
+         */
+        TRY("try"),
+
+        /**
          * Warn about unchecked operations on raw types.
          */
         UNCHECKED("unchecked"),
 
         /**
-         * Warn about unchecked operations on raw types.
-         */
-        RAW("rawtypes"),
-
-        /**
-         * Warn about proprietary API that may be removed in a future release.
-         */
-        SUNAPI("sunapi", true),
-
-        /**
-         * Warn about issues relating to use of statics
-         */
-        STATIC("static"),
-
-        /**
          * Warn about potentially unsafe vararg methods
          */
-        VARARGS("varargs"),
-
-        /**
-         * Warn about issues relating to use of try blocks (i.e. try-with-resources)
-         */
-        TRY("try");
+        VARARGS("varargs");
 
         LintCategory(String option) {
             this(option, false);
--- a/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Mon Nov 29 14:15:36 2010 -0800
@@ -174,6 +174,11 @@
         }
     }
 
+    @Override
+    public boolean isDefaultBootClassPath() {
+        return paths.isDefaultBootClassPath();
+    }
+
     public JavaFileObject getFileForInput(String name) {
         return getRegularFile(new File(name));
     }
--- a/src/share/classes/com/sun/tools/javac/file/Paths.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/src/share/classes/com/sun/tools/javac/file/Paths.java	Mon Nov 29 14:15:36 2010 -0800
@@ -114,6 +114,11 @@
      */
     private File bootClassPathRtJar = null;
 
+    /**
+     *  Is bootclasspath the default?
+     */
+    private boolean isDefaultBootClassPath;
+
     Path getPathForLocation(Location location) {
         Path path = pathsForLocation.get(location);
         if (path == null)
@@ -129,7 +134,7 @@
             if (location == CLASS_PATH)
                 p = computeUserClassPath();
             else if (location == PLATFORM_CLASS_PATH)
-                p = computeBootClassPath();
+                p = computeBootClassPath(); // sets isDefaultBootClassPath
             else if (location == ANNOTATION_PROCESSOR_PATH)
                 p = computeAnnotationProcessorPath();
             else if (location == SOURCE_PATH)
@@ -138,6 +143,8 @@
                 // no defaults for other paths
                 p = null;
         } else {
+            if (location == PLATFORM_CLASS_PATH)
+                isDefaultBootClassPath = false;
             p = new Path();
             for (File f: path)
                 p.addFile(f, warn); // TODO: is use of warn appropriate?
@@ -145,6 +152,11 @@
         pathsForLocation.put(location, p);
     }
 
+    boolean isDefaultBootClassPath() {
+        lazy();
+        return isDefaultBootClassPath;
+    }
+
     protected void lazy() {
         if (!inited) {
             warn = lint.isEnabled(Lint.LintCategory.PATH);
@@ -262,9 +274,10 @@
         }
 
         public Path addFiles(String files, boolean warn) {
-            if (files != null)
+            if (files != null) {
                 for (File file : getPathEntries(files, emptyPathDefault))
                     addFile(file, warn);
+            }
             return this;
         }
 
@@ -334,18 +347,23 @@
 
     private Path computeBootClassPath() {
         bootClassPathRtJar = null;
-        String optionValue;
         Path path = new Path();
 
-        path.addFiles(options.get(XBOOTCLASSPATH_PREPEND));
+        String bootclasspathOpt = options.get(BOOTCLASSPATH);
+        String endorseddirsOpt = options.get(ENDORSEDDIRS);
+        String extdirsOpt = options.get(EXTDIRS);
+        String xbootclasspathPrependOpt = options.get(XBOOTCLASSPATH_PREPEND);
+        String xbootclasspathAppendOpt = options.get(XBOOTCLASSPATH_APPEND);
 
-        if ((optionValue = options.get(ENDORSEDDIRS)) != null)
-            path.addDirectories(optionValue);
+        path.addFiles(xbootclasspathPrependOpt);
+
+        if (endorseddirsOpt != null)
+            path.addDirectories(endorseddirsOpt);
         else
             path.addDirectories(System.getProperty("java.endorsed.dirs"), false);
 
-        if ((optionValue = options.get(BOOTCLASSPATH)) != null) {
-            path.addFiles(optionValue);
+        if (bootclasspathOpt != null) {
+            path.addFiles(bootclasspathOpt);
         } else {
             // Standard system classes for this compiler's release.
             String files = System.getProperty("sun.boot.class.path");
@@ -357,16 +375,21 @@
             }
         }
 
-        path.addFiles(options.get(XBOOTCLASSPATH_APPEND));
+        path.addFiles(xbootclasspathAppendOpt);
 
         // Strictly speaking, standard extensions are not bootstrap
         // classes, but we treat them identically, so we'll pretend
         // that they are.
-        if ((optionValue = options.get(EXTDIRS)) != null)
-            path.addDirectories(optionValue);
+        if (extdirsOpt != null)
+            path.addDirectories(extdirsOpt);
         else
             path.addDirectories(System.getProperty("java.ext.dirs"), false);
 
+        isDefaultBootClassPath =
+                (xbootclasspathPrependOpt == null) &&
+                (bootclasspathOpt == null) &&
+                (xbootclasspathAppendOpt == null);
+
         return path;
     }
 
--- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Mon Nov 29 14:15:36 2010 -0800
@@ -51,6 +51,7 @@
 import com.sun.tools.javac.file.JavacFileManager;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.code.Lint.LintCategory;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.tree.JCTree.*;
@@ -370,6 +371,15 @@
         processPcks   = options.isSet("process.packages");
         werror        = options.isSet(WERROR);
 
+        if (source.compareTo(Source.DEFAULT) < 0) {
+            if (options.isUnset(XLINT_CUSTOM, "-" + LintCategory.OPTIONS.option)) {
+                if (fileManager instanceof BaseFileManager) {
+                    if (((BaseFileManager) fileManager).isDefaultBootClassPath())
+                        log.warning(LintCategory.OPTIONS, "source.no.bootclasspath", source.name);
+                }
+            }
+        }
+
         verboseCompilePolicy = options.isSet("verboseCompilePolicy");
 
         if (attrParseOnly)
@@ -783,6 +793,7 @@
         hasBeenUsed = true;
 
         start_msec = now();
+
         try {
             initProcessAnnotations(processors);
 
@@ -797,7 +808,7 @@
             elapsed_msec = delegateCompiler.elapsed_msec;
         } catch (Abort ex) {
             if (devVerbose)
-                ex.printStackTrace();
+                ex.printStackTrace(System.err);
         } finally {
             if (procEnvImpl != null)
                 procEnvImpl.close();
@@ -841,7 +852,7 @@
             }
         } catch (Abort ex) {
             if (devVerbose)
-                ex.printStackTrace();
+                ex.printStackTrace(System.err);
         }
 
         if (verbose) {
--- a/src/share/classes/com/sun/tools/javac/main/Main.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/src/share/classes/com/sun/tools/javac/main/Main.java	Mon Nov 29 14:15:36 2010 -0800
@@ -420,7 +420,7 @@
                          processors);
 
             if (log.expectDiagKeys != null) {
-                if (log.expectDiagKeys.size() == 0) {
+                if (log.expectDiagKeys.isEmpty()) {
                     Log.printLines(log.noticeWriter, "all expected diagnostics found");
                     return EXIT_OK;
                 } else {
@@ -506,7 +506,7 @@
     void apMessage(AnnotationProcessingError ex) {
         Log.printLines(out,
                        getLocalizedString("msg.proc.annotation.uncaught.exception"));
-        ex.getCause().printStackTrace();
+        ex.getCause().printStackTrace(out);
     }
 
     /** Display the location and checksum of a class. */
@@ -563,6 +563,7 @@
     public static void useRawMessages(boolean enable) {
         if (enable) {
             messages = new JavacMessages(javacBundleName) {
+                    @Override
                     public String getLocalizedString(String key, Object... args) {
                         return key;
                     }
--- a/src/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/src/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java	Mon Nov 29 14:15:36 2010 -0800
@@ -172,6 +172,11 @@
         return getClassLoader(lb.toArray(new URL[lb.size()]));
     }
 
+    @Override
+    public boolean isDefaultBootClassPath() {
+        return searchPaths.isDefaultBootClassPath();
+    }
+
     // <editor-fold defaultstate="collapsed" desc="Location handling">
 
     public boolean hasLocation(Location location) {
--- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Nov 29 10:09:48 2010 -0800
+++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Nov 29 14:15:36 2010 -0800
@@ -764,6 +764,9 @@
 compiler.warn.static.not.qualified.by.type=\
     static {0} should be qualified by type name, {1}, instead of by an expression
 
+compiler.warn.source.no.bootclasspath=\
+    bootstrap class path not set in conjunction with -source {0}
+
 # Warnings related to annotation processing
 compiler.warn.proc.package.does.not.exist=\
     package {0} does not exist
--- a/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java	Mon Nov 29 14:15:36 2010 -0800
@@ -59,7 +59,7 @@
  * There are no references here to file-system specific objects such as
  * java.io.File or java.nio.file.Path.
  */
-public class BaseFileManager {
+public abstract class BaseFileManager {
     protected BaseFileManager(Charset charset) {
         this.charset = charset;
         byteBufferCache = new ByteBufferCache();
@@ -163,6 +163,9 @@
         }
         return -1;
     }
+
+    public abstract boolean isDefaultBootClassPath();
+
     // </editor-fold>
 
     // <editor-fold defaultstate="collapsed" desc="Encoding">
--- a/test/tools/javac/6341866/T6341866.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/6341866/T6341866.java	Mon Nov 29 14:15:36 2010 -0800
@@ -97,7 +97,7 @@
         processorServices.delete();
 
         List<String> opts = new ArrayList<String>();
-        opts.addAll(Arrays.asList("-d", ".", "-sourcepath", testSrc, "-classpath", testClasses, "-source", "1.6"));
+        opts.addAll(Arrays.asList("-d", ".", "-sourcepath", testSrc, "-classpath", testClasses, "-source", "1.6", "-Xlint:-options"));
         if (implicitType.opt != null)
             opts.add(implicitType.opt);
 
--- a/test/tools/javac/ClassFileModifiers/MemberModifiers.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/ClassFileModifiers/MemberModifiers.java	Mon Nov 29 14:15:36 2010 -0800
@@ -26,7 +26,7 @@
  * @bug 4249112 4785453
  * @summary Verify that implicit member modifiers are set correctly.
  *
- * @compile/ref=MemberModifiers.out  -source 1.4 -target 1.4.2 -XDdumpmodifiers=cfm MemberModifiers.java
+ * @compile/ref=MemberModifiers.out  -source 1.4 -target 1.4.2 -Xlint:-options -XDdumpmodifiers=cfm MemberModifiers.java
  */
 
 // Currently, we check only that members of final classes are not final.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T6900037.java	Mon Nov 29 14:15:36 2010 -0800
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, 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 6900037
+ * @summary javac should warn if earlier -source is used and bootclasspath not set
+ * @compile T6900037.java
+ * @compile -source 1.6 T6900037.java
+ * @compile/fail/ref=T6900037.out -XDrawDiagnostics -Werror -source 1.6 T6900037.java
+ * @compile -Werror -source 1.6 -Xlint:-options T6900037.java
+ */
+
+class T6900037 { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T6900037.out	Mon Nov 29 14:15:36 2010 -0800
@@ -0,0 +1,4 @@
+- compiler.warn.source.no.bootclasspath: 1.6
+- compiler.err.warnings.and.werror
+1 error
+1 warning
--- a/test/tools/javac/TryWithResources/PlainTry.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/TryWithResources/PlainTry.java	Mon Nov 29 14:15:36 2010 -0800
@@ -3,8 +3,8 @@
  * @bug 6911256 6964740
  * @author Joseph D. Darcy
  * @summary Test error messages for an unadorned try
- * @compile/fail/ref=PlainTry6.out -XDrawDiagnostics -source 6 PlainTry.java
- * @compile/fail/ref=PlainTry.out  -XDrawDiagnostics           PlainTry.java
+ * @compile/fail/ref=PlainTry6.out -XDrawDiagnostics -source 6 -Xlint:-options PlainTry.java
+ * @compile/fail/ref=PlainTry.out  -XDrawDiagnostics                           PlainTry.java
  */
 public class PlainTry {
     public static void main(String... args) {
--- a/test/tools/javac/annotations/neg/Dep.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/annotations/neg/Dep.java	Mon Nov 29 14:15:36 2010 -0800
@@ -27,9 +27,9 @@
  * @summary Please add annotation <at>Deprecated to supplant the javadoc tag
  * @author gafter
  *
- * @compile      -source 1.4 -Xlint:dep-ann -Werror Dep.java
- * @compile/fail             -Xlint:dep-ann -Werror Dep.java
- * @compile                  -Xlint:dep-ann         Dep.java
+ * @compile      -source 1.4 -Xlint:-options -Xlint:dep-ann -Werror Dep.java
+ * @compile/fail                             -Xlint:dep-ann -Werror Dep.java
+ * @compile                                  -Xlint:dep-ann         Dep.java
  */
 
 /** @deprecated */
--- a/test/tools/javac/diags/examples/AnnotationsNotSupported.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/diags/examples/AnnotationsNotSupported.java	Mon Nov 29 14:15:36 2010 -0800
@@ -22,7 +22,7 @@
  */
 
 // key: compiler.err.annotations.not.supported.in.source
-// options: -source 1.4
+// options: -source 1.4 -Xlint:-options
 
 @Deprecated
 class AnnotationsNotSupported { }
--- a/test/tools/javac/diags/examples/AssertAsIdentifier.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/diags/examples/AssertAsIdentifier.java	Mon Nov 29 14:15:36 2010 -0800
@@ -22,7 +22,7 @@
  */
 
 // key: compiler.warn.assert.as.identifier
-// options: -source 1.3
+// options: -source 1.3 -Xlint:-options
 
 class AssertAsIdentifier {
     int assert;
--- a/test/tools/javac/diags/examples/DiamondNotSupported.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/diags/examples/DiamondNotSupported.java	Mon Nov 29 14:15:36 2010 -0800
@@ -22,7 +22,7 @@
  */
 
 // key: compiler.err.diamond.not.supported.in.source
-// options: -source 6
+// options: -source 6 -Xlint:-options
 
 import java.util.*;
 
--- a/test/tools/javac/diags/examples/EnumAsIdentifier.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/diags/examples/EnumAsIdentifier.java	Mon Nov 29 14:15:36 2010 -0800
@@ -22,7 +22,7 @@
  */
 
 // key: compiler.warn.enum.as.identifier
-// options: -source 1.3
+// options: -source 1.3 -Xlint:-options
 
 class EnumAsIdentifier {
     int enum;
--- a/test/tools/javac/diags/examples/EnumsNotSupported.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/diags/examples/EnumsNotSupported.java	Mon Nov 29 14:15:36 2010 -0800
@@ -22,6 +22,6 @@
  */
 
 // key: compiler.err.enums.not.supported.in.source
-// options: -source 1.4
+// options: -source 1.4 -Xlint:-options
 
 enum EnumsNotSupported { A, B, C }
--- a/test/tools/javac/diags/examples/Expected2.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/diags/examples/Expected2.java	Mon Nov 29 14:15:36 2010 -0800
@@ -22,6 +22,6 @@
  */
 
 // key: compiler.err.expected2
-// options: -source 1.4
+// options: -source 1.4 -Xlint:-options
 
 int Expected2;
--- a/test/tools/javac/diags/examples/ForeachNotSupported.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/diags/examples/ForeachNotSupported.java	Mon Nov 29 14:15:36 2010 -0800
@@ -22,7 +22,7 @@
  */
 
 // key: compiler.err.foreach.not.supported.in.source
-// options: -source 1.4
+// options: -source 1.4 -Xlint:-options
 
 class ForeachNotSupported {
     void m(String[] args) {
--- a/test/tools/javac/diags/examples/GenericsNotSupported.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/diags/examples/GenericsNotSupported.java	Mon Nov 29 14:15:36 2010 -0800
@@ -22,6 +22,6 @@
  */
 
 // key: compiler.err.generics.not.supported.in.source
-// options: -source 1.4
+// options: -source 1.4 -Xlint:-options
 
 class GenericsNotSupported<T> { }
--- a/test/tools/javac/diags/examples/MulticatchNotSupported.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/diags/examples/MulticatchNotSupported.java	Mon Nov 29 14:15:36 2010 -0800
@@ -22,7 +22,7 @@
  */
 
 // key: compiler.err.multicatch.not.supported.in.source
-// options: -source 1.6
+// options: -source 1.6 -Xlint:-options
 
 class MulticatchNotSupported {
     class E1 extends Exception { }
--- a/test/tools/javac/diags/examples/NeitherConditionalSubtype.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/diags/examples/NeitherConditionalSubtype.java	Mon Nov 29 14:15:36 2010 -0800
@@ -22,7 +22,7 @@
  */
 
 // key: compiler.err.neither.conditional.subtype
-// options: -source 1.4
+// options: -source 1.4 -Xlint:-options
 
 class X {
     Object m(boolean b) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/SourceNoBootclasspath.java	Mon Nov 29 14:15:36 2010 -0800
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2010, 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.warn.source.no.bootclasspath
+// options: -source 6
+
+class SourceNoBootclasspath { }
--- a/test/tools/javac/diags/examples/StaticImportNotSupported.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/diags/examples/StaticImportNotSupported.java	Mon Nov 29 14:15:36 2010 -0800
@@ -22,7 +22,7 @@
  */
 
 // key: compiler.err.static.import.not.supported.in.source
-// options: -source 1.4
+// options: -source 1.4 -Xlint:-options
 
 import static java.util.regex.Pattern.*;
 
--- a/test/tools/javac/diags/examples/StringSwitchNotSupported.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/diags/examples/StringSwitchNotSupported.java	Mon Nov 29 14:15:36 2010 -0800
@@ -22,7 +22,7 @@
  */
 
 // key: compiler.err.string.switch.not.supported.in.source
-// options: -source 6
+// options: -source 6 -Xlint:-options
 
 class StringSwitchNotSupported {
     int m(String s) {
--- a/test/tools/javac/diags/examples/TryResourceNotSupported.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/diags/examples/TryResourceNotSupported.java	Mon Nov 29 14:15:36 2010 -0800
@@ -22,7 +22,7 @@
  */
 
 // key: compiler.err.try.with.resources.not.supported.in.source
-// options: -source 1.6
+// options: -source 1.6 -Xlint:-options
 
 import java.io.*;
 
--- a/test/tools/javac/diags/examples/TryWithoutCatchOrFinally.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/diags/examples/TryWithoutCatchOrFinally.java	Mon Nov 29 14:15:36 2010 -0800
@@ -22,7 +22,7 @@
  */
 
 // key: compiler.err.try.without.catch.or.finally
-// options: -source 1.6
+// options: -source 1.6 -Xlint:-options
 
 class TryWithoutCatchOrFinally {
     void m() {
--- a/test/tools/javac/diags/examples/UnsupportedBinaryLiteral.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/diags/examples/UnsupportedBinaryLiteral.java	Mon Nov 29 14:15:36 2010 -0800
@@ -22,7 +22,7 @@
  */
 
 // key: compiler.err.unsupported.binary.lit
-// options: -source 6
+// options: -source 6 -Xlint:-options
 
 class UnsupportedBinaryLiteral {
     int i = 0b01000010;
--- a/test/tools/javac/diags/examples/UnsupportedFpLit.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/diags/examples/UnsupportedFpLit.java	Mon Nov 29 14:15:36 2010 -0800
@@ -22,7 +22,7 @@
  */
 
 // key: compiler.err.unsupported.fp.lit
-// options: -source 1.4
+// options: -source 1.4 -Xlint:-options
 
 class UnsupportedFpLit {
     float f = 0xCafe.BabeP1;
--- a/test/tools/javac/diags/examples/UnsupportedUnderscoreLiteral.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/diags/examples/UnsupportedUnderscoreLiteral.java	Mon Nov 29 14:15:36 2010 -0800
@@ -22,7 +22,7 @@
  */
 
 // key: compiler.err.unsupported.underscore.lit
-// options: -source 6
+// options: -source 6 -Xlint:-options
 
 class UnsupportedUnderscoreLiteral {
     int i = 123_456_789;
--- a/test/tools/javac/diags/examples/VarargsNotSupported.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/diags/examples/VarargsNotSupported.java	Mon Nov 29 14:15:36 2010 -0800
@@ -22,7 +22,7 @@
  */
 
 // key: compiler.err.varargs.not.supported.in.source
-// options: -source 1.4
+// options: -source 1.4 -Xlint:-options
 
 class VarargsNotSupported {
     void m(String... args) { }
--- a/test/tools/javac/enum/6384542/T6384542.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/enum/6384542/T6384542.java	Mon Nov 29 14:15:36 2010 -0800
@@ -3,8 +3,8 @@
  * @bug     6384542
  * @summary crash: test/tools/javac/versions/check.sh
  * @author  Peter von der Ah\u00e9
- * @compile/fail -source 1.4 T6384542.java
- * @compile/fail/ref=T6384542.out -source 1.4 -XDrawDiagnostics T6384542.java
+ * @compile/fail -source 1.4 -Xlint:-options T6384542.java
+ * @compile/fail/ref=T6384542.out -source 1.4 -Xlint:-options -XDrawDiagnostics T6384542.java
  */
 
 import static java.lang.Math.sin;
--- a/test/tools/javac/enum/6384542/T6384542a.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/enum/6384542/T6384542a.java	Mon Nov 29 14:15:36 2010 -0800
@@ -5,8 +5,8 @@
  * @author  Peter von der Ah\u00e9
  * @compile/fail -source 5   T6384542a.java
  * @compile      -source 1.4 T6384542a.java
- * @compile/fail/ref=T6384542a_5.out -source 5   -XDrawDiagnostics T6384542a.java
- * @compile/ref=T6384542a_1_4.out    -source 1.4 -XDrawDiagnostics T6384542a.java
+ * @compile/fail/ref=T6384542a_5.out -source 5   -Xlint:-options -XDrawDiagnostics T6384542a.java
+ * @compile/ref=T6384542a_1_4.out    -source 1.4 -Xlint:-options -XDrawDiagnostics T6384542a.java
  */
 
 public class T6384542a {
--- a/test/tools/javac/literals/BadBinaryLiterals.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/literals/BadBinaryLiterals.java	Mon Nov 29 14:15:36 2010 -0800
@@ -2,7 +2,7 @@
  * @test /nodynamiccopyright/
  * @bug 6860965
  * @summary Project Coin: binary literals
- * @compile/fail/ref=BadBinaryLiterals.6.out -XDrawDiagnostics -source 6 BadBinaryLiterals.java
+ * @compile/fail/ref=BadBinaryLiterals.6.out -XDrawDiagnostics -source 6 -Xlint:-options BadBinaryLiterals.java
  * @compile/fail/ref=BadBinaryLiterals.7.out -XDrawDiagnostics BadBinaryLiterals.java
  */
 
--- a/test/tools/javac/literals/BadUnderscoreLiterals.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/literals/BadUnderscoreLiterals.java	Mon Nov 29 14:15:36 2010 -0800
@@ -7,7 +7,7 @@
  * @compile/fail/ref=BadUnderscoreLiterals.7.out -XDrawDiagnostics BadUnderscoreLiterals.java
  *
  * @compile/fail -source 6 BadUnderscoreLiterals.java
- * @compile/fail/ref=BadUnderscoreLiterals.6.out -XDrawDiagnostics -source 6 BadUnderscoreLiterals.java
+ * @compile/fail/ref=BadUnderscoreLiterals.6.out -XDrawDiagnostics -source 6 -Xlint:-options BadUnderscoreLiterals.java
  */
 
 public class BadUnderscoreLiterals {
--- a/test/tools/javac/processing/warnings/TestSourceVersionWarnings.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/processing/warnings/TestSourceVersionWarnings.java	Mon Nov 29 14:15:36 2010 -0800
@@ -27,15 +27,15 @@
  * @summary Test that warnings about source versions are output as expected.
  * @author  Joseph D. Darcy
  * @compile TestSourceVersionWarnings.java
- * @compile/ref=gold_0.out             -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only                           -source 1.5 HelloWorld.java
- * @compile/ref=gold_sv_warn_0_2.out   -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_0 -source 1.2 HelloWorld.java
- * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_2 -source 1.2 HelloWorld.java
- * @compile/ref=gold_sv_warn_2_3.out   -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_2 -source 1.3 HelloWorld.java
- * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_5 -source 1.5 HelloWorld.java
- * @compile/ref=gold_sv_warn_5_6.out   -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_5 -source 1.6 HelloWorld.java
- * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_6 -source 1.6 HelloWorld.java
- * @compile/ref=gold_unsp_warn.out     -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_6 -source 1.6 -Aunsupported HelloWorld.java
- * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_7 -source 1.7 HelloWorld.java
+ * @compile/ref=gold_0.out             -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only                           -source 1.5 -Xlint:-options HelloWorld.java
+ * @compile/ref=gold_sv_warn_0_2.out   -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_0 -source 1.2 -Xlint:-options HelloWorld.java
+ * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_2 -source 1.2 -Xlint:-options HelloWorld.java
+ * @compile/ref=gold_sv_warn_2_3.out   -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_2 -source 1.3 -Xlint:-options HelloWorld.java
+ * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_5 -source 1.5 -Xlint:-options HelloWorld.java
+ * @compile/ref=gold_sv_warn_5_6.out   -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_5 -source 1.6 -Xlint:-options HelloWorld.java
+ * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_6 -source 1.6 -Xlint:-options HelloWorld.java
+ * @compile/ref=gold_unsp_warn.out     -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_6 -source 1.6 -Xlint:-options -Aunsupported HelloWorld.java
+ * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_7 -source 1.7                 HelloWorld.java
  */
 
 import java.util.Set;
--- a/test/tools/javac/varargs/warning/Warn1.java	Mon Nov 29 10:09:48 2010 -0800
+++ b/test/tools/javac/varargs/warning/Warn1.java	Mon Nov 29 14:15:36 2010 -0800
@@ -27,7 +27,7 @@
  * @summary fixed-arity warning given too often
  * @author gafter
  *
- * @compile -Werror -source 1.4 Warn1.java
+ * @compile -Werror -source 1.4 -Xlint:-options Warn1.java
  */
 
 package varargs.warning.warn1;