test/tools/javadoc/sourceOption/SourceOption.java

Print this page
rev 2307 : JDK-8031670: remove -source/-target 1.4 and 1.5

*** 24,33 **** --- 24,53 ---- /* * @test * @bug 6507179 * @summary Ensure that "-source" option isn't ignored. * @author Scott Seligman + * @run main/fail SourceOption + */ + + /* + * TEST NOTE + * With JDK9, this 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. + * + * fixVersion: JDK11 + * replace ./p/LambdaConstructTest.java with a missing from + * JDK8, JDK9, or JDK10. Set -source below appropriately. */ import com.sun.javadoc.*; public class SourceOption extends Doclet {
*** 35,48 **** public static void main(String[] args) { 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."); } public static boolean start(RootDoc root) { root.classes(); // force parser into action return true; } } --- 55,69 ---- public static void main(String[] args) { if (com.sun.tools.javadoc.Main.execute( "javadoc", "SourceOption", SourceOption.class.getClassLoader(), ! new String[] {"-source", "1.7", "p"}) != 0) throw new Error("Javadoc encountered warnings or errors."); } public static boolean start(RootDoc root) { root.classes(); // force parser into action return true; } } +