JDK 9 RFR of JDK-8031745: Remove unneeded/obsolete -source/-target options in javac tests, part 1

Brian Goetz brian.goetz at oracle.com
Thu Jan 16 08:57:44 PST 2014


Overall, I'm in favor of simplifications like these; fully 
constant-propagating these means simpler code paths and fewer 
opportunities for bad assumptions.  And simplifications often beget 
further simplifications.  The only reason I can think of to hesitate is 
if we think we're going to bring back some of these specific options in 
the future; then the historical context might be lost.

Maybe a block of comments in Source/Target outlining some of the 
historical anomalies might help preserve the history without infecting 
the code.

On 1/15/2014 11:49 PM, Joe Darcy wrote:
> PS To provide a little more context around this, our overall policy is
> now to retire sufficiently old -source and -target options:
>
>      Policy for Retiring javac -source and -target Options
>      http://openjdk.java.net/jeps/182
>
> In JDK 9, source/target options {6/1.6, 7/1.7, 8/1.8, 9/1.9} will be
> supported. One of the benefits is allowing simplifications in javac. The
> types used for source and target modeling in javac define a number of
> predicates, "allowFoo", whose contents tend to be one-line version
> checks "return version >= VERSION_INTRODUCING_FEATURE;". A trivial way
> to implement the predicates is to make them unconditionally return true
> or false, as appropriate, after the old source/target values are dropped.
>
> However, it is of course more interesting if these newly-constant
> results get constant propagated into the javac code base so that now
> effectively-dead code in javac can be deleted. We had a little of this
> effect in JDK 8 when several never-documented targets were removed:
>
>      JDK-8010179: Remove transitional target values from javac
>      http://hg.openjdk.java.net/jdk8/tl/langtools/rev/a4913ea9bb62
>
> However, the code deletion in javac can be expected to be much bigger
> when generics can assumed to be present.
>
> As a secondary effect, some messages reported by the compiler will no
> longer be reported so there will be fewer messages to localize and
> maintain.
>
> Comments?
>
> Thanks,
>
> -Joe
>
> On 1/14/2014 5:01 PM, Joe Darcy wrote:
>> Hello,
>>
>> Please review my fix for
>>
>>     JDK-8031745 : Remove unneeded/obsolete -source/-target options in
>> javac tests, part 1
>>     http://cr.openjdk.java.net/~darcy/8031745.0/
>>
>> This covers about half of the relevant javac test files; I'm making
>> progress on the other half. With these changes, all langtools
>> regression tests still pass.
>>
>> Full patch below.
>>
>> Thanks,
>>
>> -Joe
>>
>> --- old/test/tools/apt/Basics/CheckAptIsRemovedTest.java 2014-01-14
>> 16:50:13.000000000 -0800
>> +++ new/test/tools/apt/Basics/CheckAptIsRemovedTest.java 2014-01-14
>> 16:50:13.000000000 -0800
>> @@ -1,5 +1,5 @@
>>  /*
>> - * Copyright (c) 2013, Oracle and/or its affiliates. All rights
>> reserved.
>> + * Copyright (c) 2013, 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
>> @@ -87,7 +87,7 @@
>>          Path classpath = Paths.get(testJDK, "lib", "tools.jar");
>>          ToolBox.JavaToolArgs javacArgs =
>>                  new ToolBox.JavaToolArgs(ToolBox.Expect.FAIL)
>> -                .setOptions("-source", "1.5", "-sourcepath", ".",
>> +                .setOptions("-sourcepath", ".",
>>                      "-classpath", classpath.toString())
>>                  .setSources(NullAPFSrc);
>>          ToolBox.javac(javacArgs);
>> --- old/test/tools/javac/6341866/T6341866.java    2014-01-14
>> 16:50:14.000000000 -0800
>> +++ new/test/tools/javac/6341866/T6341866.java    2014-01-14
>> 16:50:13.000000000 -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", "-Xlint:-options"));
>> +        opts.addAll(Arrays.asList("-d", ".", "-sourcepath", testSrc,
>> "-classpath", testClasses, "-Xlint:-options"));
>>          if (implicitType.opt != null)
>>              opts.add(implicitType.opt);
>>
>> --- old/test/tools/javac/ClassFileModifiers/MemberModifiers.java
>> 2014-01-14 16:50:14.000000000 -0800
>> +++ new/test/tools/javac/ClassFileModifiers/MemberModifiers.java
>> 2014-01-14 16:50:14.000000000 -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.5
>> -Xlint:-options -XDdumpmodifiers=cfm MemberModifiers.java
>> + * @compile/ref=MemberModifiers.out -XDdumpmodifiers=cfm
>> MemberModifiers.java
>>   */
>>
>>  // Currently, we check only that members of final classes are not final.
>> --- old/test/tools/javac/ConditionalArgTypes_1.java    2014-01-14
>> 16:50:14.000000000 -0800
>> +++ new/test/tools/javac/ConditionalArgTypes_1.java    2014-01-14
>> 16:50:14.000000000 -0800
>> @@ -1,5 +1,5 @@
>>  /*
>> - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights
>> reserved.
>> + * Copyright (c) 2000, 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
>> @@ -27,7 +27,6 @@
>>   * @summary Verify that both branches of a conditional expression
>> must agree in type.
>>   * @author maddox
>>   *
>> - * @compile/fail -source 1.4 ConditionalArgTypes_1.java
>>   * @compile                  ConditionalArgTypes_1.java
>>   */
>>
>> --- old/test/tools/javac/T6394563.java    2014-01-14
>> 16:50:15.000000000 -0800
>> +++ new/test/tools/javac/T6394563.java    2014-01-14
>> 16:50:15.000000000 -0800
>> @@ -4,12 +4,7 @@
>>   * @summary javac ignores -nowarn switch in 1.5.0_06 for deprecation
>> warnings
>>   *
>>   * @compile/ref=T6394563.note.out  -XDrawDiagnostics
>> -nowarn             T6394563.java
>> - * @compile/ref=T6394563.note.out  -XDrawDiagnostics -nowarn -source
>> 1.5 T6394563.java
>> - * @compile/ref=T6394563.empty.out -XDrawDiagnostics -nowarn -source
>> 1.4 T6394563.java
>> - *
>> - * @compile/ref=T6394563.warn.out  -XDrawDiagnostics -Xlint
>> -nowarn             T6394563.java
>> - * @compile/ref=T6394563.warn.out  -XDrawDiagnostics -Xlint -nowarn
>> -source 1.5 T6394563.java
>> - * @compile/ref=T6394563.empty.out -XDrawDiagnostics -Xlint -nowarn
>> -source 1.4 T6394563.java
>> + * @compile/ref=T6394563.warn.out  -XDrawDiagnostics -Xlint
>> -nowarn      T6394563.java
>>   */
>>
>>  class T6394563 {
>> --- old/test/tools/javac/T6394563.warn.out    2014-01-14
>> 16:50:15.000000000 -0800
>> +++ new/test/tools/javac/T6394563.warn.out    2014-01-14
>> 16:50:15.000000000 -0800
>> @@ -1,2 +1,2 @@
>> -T6394563.java:17:19: compiler.warn.has.been.deprecated: foo(),
>> deprecated
>> +T6394563.java:12:19: compiler.warn.has.been.deprecated: foo(),
>> deprecated
>>  1 warning
>> --- old/test/tools/javac/api/T6306137.java    2014-01-14
>> 16:50:15.000000000 -0800
>> +++ new/test/tools/javac/api/T6306137.java    2014-01-14
>> 16:50:15.000000000 -0800
>> @@ -76,7 +76,7 @@
>>      }
>>      void test(String encoding, boolean good) {
>>          error = false;
>> -        Iterable<String> args = Arrays.asList("-source", "6",
>> "-encoding", encoding, "-d", ".");
>> +        Iterable<String> args = Arrays.asList("-encoding", encoding,
>> "-d", ".");
>>          compiler.getTask(null, fm, dl, args, null, files).call();
>>          if (error == good) {
>>              if (error) {
>> --- old/test/tools/javac/api/TestGetElementReference.java 2014-01-14
>> 16:50:16.000000000 -0800
>> +++ new/test/tools/javac/api/TestGetElementReference.java 2014-01-14
>> 16:50:16.000000000 -0800
>> @@ -52,7 +52,7 @@
>>          File source = new File(System.getProperty("test.src", "."),
>> "TestGetElementReferenceData.java").getAbsoluteFile();
>>          StandardJavaFileManager fm =
>> ToolProvider.getSystemJavaCompiler().getStandardFileManager(null,
>> null, null);
>>          DiagnosticCollector<JavaFileObject> diagnostics = new
>> DiagnosticCollector<>();
>> -        JavacTask ct = (JavacTask)
>> ToolProvider.getSystemJavaCompiler().getTask(null, null, diagnostics,
>> Arrays.asList("-Xjcov", "-source", "1.8"), null,
>> fm.getJavaFileObjects(source));
>> +        JavacTask ct = (JavacTask)
>> ToolProvider.getSystemJavaCompiler().getTask(null, null, diagnostics,
>> Arrays.asList("-Xjcov"), null, fm.getJavaFileObjects(source));
>>          Trees trees = Trees.instance(ct);
>>          CompilationUnitTree cut = ct.parse().iterator().next();
>>
>> --- old/test/tools/javac/lambda/ByteCodeTest.java    2014-01-14
>> 16:50:17.000000000 -0800
>> +++ new/test/tools/javac/lambda/ByteCodeTest.java    2014-01-14
>> 16:50:17.000000000 -0800
>> @@ -122,7 +122,7 @@
>>
>>      static File compile(File f) {
>>          int rc = com.sun.tools.javac.Main.compile(new String[] {
>> -                "-source", "1.8", "-g", f.getPath() });
>> +                "-g", f.getPath() });
>>          if (rc != 0)
>>                  throw new Error("compilation failed. rc=" + rc);
>>              String path = f.getPath();
>> --- old/test/tools/javac/processing/environment/TestSourceVersion.java
>> 2014-01-14 16:50:17.000000000 -0800
>> +++ new/test/tools/javac/processing/environment/TestSourceVersion.java
>> 2014-01-14 16:50:17.000000000 -0800
>> @@ -1,5 +1,5 @@
>>  /*
>> - * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights
>> reserved.
>> + * Copyright (c) 2006, 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
>> @@ -23,21 +23,20 @@
>>
>>  /*
>>   * @test
>> - * @bug 6402506
>> + * @bug 6402506 8028545 8028543
>>   * @summary Test that getSourceVersion works properly
>>   * @author  Joseph D. Darcy
>>   * @library /tools/javac/lib
>>   * @build   JavacTestingAbstractProcessor
>>   * @compile TestSourceVersion.java
>> - * @compile -processor TestSourceVersion -proc:only -source 1.2
>> -AExpectedVersion=RELEASE_2 HelloWorld.java
>> - * @compile -processor TestSourceVersion -proc:only -source 1.3
>> -AExpectedVersion=RELEASE_3 HelloWorld.java
>> - * @compile -processor TestSourceVersion -proc:only -source 1.4
>> -AExpectedVersion=RELEASE_4 HelloWorld.java
>> - * @compile -processor TestSourceVersion -proc:only -source 1.5
>> -AExpectedVersion=RELEASE_5 HelloWorld.java
>> - * @compile -processor TestSourceVersion -proc:only -source   5
>> -AExpectedVersion=RELEASE_5 HelloWorld.java
>>   * @compile -processor TestSourceVersion -proc:only -source 1.6
>> -AExpectedVersion=RELEASE_6 HelloWorld.java
>>   * @compile -processor TestSourceVersion -proc:only -source   6
>> -AExpectedVersion=RELEASE_6 HelloWorld.java
>>   * @compile -processor TestSourceVersion -proc:only -source 1.7
>> -AExpectedVersion=RELEASE_7 HelloWorld.java
>>   * @compile -processor TestSourceVersion -proc:only -source   7
>> -AExpectedVersion=RELEASE_7 HelloWorld.java
>> + * @compile -processor TestSourceVersion -proc:only -source 1.8
>> -AExpectedVersion=RELEASE_8 HelloWorld.java
>> + * @compile -processor TestSourceVersion -proc:only -source   8
>> -AExpectedVersion=RELEASE_8 HelloWorld.java
>> + * @compile -processor TestSourceVersion -proc:only -source 1.9
>> -AExpectedVersion=RELEASE_9 HelloWorld.java
>> + * @compile -processor TestSourceVersion -proc:only -source   9
>> -AExpectedVersion=RELEASE_9 HelloWorld.java
>>   */
>>
>>  import java.util.Set;
>> ---
>> old/test/tools/javac/processing/warnings/TestSourceVersionWarnings.java 2014-01-14
>> 16:50:17.000000000 -0800
>> +++
>> new/test/tools/javac/processing/warnings/TestSourceVersionWarnings.java 2014-01-14
>> 16:50:17.000000000 -0800
>> @@ -27,11 +27,7 @@
>>   * @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 -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_0.out             -XDrawDiagnostics -processor
>> TestSourceVersionWarnings -proc:only -source 1.6 -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
>> --- old/test/tools/javac/stackmap/StackMapTest.java    2014-01-14
>> 16:50:18.000000000 -0800
>> +++ new/test/tools/javac/stackmap/StackMapTest.java    2014-01-14
>> 16:50:18.000000000 -0800
>> @@ -27,7 +27,7 @@
>>   * @summary The "method0" StackMap attribute should have two entries
>> instead of three
>>   * @library /tools/javac/lib
>>   * @build ToolBox
>> - * @run compile -source 6 -target 6 StackMapTest.java
>> + * @run compile StackMapTest.java
>>   * @run main StackMapTest
>>   */
>>
>> @@ -48,7 +48,7 @@
>>      }
>>
>>      public static void main(String args[]) throws Exception {
>> -//    "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -source 6
>> -target 6 T4955930.java
>> +//    "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} T4955930.java
>>
>>  //    "${TESTJAVA}${FS}bin${FS}javap" ${TESTTOOLVMOPTS} -verbose
>> T4955930 > ${TMP1}
>>          Path pathToClass = Paths.get(System.getProperty("test.classes"),
>> --- old/test/tools/javac/unicode/Unmappable.java    2014-01-14
>> 16:50:18.000000000 -0800
>> +++ new/test/tools/javac/unicode/Unmappable.java    2014-01-14
>> 16:50:18.000000000 -0800
>> @@ -27,8 +27,6 @@
>>   * @summary diagnose encoding errors in Java source files
>>   * @author gafter
>>   *
>> - * @compile              -encoding ascii -source 1.5 Unmappable.java
>> - * @compile/fail -Werror -encoding ascii -source 1.5 Unmappable.java
>>   * @compile/fail         -encoding ascii Unmappable.java
>>   */
>>
>> --- old/test/tools/javap/output/Tester.java    2014-01-14
>> 16:50:19.000000000 -0800
>> +++ new/test/tools/javap/output/Tester.java    2014-01-14
>> 16:50:19.000000000 -0800
>> @@ -1,5 +1,5 @@
>>  /*
>> - * Copyright (c) 2013, Oracle and/or its affiliates. All rights
>> reserved.
>> + * Copyright (c) 2013, 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
>> @@ -271,7 +271,7 @@
>>       */
>>      protected void compileTestFile() {
>>          String path = javaFile.getPath();
>> -        String params[] =  { "-source", "1.8", "-g", path };
>> +        String params[] =  {"-g", path };
>>          int rc = com.sun.tools.javac.Main.compile(params);
>>          if (rc != 0)
>>              throw new Error("compilation failed. rc=" + rc);
>> --- old/test/tools/javap/typeAnnotations/JSR175Annotations.java
>> 2014-01-14 16:50:19.000000000 -0800
>> +++ new/test/tools/javap/typeAnnotations/JSR175Annotations.java
>> 2014-01-14 16:50:19.000000000 -0800
>> @@ -1,5 +1,5 @@
>>  /*
>> - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights
>> reserved.
>> + * Copyright (c) 2008, 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
>> @@ -114,7 +114,7 @@
>>      }
>>
>>      File compileTestFile(File f) {
>> -        int rc = com.sun.tools.javac.Main.compile(new String[] {
>> "-source", "1.8", "-g", f.getPath() });
>> +        int rc = com.sun.tools.javac.Main.compile(new String[] {"-g",
>> f.getPath() });
>>          if (rc != 0)
>>              throw new Error("compilation failed. rc=" + rc);
>>          String path = f.getPath();
>> --- old/test/tools/javap/typeAnnotations/NewArray.java 2014-01-14
>> 16:50:19.000000000 -0800
>> +++ new/test/tools/javap/typeAnnotations/NewArray.java 2014-01-14
>> 16:50:19.000000000 -0800
>> @@ -1,5 +1,5 @@
>>  /*
>> - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights
>> reserved.
>> + * Copyright (c) 2008, 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
>> @@ -102,7 +102,7 @@
>>      }
>>
>>      File compileTestFile(File f) {
>> -        int rc = com.sun.tools.javac.Main.compile(new String[] {
>> "-source", "1.8", "-g", f.getPath() });
>> +        int rc = com.sun.tools.javac.Main.compile(new String[] {"-g",
>> f.getPath() });
>>          if (rc != 0)
>>              throw new Error("compilation failed. rc=" + rc);
>>          String path = f.getPath();
>> --- old/test/tools/javap/typeAnnotations/Presence.java 2014-01-14
>> 16:50:20.000000000 -0800
>> +++ new/test/tools/javap/typeAnnotations/Presence.java 2014-01-14
>> 16:50:20.000000000 -0800
>> @@ -1,5 +1,5 @@
>>  /*
>> - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights
>> reserved.
>> + * Copyright (c) 2008, 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
>> @@ -180,7 +180,7 @@
>>      }
>>
>>      File compileTestFile(File f) {
>> -        int rc = com.sun.tools.javac.Main.compile(new String[] {
>> "-source", "1.8", "-g", f.getPath() });
>> +        int rc = com.sun.tools.javac.Main.compile(new String[] {"-g",
>> f.getPath() });
>>          if (rc != 0)
>>              throw new Error("compilation failed. rc=" + rc);
>>          String path = f.getPath();
>> --- old/test/tools/javap/typeAnnotations/PresenceInner.java 2014-01-14
>> 16:50:20.000000000 -0800
>> +++ new/test/tools/javap/typeAnnotations/PresenceInner.java 2014-01-14
>> 16:50:20.000000000 -0800
>> @@ -1,5 +1,5 @@
>>  /*
>> - * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights
>> reserved.
>> + * Copyright (c) 2009, 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
>> @@ -149,7 +149,7 @@
>>      }
>>
>>      File compileTestFile(File f) {
>> -        int rc = com.sun.tools.javac.Main.compile(new String[] {
>> "-source", "1.8", "-g", f.getPath() });
>> +        int rc = com.sun.tools.javac.Main.compile(new String[] {"-g",
>> f.getPath() });
>>          if (rc != 0)
>>              throw new Error("compilation failed. rc=" + rc);
>>          String path = f.getPath();
>> --- old/test/tools/javap/typeAnnotations/TypeCasts.java 2014-01-14
>> 16:50:20.000000000 -0800
>> +++ new/test/tools/javap/typeAnnotations/TypeCasts.java 2014-01-14
>> 16:50:20.000000000 -0800
>> @@ -1,5 +1,5 @@
>>  /*
>> - * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights
>> reserved.
>> + * Copyright (c) 2009, 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
>> @@ -117,7 +117,7 @@
>>      }
>>
>>      File compileTestFile(File f) {
>> -        int rc = com.sun.tools.javac.Main.compile(new String[] {
>> "-source", "1.8", "-g", f.getPath() });
>> +        int rc = com.sun.tools.javac.Main.compile(new String[] {"-g",
>> f.getPath() });
>>          if (rc != 0)
>>              throw new Error("compilation failed. rc=" + rc);
>>          String path = f.getPath();
>> --- old/test/tools/javap/typeAnnotations/Visibility.java 2014-01-14
>> 16:50:21.000000000 -0800
>> +++ new/test/tools/javap/typeAnnotations/Visibility.java 2014-01-14
>> 16:50:21.000000000 -0800
>> @@ -1,5 +1,5 @@
>>  /*
>> - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights
>> reserved.
>> + * Copyright (c) 2008, 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
>> @@ -108,7 +108,7 @@
>>      }
>>
>>      File compileTestFile(File f) {
>> -      int rc = com.sun.tools.javac.Main.compile(new String[] {
>> "-source", "1.8", "-g", f.getPath() });
>> +      int rc = com.sun.tools.javac.Main.compile(new String[] {"-g",
>> f.getPath() });
>>          if (rc != 0)
>>              throw new Error("compilation failed. rc=" + rc);
>>          String path = f.getPath();
>> --- old/test/tools/javap/typeAnnotations/Wildcards.java 2014-01-14
>> 16:50:22.000000000 -0800
>> +++ new/test/tools/javap/typeAnnotations/Wildcards.java 2014-01-14
>> 16:50:22.000000000 -0800
>> @@ -1,5 +1,5 @@
>>  /*
>> - * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights
>> reserved.
>> + * Copyright (c) 2009, 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
>> @@ -139,7 +139,7 @@
>>      }
>>
>>      File compileTestFile(File f) {
>> -        int rc = com.sun.tools.javac.Main.compile(new String[] {
>> "-source", "1.8", "-g", f.getPath() });
>> +        int rc = com.sun.tools.javac.Main.compile(new String[] {"-g",
>> f.getPath() });
>>          if (rc != 0)
>>              throw new Error("compilation failed. rc=" + rc);
>>          String path = f.getPath();
>> --- old/test/tools/javac/Capture.java    2014-01-14 16:50:22.000000000
>> -0800
>> +++ /dev/null    2014-01-13 10:19:39.230183767 -0800
>> @@ -1,46 +0,0 @@
>> -/*
>> - * Copyright (c) 2002, 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.
>> - */
>> -
>> -/*
>> - * @test
>> - * @bug 4441338 4994508
>> - * @summary Captured variable synthetic parameters should be passed
>> before explicit params.
>> - * @author gafter
>> - *
>> - * @compile -source 1.4 -target 1.4 Capture.java
>> - * @run main Capture
>> - */
>> -
>> -public class Capture {
>> -    final int k;
>> -    Capture(int n) {
>> -        k = n;
>> -    }
>> -    public static void main(String args[]) {
>> -        final int j;
>> -        int k1 = new Capture(2 + (j=3)){
>> -                         int get () {return k+j;}
>> -                     }.get();
>> -        if (k1 != 8) throw new Error("k1 = " + k1);
>> -    }
>> -}
>> --- old/test/tools/javac/Source5.java    2014-01-14 16:50:23.000000000
>> -0800
>> +++ /dev/null    2014-01-13 10:19:39.230183767 -0800
>> @@ -1,39 +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.
>> - */
>> -
>> -/*
>> - * @test
>> - * @bug 5044157
>> - * @summary please accept -source 5 and -target 5
>> - * @author Peter von der Ahé
>> - *
>> - * @compile -source 5 -target 5 -encoding iso-8859-1 Source5.java
>> - * @run main Source5
>> - */
>> -
>> -public enum Source5 {
>> -    JDK5;
>> -    public static void main(String[] args) {
>> -        System.out.println("Hello, world!");
>> -    }
>> -}
>> --- old/test/tools/javac/processing/warnings/gold_sv_warn_0_2.out
>> 2014-01-14 16:50:23.000000000 -0800
>> +++ /dev/null    2014-01-13 10:19:39.230183767 -0800
>> @@ -1,2 +0,0 @@
>> -- compiler.warn.proc.processor.incompatible.source.version:
>> RELEASE_0, TestSourceVersionWarnings, 1.2
>> -1 warning
>> --- old/test/tools/javac/processing/warnings/gold_sv_warn_2_3.out
>> 2014-01-14 16:50:23.000000000 -0800
>> +++ /dev/null    2014-01-13 10:19:39.230183767 -0800
>> @@ -1,2 +0,0 @@
>> -- compiler.warn.proc.processor.incompatible.source.version:
>> RELEASE_2, TestSourceVersionWarnings, 1.3
>> -1 warning
>> --- old/test/tools/javac/varargs/warning/Warn1.java    2014-01-14
>> 16:50:23.000000000 -0800
>> +++ /dev/null    2014-01-13 10:19:39.230183767 -0800
>> @@ -1,42 +0,0 @@
>> -/*
>> - * Copyright (c) 2004, 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 5035307
>> - * @summary fixed-arity warning given too often
>> - * @author gafter
>> - *
>> - * @compile -Werror -source 1.4 -Xlint:-options Warn1.java
>> - */
>> -
>> -package varargs.warning.warn1;
>> -
>> -import java.util.List;
>> -import java.util.Arrays;
>> -
>> -class Warn1 {
>> -    void f(String[] args) {
>> -        List l = java.util.Arrays.asList(args);
>> -    }
>> -}
>>
>


More information about the compiler-dev mailing list