8031670: Remove unneeded -source options in javadoc tests
authordarcy
Thu, 06 Mar 2014 16:15:02 -0800
changeset 23139 612191246a7d
parent 23138 497fb20a5754
child 23140 0e7bf76e46f0
8031670: Remove unneeded -source options in javadoc tests Reviewed-by: jjg, darcy, vromero Contributed-by: neil.toda@oracle.com
langtools/test/com/sun/javadoc/5093723/T5093723.java
langtools/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java
langtools/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java
langtools/test/com/sun/javadoc/testClassTree/TestClassTree.java
langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java
langtools/test/com/sun/javadoc/testHref/TestHref.java
langtools/test/com/sun/javadoc/testLambdaFeature/TestLambdaFeature.java
langtools/test/com/sun/javadoc/testNestedGenerics/TestNestedGenerics.java
langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java
langtools/test/com/sun/javadoc/testPackageDeprecation/TestPackageDeprecation.java
langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java
langtools/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java
langtools/test/tools/javadoc/6964914/JavacWarning.java
langtools/test/tools/javadoc/6964914/Test.java
langtools/test/tools/javadoc/LangVers.java
langtools/test/tools/javadoc/sourceOption/SourceOption.java
langtools/test/tools/javadoc/sourceOption/p/A.java
langtools/test/tools/javadoc/sourceOption/p/LambdaConstructTest.java
--- a/langtools/test/com/sun/javadoc/5093723/T5093723.java	Thu Mar 06 10:41:56 2014 -0800
+++ b/langtools/test/com/sun/javadoc/5093723/T5093723.java	Thu Mar 06 16:15:02 2014 -0800
@@ -36,7 +36,7 @@
     private static final String BUG_ID = "5093723";
 
     private static final String[] ARGS = new String[] {
-        "-d", BUG_ID + ".out", "-source", "5", "-Xdoclint:none",
+        "-d", BUG_ID + ".out", "-Xdoclint:none",
         SRC_DIR + "/DocumentedClass.java",
         SRC_DIR + "/UndocumentedClass.java"
     };
--- a/langtools/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java	Thu Mar 06 10:41:56 2014 -0800
+++ b/langtools/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java	Thu Mar 06 16:15:02 2014 -0800
@@ -40,7 +40,7 @@
 
     //Javadoc arguments.
     private static final String[] ARGS = new String[] {
-        "-d", BUG_ID, "-sourcepath", SRC_DIR, "-source", "1.5", "pkg"
+        "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg"
     };
 
     //Input for string search tests.
--- a/langtools/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java	Thu Mar 06 10:41:56 2014 -0800
+++ b/langtools/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java	Thu Mar 06 16:15:02 2014 -0800
@@ -39,7 +39,7 @@
 
     //Javadoc arguments.
     private static final String[] ARGS = new String[] {
-        "-d", BUG_ID, "-sourcepath", SRC_DIR, "-source", "1.5", "pkg"
+        "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg"
     };
 
     //Input for string search tests.
--- a/langtools/test/com/sun/javadoc/testClassTree/TestClassTree.java	Thu Mar 06 10:41:56 2014 -0800
+++ b/langtools/test/com/sun/javadoc/testClassTree/TestClassTree.java	Thu Mar 06 16:15:02 2014 -0800
@@ -42,7 +42,7 @@
 
     //Javadoc arguments.
     private static final String[] ARGS = new String[] {
-        "-d", BUG_ID, "-source",  "1.5","-sourcepath", SRC_DIR, "pkg"
+        "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg"
     };
 
     //Input for string search tests.
--- a/langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java	Thu Mar 06 10:41:56 2014 -0800
+++ b/langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java	Thu Mar 06 16:15:02 2014 -0800
@@ -38,7 +38,7 @@
 
     //Javadoc arguments.
     private static final String[] ARGS = new String[] {
-        "-d", BUG_ID, "-source", "1.5", "-sourcepath", SRC_DIR, "pkg"
+        "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg"
     };
 
     private static final String TARGET_FILE  =
--- a/langtools/test/com/sun/javadoc/testHref/TestHref.java	Thu Mar 06 10:41:56 2014 -0800
+++ b/langtools/test/com/sun/javadoc/testHref/TestHref.java	Thu Mar 06 16:15:02 2014 -0800
@@ -38,7 +38,7 @@
 
     //Javadoc arguments.
     private static final String[] ARGS = new String[] {
-        "-d", BUG_ID, "-source", "1.5", "-sourcepath", SRC_DIR, "-linkoffline",
+        "-d", BUG_ID, "-sourcepath", SRC_DIR, "-linkoffline",
         "http://java.sun.com/j2se/1.4/docs/api/", SRC_DIR, "pkg"
     };
 
--- a/langtools/test/com/sun/javadoc/testLambdaFeature/TestLambdaFeature.java	Thu Mar 06 10:41:56 2014 -0800
+++ b/langtools/test/com/sun/javadoc/testLambdaFeature/TestLambdaFeature.java	Thu Mar 06 16:15:02 2014 -0800
@@ -32,6 +32,12 @@
  * @run main TestLambdaFeature
  */
 
+/*
+ * NOTE : This test should be elided when version 1.7 support is removed from the JDK
+ *              or the negative part of the test showing 1.7's non-support should be
+ *              removed [ 8022738 ]
+ */
+
 public class TestLambdaFeature extends JavadocTester {
 
     //Test information.
@@ -43,7 +49,7 @@
     };
 
     private static final String[] ARGS_1 = new String[] {
-        "-d", BUG_ID + "-2", "-sourcepath", SRC_DIR, "-source", "1.5", "pkg1"
+        "-d", BUG_ID + "-2", "-sourcepath", SRC_DIR, "-source", "1.7", "pkg1"
     };
 
     //Input for string search tests.
--- a/langtools/test/com/sun/javadoc/testNestedGenerics/TestNestedGenerics.java	Thu Mar 06 10:41:56 2014 -0800
+++ b/langtools/test/com/sun/javadoc/testNestedGenerics/TestNestedGenerics.java	Thu Mar 06 16:15:02 2014 -0800
@@ -38,7 +38,7 @@
 
     //Javadoc arguments.
     private static final String[] ARGS = new String[]{
-        "-d", BUG_ID, "-source", "1.5", "-sourcepath", SRC_DIR,
+        "-d", BUG_ID, "-sourcepath", SRC_DIR,
         "pkg"
     };
 
--- a/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java	Thu Mar 06 10:41:56 2014 -0800
+++ b/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java	Thu Mar 06 16:15:02 2014 -0800
@@ -40,7 +40,7 @@
 
     //Javadoc arguments.
     private static final String[] ARGS = new String[] {
-        "-Xdoclint:none", "-d", BUG_ID, "-use", "-source", "1.5", "-sourcepath", SRC_DIR, "pkg", "pkg1", "pkg2"
+        "-Xdoclint:none", "-d", BUG_ID, "-use", "-sourcepath", SRC_DIR, "pkg", "pkg1", "pkg2"
     };
 
     //Input for string search tests.
--- a/langtools/test/com/sun/javadoc/testPackageDeprecation/TestPackageDeprecation.java	Thu Mar 06 10:41:56 2014 -0800
+++ b/langtools/test/com/sun/javadoc/testPackageDeprecation/TestPackageDeprecation.java	Thu Mar 06 16:15:02 2014 -0800
@@ -38,11 +38,11 @@
 
     //Javadoc arguments.
     private static final String[] ARGS1 = new String[]{
-        "-d", BUG_ID + "-1", "-source", "1.5", "-sourcepath", SRC_DIR, "-use", "pkg", "pkg1",
+        "-d", BUG_ID + "-1", "-sourcepath", SRC_DIR, "-use", "pkg", "pkg1",
         SRC_DIR + FS + "C2.java", SRC_DIR + FS + "FooDepr.java"
     };
     private static final String[] ARGS2 = new String[]{
-        "-d", BUG_ID + "-2", "-source", "1.5", "-sourcepath", SRC_DIR, "-use", "-nodeprecated",
+        "-d", BUG_ID + "-2", "-sourcepath", SRC_DIR, "-use", "-nodeprecated",
         "pkg", "pkg1", SRC_DIR + FS + "C2.java", SRC_DIR + FS + "FooDepr.java"
     };
 
--- a/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java	Thu Mar 06 10:41:56 2014 -0800
+++ b/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java	Thu Mar 06 16:15:02 2014 -0800
@@ -49,11 +49,11 @@
 
     //Javadoc arguments.
     private static final String[] ARGS1 = new String[] {
-        "-d", BUG_ID + "-1", "-sourcepath", SRC_DIR, "-source", "1.5", "pkg", "pkg2"
+        "-d", BUG_ID + "-1", "-sourcepath", SRC_DIR, "pkg", "pkg2"
     };
     private static final String[] ARGS2 = new String[] {
         "-d", BUG_ID + "-2", "-sourcepath", SRC_DIR, "-private",
-            "-source", "1.5", "pkg", "pkg2"
+            "pkg", "pkg2"
     };
 
     // Test output when -private flag is not used.
--- a/langtools/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java	Thu Mar 06 10:41:56 2014 -0800
+++ b/langtools/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java	Thu Mar 06 16:15:02 2014 -0800
@@ -42,11 +42,11 @@
 
     //Javadoc arguments.
     private static final String[] ARGS1 = new String[]{
-        "-d", BUG_ID, "-use", "-source", "1.5", "-sourcepath", SRC_DIR,
+        "-d", BUG_ID, "-use", "-sourcepath", SRC_DIR,
         "pkg"
     };
     private static final String[] ARGS2 = new String[]{
-        "-d", BUG_ID, "-linksource", "-source", "1.5", "-sourcepath", SRC_DIR,
+        "-d", BUG_ID, "-linksource", "-sourcepath", SRC_DIR,
         "pkg"
     };
 
--- a/langtools/test/tools/javadoc/6964914/JavacWarning.java	Thu Mar 06 10:41:56 2014 -0800
+++ b/langtools/test/tools/javadoc/6964914/JavacWarning.java	Thu Mar 06 16:15:02 2014 -0800
@@ -22,5 +22,5 @@
  */
 
 public class JavacWarning {
-    int enum;  // warning in source 1.4
+    String _ = null; // this will cause a warning.  It may be deprecated in JDK8
 }
--- a/langtools/test/tools/javadoc/6964914/Test.java	Thu Mar 06 10:41:56 2014 -0800
+++ b/langtools/test/tools/javadoc/6964914/Test.java	Thu Mar 06 16:15:02 2014 -0800
@@ -46,7 +46,6 @@
         File testSrc = new File(System.getProperty("test.src"));
         String[] args = {
             "-Xdoclint:none",
-            "-source", "1.4", // enables certain Parser warnings
             "-bootclasspath", System.getProperty("sun.boot.class.path"),
             "-classpath", ".",
             "-package",
--- a/langtools/test/tools/javadoc/LangVers.java	Thu Mar 06 10:41:56 2014 -0800
+++ b/langtools/test/tools/javadoc/LangVers.java	Thu Mar 06 16:15:02 2014 -0800
@@ -42,7 +42,7 @@
                 "javadoc",
                 "LangVers",
                 LangVers.class.getClassLoader(),
-                new String[] {"-source", "1.5", thisFile}) != 0)
+                new String[] {thisFile}) != 0)
             throw new Error("Javadoc encountered warnings or errors.");
     }
 
--- a/langtools/test/tools/javadoc/sourceOption/SourceOption.java	Thu Mar 06 10:41:56 2014 -0800
+++ b/langtools/test/tools/javadoc/sourceOption/SourceOption.java	Thu Mar 06 16:15:02 2014 -0800
@@ -26,6 +26,31 @@
  * @bug     6507179
  * @summary Ensure that "-source" option isn't ignored.
  * @author  Scott Seligman
+ * @run main/fail SourceOption 7
+ * @run main      SourceOption 9
+ * @run main      SourceOption
+ */
+
+/*
+ * TEST NOTE
+ * With JDK9, this test has been transformed into a NEGATIVE test.
+ *
+ * Generally speaking, this test should check a feature not in at least
+ * one of the currently supported previous versions.  In this manner,
+ * a failure of the -source option to be honored would mean a pass of
+ * the test, and therefore a failure of the -source option.
+ *
+ * For JDK9 and JDK10, both support 1.7, which did not support javac's
+ * lambda construct.  So we set "-source 1.7" to compile a .java file
+ * containing the lambda construct.  javac should fail, thus showing
+ * -source to be working.  Thus the test passes.
+ *
+ * The second jtreg @run command checks to make sure that the source
+ * provided is valid for the current release of the JDK.
+ *
+ *  fixVersion: JDK11
+ *      replace ./p/LambdaConstructTest.java with a missing from
+ *      JDK8, JDK9, or JDK10.  Set -source below appropriately.
  */
 
 import com.sun.javadoc.*;
@@ -33,12 +58,22 @@
 public class SourceOption extends Doclet {
 
     public static void main(String[] args) {
+        String[] params;
+        if ((args == null) || (args.length==0)) {
+            params = new String[]{"p"};
+            System.out.println("NOTE : -source not provided, default taken");
+        } else {
+            params = new String[]{"-source", args[0], "p"};
+            System.out.println("NOTE : -source will be: " + args[0]);
+        }
+
         if (com.sun.tools.javadoc.Main.execute(
                 "javadoc",
                 "SourceOption",
                 SourceOption.class.getClassLoader(),
-                new String[] {"-source", "1.3", "p"}) != 0)
-            throw new Error("Javadoc encountered warnings or errors.");
+                params) != 0)
+        throw new Error("Javadoc encountered warnings or errors.");
+
     }
 
     public static boolean start(RootDoc root) {
--- a/langtools/test/tools/javadoc/sourceOption/p/A.java	Thu Mar 06 10:41:56 2014 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-public class A {
-    boolean assert;     // illegal since 1.4
-    boolean enum;       // illegal since 5
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javadoc/sourceOption/p/LambdaConstructTest.java	Thu Mar 06 16:15:02 2014 -0800
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+public class LambdaConstructTest {
+   public static void main(String[] args) {
+
+     System.out.println("=== LambdaConstructTest ===");
+
+     // Lambda Runnable
+     Runnable lambda = () -> System.out.println("it's a Lambda world!");
+
+     // Run it!
+     lambda.run();
+
+  }
+}
+