8031670: Remove unneeded -source options in javadoc tests
Reviewed-by: jjg, darcy, vromero
This commit is contained in:
parent
b2b667ccfe
commit
7aed9a60e0
langtools/test
com/sun/javadoc
5093723
testAnnotationOptional
testAnnotationTypes
testClassTree
testDeprecatedDocs
testHref
testLambdaFeature
testNestedGenerics
testNewLanguageFeatures
testPackageDeprecation
testPrivateClasses
testTypeParams
tools/javadoc
@ -36,7 +36,7 @@ public class T5093723 extends JavadocTester {
|
||||
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"
|
||||
};
|
||||
|
@ -40,7 +40,7 @@ public class TestAnnotationOptional extends JavadocTester {
|
||||
|
||||
//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.
|
||||
|
@ -39,7 +39,7 @@ public class TestAnnotationTypes extends JavadocTester {
|
||||
|
||||
//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.
|
||||
|
@ -42,7 +42,7 @@ public class TestClassTree extends JavadocTester {
|
||||
|
||||
//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.
|
||||
|
@ -38,7 +38,7 @@ public class TestDeprecatedDocs extends JavadocTester {
|
||||
|
||||
//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 =
|
||||
|
@ -38,7 +38,7 @@ public class TestHref extends JavadocTester {
|
||||
|
||||
//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"
|
||||
};
|
||||
|
||||
|
@ -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 @@ public class TestLambdaFeature extends JavadocTester {
|
||||
};
|
||||
|
||||
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.
|
||||
|
@ -38,7 +38,7 @@ public class TestNestedGenerics extends JavadocTester {
|
||||
|
||||
//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"
|
||||
};
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class TestNewLanguageFeatures extends JavadocTester {
|
||||
|
||||
//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.
|
||||
|
@ -38,11 +38,11 @@ public class TestPackageDeprecation extends JavadocTester {
|
||||
|
||||
//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"
|
||||
};
|
||||
|
||||
|
@ -49,11 +49,11 @@ public class TestPrivateClasses extends JavadocTester {
|
||||
|
||||
//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.
|
||||
|
@ -42,11 +42,11 @@ public class TestTypeParameters extends JavadocTester {
|
||||
|
||||
//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"
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -46,7 +46,6 @@ public class Test {
|
||||
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",
|
||||
|
@ -42,7 +42,7 @@ public class LangVers extends Doclet {
|
||||
"javadoc",
|
||||
"LangVers",
|
||||
LangVers.class.getClassLoader(),
|
||||
new String[] {"-source", "1.5", thisFile}) != 0)
|
||||
new String[] {thisFile}) != 0)
|
||||
throw new Error("Javadoc encountered warnings or errors.");
|
||||
}
|
||||
|
||||
|
@ -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 @@ import com.sun.javadoc.*;
|
||||
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) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -21,9 +21,17 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package p;
|
||||
public class LambdaConstructTest {
|
||||
public static void main(String[] args) {
|
||||
|
||||
public class A {
|
||||
boolean assert; // illegal since 1.4
|
||||
boolean enum; // illegal since 5
|
||||
System.out.println("=== LambdaConstructTest ===");
|
||||
|
||||
// Lambda Runnable
|
||||
Runnable lambda = () -> System.out.println("it's a Lambda world!");
|
||||
|
||||
// Run it!
|
||||
lambda.run();
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user