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

Reviewed-by: jjg, sogoel
This commit is contained in:
Joe Darcy 2014-01-16 18:00:25 -08:00
parent 9a0f6ed18e
commit 87dec1fa1a
26 changed files with 35 additions and 179 deletions

View File

@ -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 @@ public class CheckAptIsRemovedTest {
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);

View File

@ -97,7 +97,7 @@ public class T6341866 {
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);

View File

@ -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);
}
}

View File

@ -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.

View File

@ -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
*/

View File

@ -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!");
}
}

View File

@ -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 {

View File

@ -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

View File

@ -76,7 +76,7 @@ public class T6306137 {
}
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) {

View File

@ -52,7 +52,7 @@ public class TestGetElementReference {
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();

View File

@ -122,7 +122,7 @@ public class ByteCodeTest {
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();

View File

@ -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;

View File

@ -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

View File

@ -1,2 +0,0 @@
- compiler.warn.proc.processor.incompatible.source.version: RELEASE_0, TestSourceVersionWarnings, 1.2
1 warning

View File

@ -1,2 +0,0 @@
- compiler.warn.proc.processor.incompatible.source.version: RELEASE_2, TestSourceVersionWarnings, 1.3
1 warning

View File

@ -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 class StackMapTest {
}
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"),

View File

@ -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
*/

View File

@ -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);
}
}

View File

@ -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 @@ public abstract class Tester {
*/
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);

View File

@ -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 @@ public class JSR175Annotations {
}
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();

View File

@ -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 @@ public class NewArray {
}
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();

View File

@ -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 @@ public class Presence {
}
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();

View File

@ -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 @@ public class PresenceInner {
}
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();

View File

@ -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 @@ public class TypeCasts {
}
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();

View File

@ -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 @@ public class Visibility {
}
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();

View File

@ -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 @@ public class Wildcards {
}
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();