file_name
stringlengths
6
86
file_path
stringlengths
45
249
content
stringlengths
47
6.26M
file_size
int64
47
6.26M
language
stringclasses
1 value
extension
stringclasses
1 value
repo_name
stringclasses
767 values
repo_stars
int64
8
14.4k
repo_forks
int64
0
1.17k
repo_open_issues
int64
0
788
repo_created_at
stringclasses
767 values
repo_pushed_at
stringclasses
767 values
T7097436.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/varargs/7097436/T7097436.java
/* * @test /nodynamiccopyright/ * @bug 7097436 * @summary ClassCastException occurs in assignment expressions without any heap pollutions * @compile/fail/ref=T7097436.out -Xlint:varargs -Werror -XDrawDiagnostics T7097436.java */ import java.util.List; class T7097436 { @SafeVarargs static void m(List<String>... ls) { Object o = ls; //warning Object[] oArr = ls; //warning String s = ls; // no warning Integer[] iArr = ls; // no warning } }
497
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T6993978neg.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/varargs/6993978/T6993978neg.java
/* * @test /nodynamiccopyright/ * @bug 6993978 * @author mcimadamore * @summary ClassCastException occurs in assignment expressions without any heap pollutions * @compile/fail/ref=T6993978neg.out -Xlint:unchecked -Werror -XDrawDiagnostics T6993978neg.java */ import java.util.List; class T6993978neg { @SuppressWarnings({"varargs","unchecked"}) static <X> void m(X... x) { } static void test(List<String> ls) { m(ls); //compiler should still give unchecked here } }
499
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T5088429Pos01.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/varargs/5088429/T5088429Pos01.java
/* * Copyright (c) 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 5088429 * * @summary varargs overloading problem * @author mcimadamore * @compile T5088429Pos01.java * */ class T5088429Pos01 { interface A {} interface B extends A {} T5088429Pos01(A... args) {} T5088429Pos01(B b, A... args) {} void test(B b) { new T5088429Pos01(b); } }
1,385
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T5088429Neg02.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/varargs/5088429/T5088429Neg02.java
/* * Copyright (c) 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 5088429 * * @summary varargs overloading problem * @author mcimadamore * @compile/fail/ref=T5088429Neg02.out -XDrawDiagnostics T5088429Neg02.java * */ class T5088429Neg02 { interface A {} interface B extends A {} void m(A... args) {} void m(A a, A... args) {} void test(B b) { m(b); } }
1,400
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T5088429Neg01.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/varargs/5088429/T5088429Neg01.java
/* * Copyright (c) 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 5088429 * * @summary varargs overloading problem * @author mcimadamore * @compile/fail/ref=T5088429Neg01.out -XDrawDiagnostics T5088429Neg01.java * */ class T5088429Neg01 { interface A {} interface B extends A {} T5088429Neg01(A... args) {} T5088429Neg01(A a, A... args) {} void test(B b) { new T5088429Neg01(b); } }
1,430
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T5088429Pos02.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/varargs/5088429/T5088429Pos02.java
/* * Copyright (c) 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 5088429 * * @summary varargs overloading problem * @author mcimadamore * @compile T5088429Pos02.java * */ class T5088429Pos02 { interface A {} interface B extends A {} void m(A... args) {} void m(B b, A... args) {} void test(B b) { m(b); } }
1,355
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T6569633.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/varargs/6569633/T6569633.java
/* * @test /nodynamiccopyright/ * @bug 6569633 * @author mcimadamore * @summary Varargs: parser error when varargs element type is an array * @compile/fail/ref=T6569633.out -XDrawDiagnostics T6569633.java */ class T6569633 { void m1 (Integer... i[]) { } void m2 (Integer[]... i) { } void m3 (Integer[]... i[]) { } }
343
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T6313164.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/varargs/6313164/T6313164.java
/* * @test /nodynamiccopyright/ * @bug 6313164 * @author mcimadamore * @summary javac generates code that fails byte code verification for the varargs feature * @compile/fail/ref=T6313164.out -XDrawDiagnostics T6313164.java */ import p1.*; class T6313164 { { B b = new B(); b.foo1(new B(), new B()); //error - A not accesible b.foo2(new B(), new B()); //ok - A not accessible, but foo2(Object...) applicable b.foo3(null, null); //error - A (inferred) not accesible b.foo4(null, null); //error - A (inferred in 15.12.2.8 - no resolution backtrack) not accesible b.foo4(new B(), new C()); //ok - A (inferred in 15.12.2.7) not accessible, but foo4(Object...) applicable } }
721
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
C.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/varargs/6313164/p1/C.java
/* * Copyright (c) 2011, 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. */ package p1; public class C extends A { }
1,094
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
A.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/varargs/6313164/p1/A.java
/* * Copyright (c) 2011, 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. */ package p1; class A { A() { } }
1,089
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
B.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/varargs/6313164/p1/B.java
/* * Copyright (c) 2011, 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. */ package p1; public class B extends A { public B() {} public void foo1(A... args) { } public void foo2(A... args) { } public void foo2(Object... args) { } public <X extends A> void foo3(X... args) { } public <X extends A> void foo4(X... args) { } public void foo4(Object... args) { } }
1,367
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Main.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/accessVirtualInner/Main.java
/* * Copyright (c) 2002, 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 4406917 * @summary static call instead of virtual call in inner classes (access method bug) * @author gafter * * @compile a/A.java b/B.java c/C.java Main.java * @run main Main */ import c.*; public class Main { static public void main(String args[]) { C c = new C(); c.precall(); } }
1,389
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
C.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/accessVirtualInner/c/C.java
/* * Copyright (c) 2002, 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. */ package c; import b.*; public class C extends B { protected void foo() { // ok } }
1,153
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
A.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/accessVirtualInner/a/A.java
/* * Copyright (c) 2002, 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. */ package a; public class A { protected void foo() { throw new InternalError(); } }
1,153
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
B.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/accessVirtualInner/b/B.java
/* * Copyright (c) 2002, 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. */ package b; import a.*; public class B extends A { interface Caller { void call(); } public void precall() { foo(); Caller caller = new Caller() { public void call() { foo(); } }; caller.call(); } }
1,367
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T7073477.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/T7073477.java
/* * Copyright (c) 2011, 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 7073477 * @summary NPE in com.sun.tools.javac.code.Symbol$VarSymbol.getConstValue * @compile T7073477.java */ @SuppressWarnings(T7073477A.S) class T7073477 { } class T7073477A { @SuppressWarnings("") static final String S = ""; }
1,312
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T7043371.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/T7043371.java
/* * Copyright (c) 2011, 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 7043371 * @summary javac7 fails with NPE during compilation * @compile T7043371.java */ @interface Anno { String value(); } class B { @Anno(value=A.a) public static final int b = 0; } class A { @Deprecated public static final String a = "a"; }
1,342
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
TestAnnotationPackageInfo.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/TestAnnotationPackageInfo.java
/* * Copyright (c) 2011, 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 6993311 * @summary annotations on packages are not validated */ import java.io.*; import java.net.*; import java.util.*; import javax.tools.*; import com.sun.source.util.*; public class TestAnnotationPackageInfo { public static void main(String... args) throws Exception { new TestAnnotationPackageInfo().run(); } static class MyFileObject extends SimpleJavaFileObject { private String text; public MyFileObject(String fileName, String text) { super(URI.create("myfo:/" + fileName), JavaFileObject.Kind.SOURCE); this.text = text; } @Override public CharSequence getCharContent(boolean ignoreEncodingErrors) { return text; } } public void run() throws Exception { final String bootPath = System.getProperty("sun.boot.class.path"); final JavaCompiler tool = ToolProvider.getSystemJavaCompiler(); assert tool != null; JavaFileObject test_java = new MyFileObject("test/Test.java", "package test; public @interface Test {\n" + " public int mandatory();\n" + "}\n"); JavaFileObject package_info_java = new MyFileObject("test/package-info.java", "@Test package test;"); DiagnosticCollector<JavaFileObject> coll = new DiagnosticCollector<JavaFileObject>(); List<String> options = Arrays.asList("-bootclasspath", bootPath); List<? extends JavaFileObject> files = Arrays.asList(test_java, package_info_java); JavacTask ct = (JavacTask)tool.getTask(null, null, coll, options, null, files); ct.analyze(); String expectedCode = "compiler.err.annotation.missing.default.value"; List<Diagnostic<? extends JavaFileObject>> diags = coll.getDiagnostics(); switch (diags.size()) { case 0: throw new Exception("no diagnostics reported"); case 1: String code = diags.get(0).getCode(); if (code.equals(expectedCode)) return; throw new Exception("unexpected diag: " + diags.get(0)); default: throw new Exception("unexpected diags reported: " + diags); } } }
3,334
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
C.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/default/C.java
/* * 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. */ @A(x=1) class C { }
1,072
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Derr.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/default/Derr.java
/* * 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. */ @A(y=1) // error: x missing class D { }
1,092
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
A.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/default/A.java
/* * 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 4901262 * @summary Constraints regarding annotation defaults * @author gafter * * @compile A.java * @compile B.java * @compile C.java * @compile/fail Derr.java * @compile/fail Eerr.java */ public @interface A { int x(); int y() default 3; }
1,331
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
B.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/default/B.java
/* * 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. */ @A(x=1, y=2) class B { }
1,077
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Eerr.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/default/Eerr.java
/* * 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. */ @A(x=1, x=2) // error: duplicate x class E { }
1,099
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Dep.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/pos/Dep.java
/* * 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 4903501 * @summary Please add annotation <at>Deprecated to supplant the javadoc tag * @author gafter * * @compile -Xlint:dep-ann -Werror Dep.java */ /** @deprecated */ @Deprecated class Dep { }
1,272
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
RightTarget.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/pos/RightTarget.java
/* * 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 4901271 * @summary java.lang.annotation.Target * @author gafter * * @compile RightTarget.java */ import java.lang.annotation.ElementType; @java.lang.annotation.Target({ElementType.TYPE}) @type @interface type { } @java.lang.annotation.Target({ElementType.FIELD}) @interface field { } class field1 { @field int x; } @java.lang.annotation.Target({ElementType.METHOD}) @interface method { } class method1 { @method void m() {} } /* 4901285 @java.lang.annotation.Target({ElementType.PARAMETER}) @interface parameter { } class parameter1 { void m(@parameter int x) {} } */ @java.lang.annotation.Target({ElementType.CONSTRUCTOR}) @interface constructor { } class constructor1 { @constructor constructor1() {} } /* 4936182 @java.lang.annotation.Target({ElementType.LOCAL_VARIABLE}) @interface local { } class local1 { void f() { @local int x; } } */ @java.lang.annotation.Target({ElementType.ANNOTATION_TYPE}) @annotation @interface annotation { }
2,064
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
package-info.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/pos/package-info.java
/* * Copyright (c) 2003, 2011, 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 4901290 6993311 * @summary Package annotations * @author gafter * * @compile package-info.java */ @Deprecated package foo.bar;
1,211
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
ClassB.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/pos/ClassB.java
/* * 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 ClassB implements ClassA { public Class f() { return null; } public Class<ClassA> annotationType() { return ClassA.class; } }
1,192
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Z1.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/pos/Z1.java
/* * 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 4865660 * @summary implement "metadata" (attribute interfaces and program annotations) * @author gafter * * @compile Z1.java */ enum Color { red, green, blue } @interface Colored { Color value(); } @Colored(Color.green) class Martian { }
1,322
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Z4.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/pos/Z4.java
/* * 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 4865660 * @summary implement "metadata" (attribute interfaces and program annotations) * @author gafter * * @compile Z4.java */ @interface An { int a(); } class T { static { An an = null; java.lang.annotation.Annotation at = an; } }
1,340
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
OverrideOK.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/pos/OverrideOK.java
/* * 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 4901275 4989669 * @summary JSR175 (7): implement <at>Overrides * @author gafter * * @compile OverrideOK.java */ package overrideOK; abstract class A { abstract void f(); void g() {} } class B extends A { @Override void f() {} @Override void g() {} }
1,352
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Primitives.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/pos/Primitives.java
/* * 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 5034991 5040842 5040853 * @summary Modify class-file representation of Class-valued annotation elements * @author gafter */ public class Primitives { @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @interface A { Class value() default void.class; } @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @interface B { Class[] value() default { void.class }; } @A() @B() static class T1 {} @A(int.class) @B({void.class, byte.class, char.class, short.class, int.class, long.class, boolean.class, float.class, double.class, A[].class, int[].class}) static class T2 {} static void check(Object actual, Object expected) { if (actual != expected) throw new Error("expected: " + expected + "; actual = " + actual); } public static void main(String[] args) { check(T1.class.getAnnotation(A.class).value(), void.class); check(T1.class.getAnnotation(B.class).value().length, 1); check(T1.class.getAnnotation(B.class).value()[0], void.class); check(T2.class.getAnnotation(A.class).value(), int.class); check(T2.class.getAnnotation(B.class).value().length, 11); check(T2.class.getAnnotation(B.class).value()[0], void.class); check(T2.class.getAnnotation(B.class).value()[1], byte.class); check(T2.class.getAnnotation(B.class).value()[2], char.class); check(T2.class.getAnnotation(B.class).value()[3], short.class); check(T2.class.getAnnotation(B.class).value()[4], int.class); check(T2.class.getAnnotation(B.class).value()[5], long.class); check(T2.class.getAnnotation(B.class).value()[6], boolean.class); check(T2.class.getAnnotation(B.class).value()[7], float.class); check(T2.class.getAnnotation(B.class).value()[8], double.class); check(T2.class.getAnnotation(B.class).value()[9], A[].class); check(T2.class.getAnnotation(B.class).value()[10], int[].class); } }
3,126
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Local.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/pos/Local.java
/* * 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 4936182 * @summary local variable annotations * @author gafter * * @compile Local.java */ class Local { { @Deprecated int x; } }
1,223
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Enum1.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/pos/Enum1.java
/* * 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 4916218 * @summary JSR175: annotations on enum constant * @author gafter * * @compile Enum1.java */ package annotation.enums; @interface A {} enum T { @A a, @A b; }
1,253
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Parameter.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/pos/Parameter.java
/* * 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 4901285 * @summary JSR175: Parameter annotations * @author gafter * * @compile Parameter.java */ package annotation.parameter; @interface A {} class T { void f(final @A int x) { } void g(@A final int y, int[] x) { for (@A int a : x) {} for (final @A int a : x) break; for (@A final int a : x) break; } }
1,424
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Z3.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/pos/Z3.java
/* * 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 4865660 4906400 * @summary implement "metadata" (attribute interfaces and program annotations) * @author gafter * * @compile Z3.java */ enum Color { red, green, blue } class X {} @interface An2 {} @interface An { int a(); float b(); double c(); String d(); Color e(); Class f(); Class<?> h(); Class<? extends Enum> i(); int[] j(); // int[][] k(); An2 l(); // X m(); }
1,503
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
ClassA.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/pos/ClassA.java
/* * 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 4951298 4975363 * @summary javac crash loading class files containing Class-valued annotation fields * @author gafter * * @compile ClassA.java ClassB.java * @compile ClassB.java */ @interface ClassA { Class f() default int.class; }
1,315
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
AnnotationMethods.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/pos/AnnotationMethods.java
/* * Copyright (c) 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 6393539 * @summary no compile-time error for clone, etc. in annotation type * @author Peter von der Ah\u00e9 * @compile AnnotationMethods.java */ public @interface AnnotationMethods { int registerNatives(); }
1,295
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
AnnoteElideBraces.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/pos/AnnoteElideBraces.java
/* * 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 4916220 * @summary JSR175 (15): single element array annotation value * @author gafter * * @compile AnnoteElideBraces.java */ @interface D { int value() default 2; } @interface T { int[] a(); D[] b(); } @interface U { T[] value(); } @T(a=3, b=@D(12)) @U(@T(a=14, b=@D())) class X { }
1,387
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Z2.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/pos/Z2.java
/* * 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 4865660 * @summary implement "metadata" (attribute interfaces and program annotations) * @author gafter * * @compile Z2.java */ enum Color { red, green, blue } @interface Colored { Color value() default Color.red; }
1,299
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
OverrideCheck.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/pos/OverrideCheck.java
/* * 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 4904675 4989669 * @summary crash in annotation class file reader * @author gafter * * @compile OverrideCheck.java */ class OverrideCheck { static class A { public void f() {} } static class B extends A { @Override public void f() {} } }
1,362
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
TrailingComma.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/pos/TrailingComma.java
/* * Copyright (c) 2009, 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 6337964 * @summary javac incorrectly disallows trailing comma in annotation arrays * @author darcy * @compile TrailingComma.java */ import java.lang.annotation.*; @interface TestAnnotation { SuppressWarnings[] value() default {@SuppressWarnings({"",})}; } @TestAnnotation({@SuppressWarnings({}), @SuppressWarnings({"Beware the ides of March.",}), @SuppressWarnings({"Look both ways", "Before Crossing",}), }) public class TrailingComma { }
1,564
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Members.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/pos/Members.java
/* * 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 4981309 * @summary annotation types may contain constants, types * @author gafter * * @compile Members.java */ package members; @interface Members { public static final int N = 2; enum foo {} }
1,281
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
NType.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/pos/NType.java
/* * 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 5008452 * @summary compiler crash if annotation using an enum type defined inside the annotation * @author gafter * * @compile NType.java */ package ntype; import java.lang.annotation.*; @Retention(RetentionPolicy.RUNTIME) @interface NestedEnum1 { enum Quality { GOOD, BAD, AVERAGE } Quality value(); } @NestedEnum1(NestedEnum1.Quality.GOOD) class AnnotationDriverTest { public void assertion1() { } public static void main(String args[]) { AnnotationDriverTest ref = new AnnotationDriverTest(); ref.assertion1(); } }
1,639
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
CompilerAnnotationTest2bad.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/6214965/CompilerAnnotationTest2bad.java
/* * Copyright (c) 2005, 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. */ @CompilerAnnotationTest(@CompilerAnnotationTest2(name="test")) @interface CompilerAnnotationTest2 { String name(); String name3() default "test"; }
1,206
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
CompilerAnnotationTest2.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/6214965/CompilerAnnotationTest2.java
/* * Copyright (c) 2005, 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. */ @CompilerAnnotationTest(@CompilerAnnotationTest2(name="test")) @interface CompilerAnnotationTest2 { String name(); String name2() default "test"; //compile and change this to name3, then recompile }
1,257
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
CompilerAnnotationTest.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/6214965/CompilerAnnotationTest.java
/* * Copyright (c) 2005, 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. */ @CompilerAnnotationTest(@CompilerAnnotationTest2(name="test",name2="test2")) public @interface CompilerAnnotationTest { CompilerAnnotationTest2[] value(); }
1,212
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T6214965.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/6214965/T6214965.java
/* * Copyright (c) 2005, 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 6214965 6365854 * @summary Compiler crash on redefing nested annotation types * @compile CompilerAnnotationTest.java CompilerAnnotationTest2.java * @compile CompilerAnnotationTest2bad.java * @compile/ref=T6214965.out -XDrawDiagnostics CompilerAnnotationTest2bad.java */
1,358
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T6359949.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/6359949/T6359949.java
/* * Copyright (c) 2006, 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 6359949 * @summary (at)Override of static shouldn't be accepted (compiler shouldissue an error/warning) * @compile T6359949.java */ class Example { public void example() { } public static void example(Object o) { } } class Test extends Example { @Override public void example() { } }
1,401
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T6359949a.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/6359949/T6359949a.java
/* * Copyright (c) 2006, 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 6359949 * @summary (at)Override of static shouldn't be accepted (compiler shouldissue an error/warning) * @compile/fail T6359949a.java */ class Example { public static void example() { } } class Test extends Example { @Override public static void example() { } }
1,373
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
TestCore.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/6365854/TestCore.java
/* * Copyright (c) 2005, 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. */ package test.core; import test.annotation.TestAnnotation; public class TestCore { @TestAnnotation(test = 1) public static void main( String[] args ) { } public void test() { System.out.println("test"); } }
1,290
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
TestAnnotation.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/6365854/TestAnnotation.java
/* * Copyright (c) 2005, 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. */ package test.annotation; import java.lang.annotation.*; @Retention(RetentionPolicy.RUNTIME) public @interface TestAnnotation { int test(); }
1,202
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T6365854.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/6365854/T6365854.java
/* * Copyright (c) 2005, 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 6365854 * @summary javac crashes when compiling against an annotated class * @compile TestAnnotation.java TestCore.java * @clean test.annotation.TestAnnotation * @compile T6365854.java * @compile evolve/TestAnnotation.java T6365854.java * @compile T6365854.java * * @compile TestAnnotation.java TestCore.java * @clean test.annotation.TestAnnotation * @compile/ref=test1.out -XDrawDiagnostics T6365854.java * @run main T6365854 * @compile/ref=test2.out -XDrawDiagnostics evolve/TestAnnotation.java T6365854.java * @run main T6365854 * @compile/ref=test2.out -XDrawDiagnostics T6365854.java * @run main T6365854 */ import test.core.TestCore; public class T6365854 { public static void main(String... args) { TestCore tc = new TestCore(); System.out.println(tc.toString()); } }
1,900
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
TestAnnotation.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/6365854/evolve/TestAnnotation.java
/* * Copyright (c) 2005, 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. */ package test.annotation; import java.lang.annotation.*; @Retention(RetentionPolicy.RUNTIME) public @interface TestAnnotation { }
1,182
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T6881115.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/6881115/T6881115.java
/* * @test /nodynamiccopyright/ * @bug 6881115 6976649 * @summary javac permits nested anno w/o mandatory attrs => IncompleteAnnotationException * @author mcimadamore * @compile/fail/ref=T6881115.out -XDrawDiagnostics T6881115.java */ @interface A { B b() default @B(b2 = 1, b2 = 2); B[] b_arr() default {@B(), @B(b2 = 1, b2 = 2)}; } @interface B { String b1(); int b2(); } @A(b = @B(b2 = 1, b2 = 2), b_arr = {@B(), @B(b2 = 1, b2 = 2)}) class T6881115</*308 @A(b = @B(b2 = 1, b2 = 2), b_arr = {@B(), @B(b2 = 1, b2 = 2)})*/ X> {}
578
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Recovery.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/Recovery.java
/* * 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 4993451 * @summary compiler crash with malformed annotations * @author gafter * * @compile/fail Recovery.java */ import java.lang.annotation.*; @RetentionPolicy(RetentionPolicy.RUNTIME) public @interface Recovery {}
1,295
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
WrongTarget2.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/WrongTarget2.java
/* * 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 4973504 * @summary Compiler allows Inherited meta-attribute on local variable declaration. * @author gafter * * @compile/fail WrongTarget2.java */ import java.lang.annotation.Inherited; class Field {{ @Inherited int vec; }}
1,307
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Dep.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/Dep.java
/* * Copyright (c) 2003, 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 4903501 * @summary Please add annotation <at>Deprecated to supplant the javadoc tag * @author gafter * * @compile -source 1.4 -Xlint:-options -Xlint:dep-ann -Werror Dep.java * @compile/fail -Xlint:dep-ann -Werror Dep.java * @compile -Xlint:dep-ann Dep.java */ /** @deprecated */ class Dep { }
1,453
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Z14.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/Z14.java
/* * 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 4865660 * @summary implement "metadata" (attribute interfaces and program annotations) * @author gafter * * @compile/fail Z14.java */ @interface An<T> { int a(); }
1,246
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
WrongTarget.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/WrongTarget.java
/* * 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 4901271 * @summary java.lang.annotation.Target * @author gafter * * @compile/fail WrongTarget.java */ @java.lang.annotation.Target({FIELD}) @interface foo { } @foo public class WrongTarget { }
1,272
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Package.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/Package.java
/* * 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 4901290 * @summary Package annotations * @author gafter * * @compile/fail Package.java */ @java.lang.annotation.Documented package foo.bar;
1,218
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Z11.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/Z11.java
/* * 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 4865660 * @summary implement "metadata" (attribute interfaces and program annotations) * @author gafter * * @compile/fail Z11.java */ enum Color { red, green, blue } class X {} @interface An { X a(); }
1,286
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Z1.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/Z1.java
/* * 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 4865660 * @summary implement "metadata" (attribute interfaces and program annotations) * @author gafter * * @compile/fail Z1.java */ enum Color { red, green, blue } @interface Colored { Color value(); } @Colored(teal) class Martian { }
1,320
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Constant.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/Constant.java
/* * Copyright (c) 2003, 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 4901268 * @summary JSR175 (5): annotations must be "constants" * @author gafter * * @compile/fail Constant.java */ package Constant; @T(a = X.x) @interface T { int a(); } class X { static int x; }
1,291
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Cycle3.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/Cycle3.java
/* * 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 5044125 * @summary javac allows cyclic annotation interfaces with arrays * @author gafter * * @compile/fail Cycle3.java */ package cycle3; import java.lang.annotation.Retention; import static java.lang.annotation.RetentionPolicy.*; @Retention(RUNTIME) @interface A { A[] values() default { @A() }; } @A() class Main { public static void main(String[] args) { A a = Main.class.getAnnotation(A.class); System.out.println(a); } }
1,536
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Z4.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/Z4.java
/* * 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 4865660 * @summary implement "metadata" (attribute interfaces and program annotations) * @author gafter * * @compile/fail Z4.java */ enum Color { red, green, blue } @interface Colored { Color value() default teal; }
1,299
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Z10.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/Z10.java
/* * 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 4865660 * @summary implement "metadata" (attribute interfaces and program annotations) * @author gafter * * @compile/fail Z10.java */ enum Color { red, green, blue } @interface An { int[][] a(); }
1,281
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
MemberOver.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/MemberOver.java
/* * 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 4989667 * @summary Annotation members must not have same signature as Object or Annotation members * @author gafter * * @compile/fail MemberOver.java */ package memberOver; @interface T { int hashCode(); }
1,289
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
AnnComma.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/AnnComma.java
/* * 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 4973531 * @summary annotation syntax allows extra ',' in parameter list. * @author gafter * * @compile/fail AnnComma.java */ package annComma; @ann1(isStatic=false,type="class" ,) class TestM4 { @ann1(type="class",isStatic=false,) public void myMethod() { System.out.println(" In side the myMethod"); } } @interface ann1 { String type(); boolean isStatic(); }
1,464
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
ArrayLit.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/ArrayLit.java
/* * 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 4901266 * @summary JSR175 (4): don't allow "new" in annotations * @author gafter * * @compile/fail ArrayLit.java */ @ArrayLit(new int[] {1, 2, 3}) @interface ArrayLit { int[] value(); }
1,268
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Scope.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/Scope.java
/* * 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 4901280 * @summary name lookup scope for annotations * @author gafter * * @compile/fail Scope.java */ package annotation.scope; @A(red) // error: red not in scope. enum E { red, green, blue; } @interface A { E value(); }
1,309
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Z9.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/Z9.java
/* * 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 4865660 * @summary implement "metadata" (attribute interfaces and program annotations) * @author gafter * * @compile/fail Z9.java */ @interface An { <T> int x(); }
1,246
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Syntax1.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/Syntax1.java
/* * 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 4974524 * @summary compiler crash with ill-formed annotation * @author gafter * * @compile/fail Syntax1.java */ package syntax1; import java.lang.annotation.*; import java.util.*; @Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD, ElementType.TYPE) public @interface Syntax1 { String elementName(); }
1,410
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Z13.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/Z13.java
/* * 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 4865660 * @summary implement "metadata" (attribute interfaces and program annotations) * @author gafter * * @compile/fail Z13.java */ @interface An { int a() throws NullPointerException; }
1,271
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
OverrideNo.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/OverrideNo.java
/* * 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 4901275 4989669 * @summary JSR175 (7): implement <at>Overrides * @author gafter * * @compile/fail OverrideNo.java */ package overrideNo; abstract class A { } class B extends A { @Override void f() {} }
1,292
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
ObjectMembers.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/ObjectMembers.java
/* * 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 4901264 * @summary JSR175 (2): don't allow annotating members from Object * @author gafter * * @compile/fail ObjectMembers.java */ @ObjectMembers(hashCode = 23) @interface ObjectMembers {}
1,267
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Z12.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/Z12.java
/* * 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 4865660 * @summary implement "metadata" (attribute interfaces and program annotations) * @author gafter * * @compile/fail Z12.java */ enum Color { red, green, blue } @interface An { void a(); }
1,277
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
WrongValue.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/WrongValue.java
/* * 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 4951298 * @summary compiler: crashes when attributes with same elements are used in place of other * @author gafter * * @compile/fail WrongValue.java */ @interface TestM2 { String message() default "MyMessage"; Class myClass() default Integer.class; } @interface TestM3 { String message() default "MyMessage"; Class myClass() default Integer.class; } @interface X { TestM2 value(); } @X(@TestM3()) class Foo { }
1,514
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
NoAnnotationMethods.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/NoAnnotationMethods.java
/* * Copyright (c) 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 6393539 * @summary no compile-time error for clone, etc. in annotation type * @author Peter von der Ah\u00e9 * @compile/fail NoAnnotationMethods.java */ public @interface NoAnnotationMethods { int annotationType(); }
1,303
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Z3.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/Z3.java
/* * 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 4865660 * @summary implement "metadata" (attribute interfaces and program annotations) * @author gafter * * @compile/fail Z3.java */ enum Color { red, green, blue } class Colored { Color value() default red; }
1,293
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
DupTarget.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/DupTarget.java
/* * 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 4901271 * @summary <at>Target * @author gafter * * @compile/fail DupTarget.java */ @java.lang.annotation.Target({TYPE, FIELD, PACKAGE, FIELD}) @interface DupTarget { }
1,246
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
NoObjectMethods.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/NoObjectMethods.java
/* * Copyright (c) 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 6393539 * @summary no compile-time error for clone, etc. in annotation type * @author Peter von der Ah\u00e9 * @compile/fail NoObjectMethods.java */ public @interface NoObjectMethods { int clone(); }
1,286
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Dup.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/Dup.java
/* * 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 4901265 * @summary JSR175 (3): don't allow repeated annotations * @author gafter * * @compile/fail Dup.java */ @Dup @Dup @interface Dup {}
1,217
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Recovery1.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/Recovery1.java
/* * 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 4963450 * @summary Assertion error is thrown when an annotation class cannot be found. * @author gafter * * @compile/fail Recovery1.java */ package recovery1; @interface MyAnnotation { String value(); Marker marker() default @Marker; } interface MyBean { @MyAnnotation (value="baz", markerToo="not default") public String getFoo(); }
1,430
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Z15.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/Z15.java
/* * 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 4865660 * @summary implement "metadata" (attribute interfaces and program annotations) * @author gafter * * @compile/fail Z15.java */ @interface An { String a() default "foo".intern(); }
1,269
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Cycle1.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/Cycle1.java
/* * 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 4906400 * @summary (JSR175) compiler allows self-containing annotation types * @author gafter * * @compile/fail Cycle1.java */ package cycle1; @interface Foo { Foo foo(); }
1,256
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
NoClone.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/NoClone.java
/* * Copyright (c) 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 6393539 * @summary no compile-time error for clone, etc. in annotation type * @author Peter von der Ah\u00e9 * @compile/fail NoClone.java */ public @interface NoClone { Object clone(); }
1,273
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Z8.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/Z8.java
/* * 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 4865660 * @summary implement "metadata" (attribute interfaces and program annotations) * @author gafter * * @compile/fail Z8.java */ @interface An { int x(int y); }
1,247
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Z16.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/Z16.java
/* * 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 4865660 * @summary implement "metadata" (attribute interfaces and program annotations) * @author gafter * * @compile/fail Z16.java */ enum Color { red, green, blue } @interface Colored { Color value() default redx; }
1,300
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Z5.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/Z5.java
/* * 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 4865660 * @summary implement "metadata" (attribute interfaces and program annotations) * @author gafter * * @compile/fail Z5.java */ interface Foo {} @interface Colored extends Foo { }
1,264
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
MixedSource.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/MixedSource.java
/* * 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 {}
1,279
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Z2.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/Z2.java
/* * 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 4865660 * @summary implement "metadata" (attribute interfaces and program annotations) * @author gafter * * @compile/fail Z2.java */ enum Color { red, green, blue } interface Colored { Color value() default red; }
1,297
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Cycle2.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/neg/Cycle2.java
/* * 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 4906400 * @summary (JSR175) compiler allows self-containing annotation types * @author gafter * * @compile/fail Cycle2.java */ package cycle2; @interface Bar { Baz baz(); } @interface Baz { Bar bar(); }
1,291
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T6550655.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/annotations/6550655/T6550655.java
/* * Copyright (c) 2011, 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 6550655 * @summary javac crashes when compiling against an annotated class */ import java.io.File; import java.net.URI; import java.util.Arrays; import javax.tools.Diagnostic; import javax.tools.DiagnosticListener; import javax.tools.JavaCompiler; import javax.tools.JavaCompiler.CompilationTask; import javax.tools.JavaFileObject; import javax.tools.SimpleJavaFileObject; import javax.tools.ToolProvider; public class T6550655 { JavaCompiler javacTool; File testDir; TestKind testKind; EnumActionKind actionKind; String testSource = "enum E { NORTH, SOUTH, WEST, EAST; }\n" + "@I(val = E.NORTH)class A {}\n" + "@interface I { E val(); }"; T6550655(JavaCompiler javacTool, File testDir, TestKind testKind, EnumActionKind actionKind) { this.javacTool = javacTool; this.testDir = testDir; this.testKind = testKind; this.actionKind = actionKind; } void test() { testDir.mkdirs(); compile(null, new JavaSource("Test.java", testSource)); actionKind.doAction(this); compile(new DiagnosticChecker(), testKind.source); } void compile(DiagnosticChecker dc, JavaSource... sources) { try { CompilationTask ct = javacTool.getTask(null, null, dc, Arrays.asList("-d", testDir.getAbsolutePath(), "-cp", testDir.getAbsolutePath()), null, Arrays.asList(sources)); ct.call(); } catch (Exception e) { error("Internal compilation error"); } } void replaceEnum(String newSource) { compile(null, new JavaSource("Replace.java", newSource)); }; void removeEnum() { File enumClass = new File(testDir, "E.class"); if (!enumClass.exists()) { error("Expected file E.class does not exists in folder " + testDir); } enumClass.delete(); }; void error(String msg) { System.err.println(msg); nerrors++; } class DiagnosticChecker implements DiagnosticListener<JavaFileObject> { String[][] expectedKeys = new String[][] { // DIRECT, INDIRECT {/*REPLACE1*/ "compiler.err.cant.resolve.location" , "compiler.warn.unknown.enum.constant" }, {/*REPLACE2*/ "compiler.err.cant.resolve.location.args", "compiler.warn.annotation.method.not.found" }, {/*REMOVE*/ "compiler.err.cant.resolve" , "compiler.warn.unknown.enum.constant.reason" } }; String keyToIgnore = "compiler.err.attribute.value.must.be.constant"; public void report(Diagnostic<? extends JavaFileObject> diagnostic) { String expectedCode = expectedKeys[actionKind.ordinal()][testKind.ordinal()]; if (!diagnostic.getCode().equals(keyToIgnore) && !diagnostic.getCode().equals(expectedCode)) { error("Unexpected diagnostic" + "\nfound " + diagnostic.getCode() + "\nexpected " + expectedCode + "\ntestKind " + testKind + "\nactionKind " + actionKind); } } } //global declarations enum EnumActionKind { REPLACE1("enum E { SOUTH, WEST, EAST; }") { @Override void doAction(T6550655 test) { test.replaceEnum(optionalSource); } }, REPLACE2("@interface I { E valNew() default E.EAST; }") { @Override void doAction(T6550655 test) { test.replaceEnum(optionalSource); } }, REMOVE(null) { @Override void doAction(T6550655 test) { test.removeEnum(); } }; String optionalSource; private EnumActionKind(String optionalSource) { this.optionalSource = optionalSource; } abstract void doAction(T6550655 test); } enum TestKind { DIRECT("@I(val = E.NORTH)class C1 {}"), INDIRECT("class C2 { A a; }"); JavaSource source; private TestKind(final String code) { this.source = new JavaSource("Test.java", code); } } public static void main(String[] args) throws Exception { String SCRATCH_DIR = System.getProperty("user.dir"); JavaCompiler javacTool = ToolProvider.getSystemJavaCompiler(); int n = 0; for (TestKind testKind : TestKind.values()) { for (EnumActionKind actionKind : EnumActionKind.values()) { File testDir = new File(SCRATCH_DIR, "test"+n); new T6550655(javacTool, testDir, testKind, actionKind).test(); n++; } } if (nerrors > 0) { throw new AssertionError("Some errors have been detected"); } } static class JavaSource extends SimpleJavaFileObject { String source; public JavaSource(String filename, String source) { super(URI.create("myfo:/" + filename), JavaFileObject.Kind.SOURCE); this.source = source; } @Override public CharSequence getCharContent(boolean ignoreEncodingErrors) { return source; } } static int nerrors = 0; }
6,463
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
TestInferBinaryName.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/6508981/TestInferBinaryName.java
/* * Copyright (c) 2008, 2011, 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 6508981 * @summary cleanup file separator handling in JavacFileManager * (This test is specifically to test the new impl of inferBinaryName) * @build p.A * @run main TestInferBinaryName */ import java.io.*; import java.util.*; import javax.tools.*; import com.sun.tools.javac.file.JavacFileManager; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.Options; import static javax.tools.JavaFileObject.Kind.*; import static javax.tools.StandardLocation.*; /** * Verify the various implementations of inferBinaryName, but configuring * different instances of a file manager, getting a file object, and checking * the impl of inferBinaryName for that file object. */ public class TestInferBinaryName { static final boolean IGNORE_SYMBOL_FILE = false; static final boolean USE_SYMBOL_FILE = true; static final boolean DONT_USE_ZIP_FILE_INDEX = false; static final boolean USE_ZIP_FILE_INDEX = true; public static void main(String... args) throws Exception { new TestInferBinaryName().run(); } void run() throws Exception { //System.err.println(System.getProperties()); testDirectory(); testSymbolArchive(); testZipArchive(); testZipFileIndexArchive(); testZipFileIndexArchive2(); if (errors > 0) throw new Exception(errors + " error found"); } void testDirectory() throws IOException { String testClassName = "p.A"; JavaFileManager fm = getFileManager("test.classes", USE_SYMBOL_FILE, USE_ZIP_FILE_INDEX); test("testDirectory", fm, testClassName, "com.sun.tools.javac.file.RegularFileObject"); } void testSymbolArchive() throws IOException { String testClassName = "java.lang.String"; JavaFileManager fm = getFileManager("sun.boot.class.path", USE_SYMBOL_FILE, DONT_USE_ZIP_FILE_INDEX); test("testSymbolArchive", fm, testClassName, "com.sun.tools.javac.file.SymbolArchive$SymbolFileObject"); } void testZipArchive() throws IOException { String testClassName = "java.lang.String"; JavaFileManager fm = getFileManager("sun.boot.class.path", IGNORE_SYMBOL_FILE, DONT_USE_ZIP_FILE_INDEX); test("testZipArchive", fm, testClassName, "com.sun.tools.javac.file.ZipArchive$ZipFileObject"); } void testZipFileIndexArchive() throws IOException { String testClassName = "java.lang.String"; JavaFileManager fm = getFileManager("sun.boot.class.path", USE_SYMBOL_FILE, USE_ZIP_FILE_INDEX); test("testZipFileIndexArchive", fm, testClassName, "com.sun.tools.javac.file.ZipFileIndexArchive$ZipFileIndexFileObject"); } void testZipFileIndexArchive2() throws IOException { String testClassName = "java.lang.String"; JavaFileManager fm = getFileManager("sun.boot.class.path", IGNORE_SYMBOL_FILE, USE_ZIP_FILE_INDEX); test("testZipFileIndexArchive2", fm, testClassName, "com.sun.tools.javac.file.ZipFileIndexArchive$ZipFileIndexFileObject"); } /** * @param testName for debugging * @param fm suitably configured file manager * @param testClassName the classname to test * @param implClassName the expected classname of the JavaFileObject impl, * used for checking that we are checking the expected impl of * inferBinaryName */ void test(String testName, JavaFileManager fm, String testClassName, String implClassName) throws IOException { JavaFileObject fo = fm.getJavaFileForInput(CLASS_PATH, testClassName, CLASS); if (fo == null) { System.err.println("Can't find " + testClassName); errors++; return; } String cn = fo.getClass().getName(); String bn = fm.inferBinaryName(CLASS_PATH, fo); System.err.println(testName + " " + cn + " " + bn); check(cn, implClassName); check(bn, testClassName); System.err.println("OK"); } JavaFileManager getFileManager(String classpathProperty, boolean symFileKind, boolean zipFileIndexKind) throws IOException { Context ctx = new Context(); Options options = Options.instance(ctx); options.put("useOptimizedZip", Boolean.toString(zipFileIndexKind == USE_ZIP_FILE_INDEX)); if (symFileKind == IGNORE_SYMBOL_FILE) options.put("ignore.symbol.file", "true"); JavacFileManager fm = new JavacFileManager(ctx, false, null); List<File> path = getPath(System.getProperty(classpathProperty)); fm.setLocation(CLASS_PATH, path); return fm; } List<File> getPath(String s) { List<File> path = new ArrayList<File>(); for (String f: s.split(File.pathSeparator)) { if (f.length() > 0) path.add(new File(f)); } //System.err.println("path: " + path); return path; } void check(String found, String expect) { if (!found.equals(expect)) { System.err.println("Expected: " + expect); System.err.println(" Found: " + found); errors++; } } private int errors; } class A { }
6,481
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
A.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/6508981/p/A.java
/* * 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. */ package p; class A { }
1,074
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
DeadCode5.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/BadOptimization/DeadCode5.java
/* * Copyright (c) 1999, 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 4136312 4073244 * @summary init: Verify that overzealous dead-code elimination no * longer removes live code. * @author dps * * @run clean DeadCode5 * @run compile -O DeadCode5.java * @run main DeadCode5 */ // Test for bug 4136312 public class DeadCode5 { int fld; static public void main(String args[]) { DeadCode5 t = null; try { int dummy = t.fld; // if we got here, then there must be a problem throw new RuntimeException("accidental removal of live code"); } catch (NullPointerException e) { System.out.println("NullPointerException correctly thrown"); e.printStackTrace(); } } }
1,774
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Switch2.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/BadOptimization/Switch2.java
/* * Copyright (c) 1999, 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 4099995 4118025 * @summary Bad optimization of "switch" statement * @author dps * * @run clean Switch2 * @run compile -O Switch2.java * @run main Switch2 */ public class Switch2 { private boolean isZero( int d ) { switch (d) { case 0: return true; default: return false; } } void useSecondArgument( String a, int b ) { if ( !isZero( b ) ) throw new RuntimeException("isZero(0) returns false?!"); } public static void main( String[] args ) { Switch2 object = new Switch2(); object.useSecondArgument( "42", 0 ); } }
1,712
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
DeadCode6.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/BadOptimization/DeadCode6.java
/* * Copyright (c) 1999, 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 4073244 * @summary nested classes: Verify that overzealous dead-code elimination no * longer removes live code. * @author dps * * @run clean DeadCode6 * @run compile -O DeadCode6.java */ // This class will crash the compiler if the bug recurs. import java.awt.*; import java.awt.event.*; public class DeadCode6 extends Window { public DeadCode6( Frame parent ) { super( parent ); } public void init() { final DeadCode6 wndThis = this; /******************************************************************* * add window listener ******************************************************************/ addWindowListener( new WindowAdapter () { public void windowClosing( WindowEvent evt ) { wndThis.doCancelAction(); } } ); } public void doCancelAction() { } }
1,957
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
DeadCode2.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/BadOptimization/DeadCode2.java
/* * Copyright (c) 1999, 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 4057345 4120016 4120014 * @summary try-catch 2: Verify that overzealous dead-code elimination no * longer removes live code. * @author dps * * @run clean DeadCode2 * @run compile -O DeadCode2.java * @run main DeadCode2 */ class cls { int [] ai = null; } public class DeadCode2 extends cls { int [] bi = null; static int[] func() { return (int[])null; } public static void main(String argv[]) { int [] ci = null; int m = 0; int errcnt = 0; try { int i = func()[m = 7]; } catch(Exception e) { System.out.println(e + " found "); errcnt++; } try { DeadCode2 ox = new DeadCode2(); int i = ox.ai[m = 7]; } catch(Exception e) { System.out.println(e + " found "); errcnt++; } try { DeadCode2 ox = new DeadCode2(); int i = ox.bi[m = 7]; } catch(Exception e) { System.out.println(e + " found "); errcnt++; } try { int i = ci[m = 7]; } catch(Exception e) { System.out.println(e + " found "); errcnt++; } try { int i = ((int[])null)[0]; } catch(Exception e) { System.out.println(e + " found "); errcnt++; } if (errcnt != 5) throw new RuntimeException("live code accidentally removed"); } }
2,315
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Switch1.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/BadOptimization/Switch1.java
/* * Copyright (c) 1999, 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 4099995 4118025 * @summary Bad optimization of "switch" statement * @author dps * * @run clean Switch1 * @run compile -O Switch1.java * @run main Switch1 */ public class Switch1 { public static void main (String argc[]) { for (int i = 0; i < 2; i++) { String ret; ret = test(0); if (ret.equals("Error")) throw new RuntimeException("test(0) = Error"); System.out.println("test(0) = " + ret); ret = test(1); if (ret.equals("Error")) throw new RuntimeException("test(1) = Error"); System.out.println("test(1) = " + ret); } } private static String test (int i) { switch (i) { case 0: return ("found 0"); case 1: return ("found 1"); } return ("Error"); } }
1,955
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z