8036842: Remove unneeded/obsolete -source/-target options in javac tests, part 2

Reviewed-by: jjg, sogoel
This commit is contained in:
Joe Darcy 2014-03-07 13:30:23 -08:00
parent 16962804f3
commit e5fb7f77d6
58 changed files with 29 additions and 3379 deletions

View file

@ -1,245 +0,0 @@
/*
* Copyright (c) 2007, 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 6464451
* @summary javac in 5.0ux can not compile try-finally block which has a lot of "return"
* @author Wei Tao
* @compile -source 5 -target 5 BigFinally.java
* @clean BigFinally
* @compile/fail BigFinally.java
*/
public class BigFinally {
static public int func(int i) {
try {
if(i == 1) return 1;
} finally {
try {
if(i == 2) return 2;
if(i == 3 ) return 3;
if(i == 4 ) return 4;
if(i == 5 ) return 5;
if(i == 6 ) return 6;
if(i == 7 ) return 7;
if(i == 8 ) return 8;
if(i == 9 ) return 9;
if(i == 10 ) return 10;
if(i == 11 ) return 11;
if(i == 12 ) return 12;
if(i == 13 ) return 13;
if(i == 14 ) return 14;
if(i == 15 ) return 15;
if(i == 16 ) return 16;
if(i == 17 ) return 17;
if(i == 18 ) return 18;
if(i == 19 ) return 19;
if(i == 20 ) return 20;
if(i == 21 ) return 21;
if(i == 22 ) return 22;
if(i == 23 ) return 23;
if(i == 24 ) return 24;
if(i == 25 ) return 25;
if(i == 26 ) return 26;
if(i == 27 ) return 27;
if(i == 28 ) return 28;
if(i == 29 ) return 29;
if(i == 30 ) return 30;
if(i == 31 ) return 31;
if(i == 32 ) return 32;
if(i == 33 ) return 33;
if(i == 34 ) return 34;
if(i == 35 ) return 35;
if(i == 36 ) return 36;
if(i == 37 ) return 37;
if(i == 38 ) return 38;
if(i == 39 ) return 39;
if(i == 40 ) return 40;
if(i == 41 ) return 41;
if(i == 42 ) return 42;
if(i == 43 ) return 43;
if(i == 44 ) return 44;
if(i == 45 ) return 45;
if(i == 46 ) return 46;
if(i == 47 ) return 47;
if(i == 48 ) return 48;
if(i == 49 ) return 49;
if(i == 50 ) return 50;
if(i == 51 ) return 51;
if(i == 52 ) return 52;
if(i == 53 ) return 53;
if(i == 54 ) return 54;
if(i == 55 ) return 55;
if(i == 56 ) return 56;
if(i == 57 ) return 57;
if(i == 58 ) return 58;
if(i == 59 ) return 59;
if(i == 60 ) return 60;
if(i == 61 ) return 61;
if(i == 62 ) return 62;
if(i == 63 ) return 63;
if(i == 64 ) return 64;
if(i == 65 ) return 65;
if(i == 66 ) return 66;
if(i == 67 ) return 67;
if(i == 68 ) return 68;
if(i == 69 ) return 69;
if(i == 70 ) return 70;
if(i == 71 ) return 71;
if(i == 72 ) return 72;
if(i == 73 ) return 73;
if(i == 74 ) return 74;
if(i == 75 ) return 75;
if(i == 76 ) return 76;
if(i == 77 ) return 77;
if(i == 78 ) return 78;
if(i == 79 ) return 79;
if(i == 80 ) return 80;
if(i == 81 ) return 81;
if(i == 82 ) return 82;
if(i == 83 ) return 83;
if(i == 84 ) return 84;
if(i == 85 ) return 85;
if(i == 86 ) return 86;
if(i == 87 ) return 87;
if(i == 88 ) return 88;
if(i == 89 ) return 89;
if(i == 90 ) return 90;
if(i == 91 ) return 91;
if(i == 92 ) return 92;
if(i == 93 ) return 93;
if(i == 94 ) return 94;
if(i == 95 ) return 95;
if(i == 96 ) return 96;
if(i == 97 ) return 97;
if(i == 98 ) return 98;
if(i == 99 ) return 99;
if(i == 100 ) return 100;
} finally {
int x = 0;
x += 1;
x += 2;
x += 3;
x += 4;
x += 5;
x += 6;
x += 7;
x += 8;
x += 9;
x += 10;
x += 11;
x += 12;
x += 13;
x += 14;
x += 15;
x += 16;
x += 17;
x += 18;
x += 19;
x += 20;
x += 21;
x += 22;
x += 23;
x += 24;
x += 25;
x += 26;
x += 27;
x += 28;
x += 29;
x += 30;
x += 31;
x += 32;
x += 33;
x += 34;
x += 35;
x += 36;
x += 37;
x += 38;
x += 39;
x += 40;
x += 41;
x += 42;
x += 43;
x += 44;
x += 45;
x += 46;
x += 47;
x += 48;
x += 49;
x += 50;
x += 51;
x += 52;
x += 53;
x += 54;
x += 55;
x += 56;
x += 57;
x += 58;
x += 59;
x += 60;
x += 61;
x += 62;
x += 63;
x += 64;
x += 65;
x += 66;
x += 67;
x += 68;
x += 69;
x += 70;
x += 71;
x += 72;
x += 73;
x += 74;
x += 75;
x += 76;
x += 77;
x += 78;
x += 79;
x += 80;
x += 81;
x += 82;
x += 83;
x += 84;
x += 85;
x += 86;
x += 87;
x += 88;
x += 89;
x += 90;
x += 91;
x += 92;
x += 93;
x += 94;
x += 95;
x += 96;
x += 97;
x += 98;
x += 99;
x += 100;
}
}
return 0;
}
}

View file

@ -1,76 +0,0 @@
/*
* Copyright (c) 2007, 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 6464451
* @summary javac in 5.0ux can not compile try-finally block which has a lot of "return"
* @author Wei Tao
* @compile -source 5 -target 5 DeepNestedFinally.java
* @clean DeepNestedFinally
* @compile/fail DeepNestedFinally.java
*/
public class DeepNestedFinally {
static public int func(int i) {
try {
if(i == 1) return 1;
} finally {
try {
if(i == 2) return 2;
} finally {
try {
if(i == 3) return 3;
} finally {
try {
if(i == 4) return 4;
} finally {
try {
if(i == 5) return 5;
} finally {
try {
if(i == 6) return 6;
} finally {
try {
if (i == 7) return 7;
} finally {
int x = 0;
x += 1;
x += 2;
x += 3;
x += 4;
x += 5;
x += 6;
x += 7;
x += 8;
x += 9;
}
}
}
}
}
}
}
return 0;
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,43 +0,0 @@
/*
* Copyright (c) 1999, 2001, 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 4267335
* @summary Verify that code generated for Array.clone() with -target 1.2 passes verifier.
* @author maddox
*
* @run compile -source 1.3 -target 1.2 ArrayCloneCodeGen.java
* @run main/othervm -Xverify:all ArrayCloneCodeGen
*/
public class ArrayCloneCodeGen {
public static void main(String[] args) {}
private String[] args = null;
public String[] getArgs() {
return (String []) (args.clone());
}
}

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -26,9 +26,6 @@
* @bug 4884387 * @bug 4884387
* @summary Use ldc instruction for class literals * @summary Use ldc instruction for class literals
* @author gafter * @author gafter
*
* @compile -source 1.5 -target 1.5 ClassLit.java
* @run main ClassLit
*/ */
public class ClassLit { public class ClassLit {

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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * 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. * @summary Verify that both branches of a conditional expression must agree in type.
* @author maddox * @author maddox
* *
* @compile/fail -source 1.4 ConditionalArgTypes_2.java
* @compile ConditionalArgTypes_2.java * @compile ConditionalArgTypes_2.java
*/ */

View file

@ -1,49 +0,0 @@
/*
* Copyright (c) 2003, 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 4949627
* @summary javac crashes on code for new rule for semantics of ? without -source 1.5
* @author gafter
*
* @compile -source 1.4 ConditionalClass.java
*/
package conditional.clazz;
class A{}
class B{}
public class ConditionalClass {
void foo(){
boolean b = false;
Class a = b ? A.class : B.class;
System.out.println("a is " + a.getName());
}
public static void main(String[] args)
{
new ConditionalClass().foo();
}
}

View file

@ -27,7 +27,7 @@
* @summary StackOverflowError from javac * @summary StackOverflowError from javac
* @author gafter * @author gafter
* *
* @compile -source 1.5 -target 1.5 JsrRet.java * @compile JsrRet.java
*/ */
package jsr.ret; package jsr.ret;

View file

@ -1,36 +0,0 @@
/*
* Copyright (c) 2001, 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 4313429
* @summary Compiling <Classname>.class on CLDC crashed the compiler.
*
* @compile/fail -source 1.4 -target 1.4 -XDfailcomplete=java.lang.NoClassDefFoundError NoNoClassDefFoundErrorError.java
*/
class NoNoClassDefFoundErrorError {
public static void main() {
Class self = NoNoClassDefFoundErrorError.class;
}
}

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -26,9 +26,6 @@
* @bug 6266772 * @bug 6266772
* @summary javac crashes, assertion failure in Lower.java * @summary javac crashes, assertion failure in Lower.java
* @author Peter von der Ah\u00e9 * @author Peter von der Ah\u00e9
* @compile/fail -source 1.4 T6266772.java
* @compile T6266772.java
* @run main T6266772
*/ */
public class T6266772 { public class T6266772 {

View file

@ -1,45 +0,0 @@
/*
* Copyright (c) 2007, 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 6557865
* @summary -source 5 -target 5 should not put ACC_SYNTHETIC on package-info
* @author Wei Tao
* @compile T6557865.java
* @compile -source 5 -target 5 T6232928/package-info.java
* @run main T6557865
*/
import java.io.*;
import java.lang.reflect.Modifier;
public class T6557865 {
public static void main(String... args) throws Exception {
Class pkginfo_cls = Class.forName("T6232928.package-info");
int mod = pkginfo_cls.getModifiers();
if ((mod & 0x1000) != 0) {
throw new AssertionError("Test failed: interface package-info shouldn't be synthetic in -target 5.");
}
}
}

View file

@ -29,7 +29,6 @@
* @author maddox (cribbed from bracha/lillibridge) gafter * @author maddox (cribbed from bracha/lillibridge) gafter
* *
* @compile UplevelFromAnonInSuperCall.java * @compile UplevelFromAnonInSuperCall.java
* @compile/fail -source 1.4 UplevelFromAnonInSuperCall.java
*/ */
class UplevelFromAnonInSuperCall { class UplevelFromAnonInSuperCall {

View file

@ -27,7 +27,6 @@
* @summary Please add annotation <at>Deprecated to supplant the javadoc tag * @summary Please add annotation <at>Deprecated to supplant the javadoc tag
* @author gafter * @author gafter
* *
* @compile -source 1.4 -Xlint:-options -Xlint:dep-ann -Werror Dep.java
* @compile/fail -Xlint:dep-ann -Werror Dep.java * @compile/fail -Xlint:dep-ann -Werror Dep.java
* @compile -Xlint:dep-ann Dep.java * @compile -Xlint:dep-ann Dep.java
*/ */

View file

@ -1,35 +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 5036565
* @summary Annotations definitions are allowed using -source 1.4 but not annotations
* @author gafter
*
* @compile/fail -source 1.4 MixedSource.java
*/
package mixed.source;
@interface foo {}

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -49,7 +49,7 @@ public class ClassfileTestHelper {
File compile(File f) { File compile(File f) {
int rc = com.sun.tools.javac.Main.compile(new String[] { int rc = com.sun.tools.javac.Main.compile(new String[] {
"-source", "1.8", "-g", f.getPath() }); "-g", f.getPath() });
if (rc != 0) if (rc != 0)
throw new Error("compilation failed. rc=" + rc); throw new Error("compilation failed. rc=" + rc);
String path = f.getPath(); 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -146,7 +146,7 @@ public class NoTargetAnnotations {
} }
File compileTestFile(File f) { File compileTestFile(File f) {
int rc = com.sun.tools.javac.Main.compile(new String[] { "-XDTA:writer", "-source", "1.8", "-g", f.getPath() }); int rc = com.sun.tools.javac.Main.compile(new String[] { "-XDTA:writer", "-g", f.getPath() });
if (rc != 0) if (rc != 0)
throw new Error("compilation failed. rc=" + rc); throw new Error("compilation failed. rc=" + rc);
String path = f.getPath(); String path = f.getPath();

View file

@ -180,7 +180,6 @@ public class Driver {
protected File compileTestFile(File f, String testClass, String... extraParams) { protected File compileTestFile(File f, String testClass, String... extraParams) {
List<String> options = new ArrayList<>(); List<String> options = new ArrayList<>();
options.addAll(Arrays.asList("-source", "1.8"));
options.addAll(Arrays.asList(extraParams)); options.addAll(Arrays.asList(extraParams));
options.add(f.getPath()); options.add(f.getPath());
int rc = com.sun.tools.javac.Main.compile(options.toArray(new String[options.size()])); int rc = com.sun.tools.javac.Main.compile(options.toArray(new String[options.size()]));

View file

@ -49,6 +49,6 @@ public class T6265137 {
String srcdir = System.getProperty("test.src"); String srcdir = System.getProperty("test.src");
Iterable<? extends JavaFileObject> files = Iterable<? extends JavaFileObject> files =
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(srcdir, "T6265137a.java"))); fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(srcdir, "T6265137a.java")));
javac.getTask(null, fm, dl, Arrays.asList("-target","1.5"), null, files).call(); javac.getTask(null, fm, dl, Arrays.asList("-target","9"), null, files).call();
} }
} }

View file

@ -1,34 +0,0 @@
/*
* Copyright (c) 2004, 2006, 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 6177400
* @summary Boxing allowed with -source 1.4
* @author Peter von der Ah\u00e9
* @compile/fail -source 1.4 NoBoxingBool.java
*/
public class NoBoxingBool {
Boolean b = false;
}

View file

@ -1,34 +0,0 @@
/*
* Copyright (c) 2004, 2006, 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 6177400
* @summary Boxing allowed with -source 1.4
* @author Peter von der Ah\u00e9
* @compile/fail -source 1.4 NoBoxingByte.java
*/
public class NoBoxingByte {
Byte b = 0;
}

View file

@ -1,34 +0,0 @@
/*
* Copyright (c) 2004, 2006, 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 6177400
* @summary Boxing allowed with -source 1.4
* @author Peter von der Ah\u00e9
* @compile/fail -source 1.4 NoBoxingChar.java
*/
public class NoBoxingChar {
Character c = '\u0000';
}

View file

@ -1,34 +0,0 @@
/*
* Copyright (c) 2004, 2006, 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 6177400
* @summary Boxing allowed with -source 1.4
* @author Peter von der Ah\u00e9
* @compile/fail -source 1.4 NoBoxingDouble.java
*/
public class NoBoxingDouble {
Double d = 0D;
}

View file

@ -1,34 +0,0 @@
/*
* Copyright (c) 2004, 2006, 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 6177400
* @summary Boxing allowed with -source 1.4
* @author Peter von der Ah\u00e9
* @compile/fail -source 1.4 NoBoxingFloat.java
*/
public class NoBoxingFloat {
Float f = 0F;
}

View file

@ -1,34 +0,0 @@
/*
* Copyright (c) 2004, 2006, 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 6177400
* @summary Boxing allowed with -source 1.4
* @author Peter von der Ah\u00e9
* @compile/fail -source 1.4 NoBoxingInt.java
*/
public class NoBoxingInt {
Integer i = 0;
}

View file

@ -1,34 +0,0 @@
/*
* Copyright (c) 2004, 2006, 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 6177400
* @summary Boxing allowed with -source 1.4
* @author Peter von der Ah\u00e9
* @compile/fail -source 1.4 NoBoxingLong.java
*/
public class NoBoxingLong {
Long l = 0L;
}

View file

@ -1,34 +0,0 @@
/*
* Copyright (c) 2004, 2006, 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 6177400
* @summary Boxing allowed with -source 1.4
* @author Peter von der Ah\u00e9
* @compile/fail -source 1.4 NoBoxingShort.java
*/
public class NoBoxingShort {
Short s = 0;
}

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -37,7 +37,7 @@ import java.util.regex.*;
public class ClassVersionChecker { public class ClassVersionChecker {
int errors; int errors;
String[] jdk = {"","1.2","1.3","1.4","1.5","1.6","1.7","1.8"}; String[] jdk = {"","1.6","1.7","1.8"};
File javaFile = null; File javaFile = null;
public static void main(String[] args) throws Throwable { public static void main(String[] args) throws Throwable {
@ -47,7 +47,7 @@ public class ClassVersionChecker {
void run() throws Exception { void run() throws Exception {
writeTestFile(); writeTestFile();
/* Rules applicable for -source and -target combinations /* Rules applicable for -source and -target combinations
* 1. If both empty, version num is for 1.7 * 1. If both empty, version num is for the current release
* 2. If source is not empty and target is empty, version is based on source * 2. If source is not empty and target is empty, version is based on source
* 3. If both non-empty, version is based on target * 3. If both non-empty, version is based on target
*/ */
@ -57,14 +57,10 @@ public class ClassVersionChecker {
* -1 => invalid combinations * -1 => invalid combinations
*/ */
int[][] ver = int[][] ver =
{{52, -1, -1, -1, -1, -1, -1, -1}, {{52, -1, -1, -1},
{48, 46, 47, 48, 49, 50, 51, 52}, {52, 50, 51, 52},
{48, 46, 47, 48, 49, 50, 51, 52}, {52, -1, 51, 52},
{48, -1, -1, 48, 49, 50, 51, 52}, {52, -1, -1, 52}};
{52, -1, -1, -1, 49, 50, 51, 52},
{52, -1, -1, -1, -1, 50, 51, 52},
{52, -1, -1, -1, -1, -1, 51, 52},
{52, -1, -1, -1, -1, -1, -1, 52}};
// Loop to run all possible combinations of source/target values // Loop to run all possible combinations of source/target values
for (int i = 0; i< ver.length; i++) { for (int i = 0; i< ver.length; i++) {

View file

@ -1,24 +0,0 @@
/**
* @test /nodynamiccopyright/
* @bug 6384542
* @summary crash: test/tools/javac/versions/check.sh
* @author Peter von der Ah\u00e9
* @compile/fail -source 1.4 -Xlint:-options T6384542.java
* @compile/fail/ref=T6384542.out -source 1.4 -Xlint:-options -XDrawDiagnostics T6384542.java
*/
import static java.lang.Math.sin;
public enum A { }
class B {
int i = 0xCafe.BabeP1;
List<X> l;
public static void main(String... args) {
for (String arg : args) {
System.out.println(arg);
}
}
@Override
public String toString() { return null; }
}
public klass C { }

View file

@ -1,9 +0,0 @@
T6384542.java:10:8: compiler.err.static.import.not.supported.in.source: 1.4
T6384542.java:12:8: compiler.err.enums.not.supported.in.source: 1.4
T6384542.java:14:13: compiler.err.unsupported.fp.lit: 1.4
T6384542.java:15:9: compiler.err.generics.not.supported.in.source: 1.4
T6384542.java:16:35: compiler.err.varargs.not.supported.in.source: 1.4
T6384542.java:17:25: compiler.err.foreach.not.supported.in.source: 1.4
T6384542.java:21:6: compiler.err.annotations.not.supported.in.source: 1.4
T6384542.java:24:8: compiler.err.expected3: class, interface, enum
8 errors

View file

@ -1,14 +0,0 @@
/**
* @test /nodynamiccopyright/
* @bug 6384542
* @summary crash: test/tools/javac/versions/check.sh
* @author Peter von der Ah\u00e9
* @compile/fail -source 5 T6384542a.java
* @compile -source 1.4 T6384542a.java
* @compile/fail/ref=T6384542a_5.out -source 5 -Xlint:-options -XDrawDiagnostics T6384542a.java
* @compile/ref=T6384542a_1_4.out -source 1.4 -Xlint:-options -XDrawDiagnostics T6384542a.java
*/
public class T6384542a {
T6384542a enum = null;
}

View file

@ -1,2 +0,0 @@
T6384542a.java:13:15: compiler.warn.enum.as.identifier
1 warning

View file

@ -1,2 +0,0 @@
T6384542a.java:13:15: compiler.err.enum.as.identifier
1 error

View file

@ -3,8 +3,6 @@
* @bug 8025537 * @bug 8025537
* @author sogoel * @author sogoel
* @summary enum keyword used as an identifier * @summary enum keyword used as an identifier
* @compile/ref=EnumAsIdentifier4.out -XDrawDiagnostics -source 1.4 EnumAsIdentifier.java
* @compile/fail/ref=EnumAsIdentifier5.out -XDrawDiagnostics -source 1.5 EnumAsIdentifier.java
* @compile/fail/ref=EnumAsIdentifier.out -XDrawDiagnostics EnumAsIdentifier.java * @compile/fail/ref=EnumAsIdentifier.out -XDrawDiagnostics EnumAsIdentifier.java
*/ */

View file

@ -1,2 +1,2 @@
EnumAsIdentifier.java:13:9: compiler.err.enum.as.identifier EnumAsIdentifier.java:11:9: compiler.err.enum.as.identifier
1 error 1 error

View file

@ -1,6 +0,0 @@
- compiler.warn.source.no.bootclasspath: 1.4
- compiler.warn.option.obsolete.source: 1.4
- compiler.warn.option.obsolete.target: 1.4
- compiler.warn.option.obsolete.suppression
EnumAsIdentifier.java:13:9: compiler.warn.enum.as.identifier
5 warnings

View file

@ -1,6 +0,0 @@
- compiler.warn.source.no.bootclasspath: 1.5
- compiler.warn.option.obsolete.source: 1.5
- compiler.warn.option.obsolete.suppression
EnumAsIdentifier.java:13:9: compiler.err.enum.as.identifier
1 error
3 warnings

View file

@ -1,37 +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 5009574
* @summary verify java.lang.Enum can't be directly subclassed
* @author Joseph D. Darcy
*
* @compile/fail -source 1.4 FauxEnum2.java
*/
public class FauxEnum2 extends java.lang.Enum {
FauxEnum2() {
super("", 0);
}
}

View file

@ -1,45 +0,0 @@
/*
* Copyright (c) 2008, 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 6682380 6679509
* @summary Foreach loop with generics inside finally block crashes javac with -target 1.5
* @author Jan Lahoda, Maurizio Cimadamore
* @compile -source 1.5 -target 1.5 T6682380.java
*/
import java.util.List;
public class T6682380<X> {
public static void main(String[] args) {
try {
} finally {
List<T6682380<?>> l = null;
T6682380<?>[] a = null;
for (T6682380<?> e1 : l);
for (T6682380<?> e2 : a);
}
}
}

View file

@ -1,42 +0,0 @@
/*
* Copyright (c) 2003, 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 4902704
* @summary javac generates inappropriate bridge methods in -source 1.4
* @author gafter
*
* @compile -source 1.4 -target 1.4 BridgeRestype.java
* @run main BridgeRestype
*/
import java.util.*;
public class BridgeRestype extends Vector {
public static void main(String[] args) {
BridgeRestype t = new BridgeRestype();
for (int i=0; i<args.length; i++) t.add(args[i]);
Iterator i = t.iterator();
}
}

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -27,7 +27,6 @@
* @summary casting conversion checks changed for covariant returns * @summary casting conversion checks changed for covariant returns
* @author gafter * @author gafter
* *
* @compile -source 1.4 RefEqual.java
* @compile/fail RefEqual.java * @compile/fail RefEqual.java
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -26,8 +26,6 @@
* @bug 5094318 * @bug 5094318
* @summary REGRESSION: Array cloning is not backwards compatible * @summary REGRESSION: Array cloning is not backwards compatible
* *
* @compile -source 1.4 T5094318.java
* @run main T5094318
* @compile T5094318.java * @compile T5094318.java
* @run main/fail T5094318 * @run main/fail T5094318
*/ */

View file

@ -1,41 +0,0 @@
/*
* Copyright (c) 2003, 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 4836051
* @summary generics: non-generic code should be able to call covariant method
* @author gafter
*
* @compile CovariantCompat1.java
* @compile -source 1.4 CovariantCompat2.java
*/
class CovariantCompat1 {
static class A {
public A foo() { return this; }
}
static class B extends A {
public B foo() { return this; }
}
}

View file

@ -1,29 +0,0 @@
/*
* Copyright (c) 2003, 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.
*/
class CovariantCompat2 {
static {
CovariantCompat1.B x = new CovariantCompat1.B();
CovariantCompat1.B o = x.foo();
}
}

View file

@ -1,50 +0,0 @@
/*
* Copyright (c) 2003, 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 4836048 4868021 5030040 5052968 5056864
* @summary generics: compiler allows 1.4 code to override a bridge method
* @author gafter
*
* @compile OverrideBridge1.java
* @compile/fail -Werror -source 1.4 OverrideBridge2.java
* @compile -source 1.4 OverrideBridge2.java
* @compile OverrideBridge3.java
*/
// ALLOW users to override bridge methods.
// Note the long list of bug numbers on this regression test. They
// indicate the number of times we've flip-flopped on this issue.
// 5030040 shows why we must give a diagnostic. 5052968 shows why it
// must be a warning.
class OverrideBridge1 {
static class A<T> {
public void foo(T t) { }
}
static class B extends A<String> {
public void foo(String t) { }
}
}

View file

@ -1,28 +0,0 @@
/*
* Copyright (c) 2003, 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.
*/
class OverrideBridge2 {
static class B extends OverrideBridge1.B {
public void foo(Object o) { }
}
}

View file

@ -1,27 +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.
*/
class OverrideBridge3 {
static class C extends OverrideBridge2.B {
}
}

View file

@ -1,41 +0,0 @@
/*
* Copyright (c) 2003, 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 4830291
* @summary javac makes String non-backward compatible
* @author gafter
*
* @compile -source 1.4 VisibleBridge.java
*/
// Ensure that bridge methods are visible for maximum
// backward compatibility.
class VisibleBridge {
static {
Object o = "b";
if ("a".compareTo(o) > 0) {}
}
}

View file

@ -1,68 +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 4739388
* @summary regression: javac generates too much bytecode for deply nested try-finally
* @author gafter
*
* @compile -source 1.4 -target 1.4 FinallyNesting.java
*/
// Source and target 1.4 are needed for the test to pass with default memory sizes.
class FinallyNesting {
public static void main(String[] args) {
int x;
try { x = 1; } finally {
try { x = 1; } finally {
try { x = 1; } finally {
try { x = 1; } finally {
try { x = 1; } finally {
try { x = 1; } finally {
try { x = 1; } finally {
try { x = 1; } finally {
try { x = 1; } finally {
try { x = 1; } finally {
try { x = 1; } finally {
try { x = 1; } finally {
try { x = 1; } finally {
try { x = 1; } finally {
try { x = 1; } finally {
x = 2;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2008, 2010, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -27,7 +27,7 @@
* @summary Generate call sites for method handle * @summary Generate call sites for method handle
* @author jrose * @author jrose
* *
* @compile -source 7 -target 7 -XDallowTransitionalJSR292=no InvokeMH.java * @compile InvokeMH.java
*/ */
/* /*

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,7 +28,6 @@
* @author gafter * @author gafter
* *
* @compile T4711325.java * @compile T4711325.java
* @compile/fail -source 1.4 T4711325.java
*/ */
interface A { interface A {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2006, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,7 +28,6 @@
* @author Peter von der Ah\u00e9 * @author Peter von der Ah\u00e9
* @compile WarnClass.java * @compile WarnClass.java
* @compile/fail -Werror WarnClass.java * @compile/fail -Werror WarnClass.java
* @compile/fail -Werror -source 1.4 -nowarn WarnClass.java
* @compile/fail -Werror -nowarn WarnClass.java * @compile/fail -Werror -nowarn WarnClass.java
* @compile/fail -Werror -Xlint:none WarnClass.java * @compile/fail -Werror -Xlint:none WarnClass.java
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2006, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,7 +28,6 @@
* @author Peter von der Ah\u00e9 * @author Peter von der Ah\u00e9
* @compile WarnImport.java * @compile WarnImport.java
* @compile/fail -Werror WarnImport.java * @compile/fail -Werror WarnImport.java
* @compile/fail -Werror -source 1.4 -nowarn WarnImport.java
* @compile/fail -Werror -nowarn WarnImport.java * @compile/fail -Werror -nowarn WarnImport.java
* @compile/fail -Werror -Xlint:none WarnImport.java * @compile/fail -Werror -Xlint:none WarnImport.java
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2006, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,7 +28,6 @@
* @author Peter von der Ah\u00e9 * @author Peter von der Ah\u00e9
* @compile WarnMethod.java * @compile WarnMethod.java
* @compile/fail -Werror WarnMethod.java * @compile/fail -Werror WarnMethod.java
* @compile/fail -Werror -source 1.4 -nowarn WarnMethod.java
* @compile/fail -Werror -nowarn WarnMethod.java * @compile/fail -Werror -nowarn WarnMethod.java
* @compile/fail -Werror -Xlint:none WarnMethod.java * @compile/fail -Werror -Xlint:none WarnMethod.java
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2006, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,7 +28,6 @@
* @author Peter von der Ah\u00e9 * @author Peter von der Ah\u00e9
* @compile WarnStaticImport.java * @compile WarnStaticImport.java
* @compile/fail -Werror WarnStaticImport.java * @compile/fail -Werror WarnStaticImport.java
* @compile/fail -Werror -source 1.4 -nowarn WarnStaticImport.java
* @compile/fail -Werror -nowarn WarnStaticImport.java * @compile/fail -Werror -nowarn WarnStaticImport.java
* @compile/fail -Werror -Xlint:none WarnStaticImport.java * @compile/fail -Werror -Xlint:none WarnStaticImport.java
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2006, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,7 +28,6 @@
* @author Peter von der Ah\u00e9 * @author Peter von der Ah\u00e9
* @compile WarnVariable.java * @compile WarnVariable.java
* @compile/fail -Werror WarnVariable.java * @compile/fail -Werror WarnVariable.java
* @compile/fail -Werror -source 1.4 -nowarn WarnVariable.java
* @compile/fail -Werror -nowarn WarnVariable.java * @compile/fail -Werror -nowarn WarnVariable.java
* @compile/fail -Werror -Xlint:none WarnVariable.java * @compile/fail -Werror -Xlint:none WarnVariable.java
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2006, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,7 +28,6 @@
* @author Peter von der Ah\u00e9 * @author Peter von der Ah\u00e9
* @compile WarnWildcard.java * @compile WarnWildcard.java
* @compile/fail -Werror WarnWildcard.java * @compile/fail -Werror WarnWildcard.java
* @compile/fail -Werror -source 1.4 -nowarn WarnWildcard.java
* @compile/fail -Werror -nowarn WarnWildcard.java * @compile/fail -Werror -nowarn WarnWildcard.java
* @compile/fail -Werror -Xlint:none WarnWildcard.java * @compile/fail -Werror -Xlint:none WarnWildcard.java
*/ */

View file

@ -25,7 +25,6 @@
* @test * @test
* @bug 7038363 * @bug 7038363
* @summary cast from object to primitive should be for source >= 1.7 * @summary cast from object to primitive should be for source >= 1.7
* @compile/fail/ref=CastObjectToPrimitiveTest.out -XDrawDiagnostics -Xlint:-options -source 5 CastObjectToPrimitiveTest.java
* @compile/fail/ref=CastObjectToPrimitiveTest.out -XDrawDiagnostics -Xlint:-options -source 6 CastObjectToPrimitiveTest.java * @compile/fail/ref=CastObjectToPrimitiveTest.out -XDrawDiagnostics -Xlint:-options -source 6 CastObjectToPrimitiveTest.java
* @compile CastObjectToPrimitiveTest.java * @compile CastObjectToPrimitiveTest.java
*/ */

View file

@ -1,2 +1,2 @@
CastObjectToPrimitiveTest.java:36:23: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Object, int) CastObjectToPrimitiveTest.java:35:23: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Object, int)
1 error 1 error