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
FallThrough.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/warnings/FallThrough.java
/** * @test /nodynamiccopyright/ * @bug 4986256 * @compile/ref=FallThrough.noLint.out -XDrawDiagnostics FallThrough.java * @compile/ref=FallThrough.lintAll.out -Xlint:all,-path -XDrawDiagnostics FallThrough.java * @compile/ref=FallThrough.lintFallThrough.out -Xlint:fallthrough -XDrawDiagnostics FallThrough.java */ // control: this class should generate a warning class FallThrough { int m1(int i) { switch (i) { case 1: i++; case 2: i++; } return i; } } // tests: the warnings that would otherwise be generated should all be suppressed @SuppressWarnings("fallthrough") class FallThrough1 { int m1(int i) { switch (i) { case 1: i++; case 2: i++; } return i; } } class FallThrough2 { @SuppressWarnings("fallthrough") class Bar { int m1(int i) { switch (i) { case 1: i++; case 2: i++; } return i; } } @SuppressWarnings("fallthrough") void m2(int i) { switch (i) { case 1: i++; case 2: i++; } } @SuppressWarnings("fallthrough") static int x = new FallThrough2() { int m1(int i) { switch (i) { case 1: i++; case 2: i++; } return i; } }.m1(0); }
1,390
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
DivZero.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/warnings/DivZero.java
/** * @test /nodynamiccopyright/ * @bug 4759494 4986256 * @compile/ref=DivZero.noLint.out -XDrawDiagnostics DivZero.java * @compile/ref=DivZero.lint.out -Xlint:divzero -XDrawDiagnostics DivZero.java * @compile/ref=DivZero.lint.out -Xlint:all,-path -XDrawDiagnostics DivZero.java */ class DivZero { public static final int ONE = 1; public int i1 = 1 / 0; public static final int i2 = 1 / 0; public int i3 = 1 % 0; public static final int i4 = 1 % 0; public static final int i5 = 1 / (1 - 1); public static final int i6 = 1 / (ONE - 1); public static final int i7 = 1 / (ONE - ONE); public static final int i8 = 1 % (1 - 1); public static final int i9 = 1 % (ONE - 1); public static final int i10 = 1 % (ONE - ONE); public static final long ONEL = 1L; public long l1 = 1L / 0L; public static final long l2 = 1L / 0L; public long l3 = 1L % 0L; public static final long l4 = 1L % 0L; public static final long l5 = 1L / (1L - 1L); public static final long l6 = 1L / (ONEL - 1L); public static final long l7 = 1L / (ONEL - ONEL); public static final long l8 = 1L % (1L - 1L); public static final long l9 = 1L % (ONEL - 1L); public static final long l10 = 1L % (ONEL - ONEL); static void m() { int mi1 = 1 / 0; int mi2 = 1 % 0; mi1 /= 0; mi1 %= 0; long ml1 = 1L / 0L; long ml2 = 1L % 0L; ml1 /= 0L; ml1 %= 0L; } } @SuppressWarnings("divzero") class DivZero2 { public static final int ONE = 1; public int i1 = 1 / 0; public static final int i2 = 1 / 0; public int i3 = 1 % 0; public static final int i4 = 1 % 0; public static final int i5 = 1 / (1 - 1); public static final int i6 = 1 / (ONE - 1); public static final int i7 = 1 / (ONE - ONE); public static final int i8 = 1 % (1 - 1); public static final int i9 = 1 % (ONE - 1); public static final int i10 = 1 % (ONE - ONE); public static final long ONEL = 1L; public long l1 = 1L / 0L; public static final long l2 = 1L / 0L; public long l3 = 1L % 0L; public static final long l4 = 1L % 0L; public static final long l5 = 1L / (1L - 1L); public static final long l6 = 1L / (ONEL - 1L); public static final long l7 = 1L / (ONEL - ONEL); public static final long l8 = 1L % (1L - 1L); public static final long l9 = 1L % (ONEL - 1L); public static final long l10 = 1L % (ONEL - ONEL); static void m() { int mi1 = 1 / 0; int mi2 = 1 % 0; mi1 /= 0; mi1 %= 0; long ml1 = 1L / 0L; long ml2 = 1L % 0L; ml1 /= 0L; ml1 %= 0L; } } class DivZero3 { @SuppressWarnings("divzero") public int i1 = 1 / 0; @SuppressWarnings("divzero") public static final int i2 = 1 / 0; @SuppressWarnings("divzero") public int i3 = 1 % 0; @SuppressWarnings("divzero") public static final int i4 = 1 % 0; @SuppressWarnings("divzero") public long l1 = 1L / 0L; @SuppressWarnings("divzero") public static final long l2 = 1L / 0L; @SuppressWarnings("divzero") public long l3 = 1L % 0L; @SuppressWarnings("divzero") public static final long l4 = 1L % 0L; @SuppressWarnings("divzero") static void m() { int mi1 = 1 / 0; int mi2 = 1 % 0; mi1 /= 0; mi1 %= 0; long ml1 = 1L / 0L; long ml2 = 1L % 0L; ml1 /= 0L; ml1 %= 0L; } }
3,570
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Unchecked.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/warnings/Unchecked.java
/** * @test /nodynamiccopyright/ * @bug 4986256 * @compile/ref=Unchecked.noLint.out -XDrawDiagnostics Unchecked.java * @compile/ref=Unchecked.lintUnchecked.out -Xlint:unchecked -XDrawDiagnostics Unchecked.java * @compile/ref=Unchecked.lintAll.out -Xlint:all,-path -XDrawDiagnostics Unchecked.java */ import java.util.ArrayList; import java.util.List; // control: this class should generate warnings class Unchecked { void m() { List l = new ArrayList<String>(); l.add("abc"); } } // tests: the warnings that would otherwise be generated should all be suppressed @SuppressWarnings("unchecked") class Unchecked2 { void m() { List l = new ArrayList<String>(); l.add("abc"); } } class Unchecked3 { @SuppressWarnings("unchecked") void m() { List l = new ArrayList<String>(); l.add("abc"); } } class Unchecked4 { void m() { @SuppressWarnings("unchecked") class Inner { void m() { List l = new ArrayList<String>(); l.add("abc"); } } } } // this class should produce warnings because @SuppressWarnings should not be inherited class Unchecked5 extends Unchecked2 { void m() { List l = new ArrayList<String>(); l.add("abc"); } }
1,374
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Serial.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/warnings/Serial.java
/* * Copyright (c) 2005, 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 4986256 * @compile Serial.java * @compile -Xlint:serial Serial.java * @compile -Xlint:all Serial.java * @compile -Werror Serial.java * @compile/fail -Werror -Xlint:serial Serial.java */ import java.io.Serializable; // control: this class should generate warnings class Serial implements Serializable { static class Inner implements Serializable { } @SuppressWarnings("serial") void m() { class Inner implements Serializable { } } } // tests: the warnings that would otherwise be generated should all be suppressed @SuppressWarnings("serial") class Serial1 implements Serializable { static class Inner implements Serializable { } } class Serial2 { @SuppressWarnings("serial") static class Inner implements Serializable { } @SuppressWarnings("serial") void m() { class Inner implements Serializable { } } } // this class should produce warnings because @SuppressWarnings should not be inherited class Serial3 extends Serial1 { static class Inner implements Serializable { } }
2,190
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Finally.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/warnings/Finally.java
/* * Copyright (c) 2005, 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 4986256 * @compile Finally.java * @compile -Xlint:finally Finally.java * @compile -Xlint:all Finally.java * @compile -Werror Finally.java * @compile/fail -Werror -Xlint:finally Finally.java * @compile/fail -Werror -Xlint:all,-path Finally.java */ // control: this class should generate a warning class Finally { int m1(int i) { try { return 0; } finally { throw new IllegalArgumentException(); } } } // tests: the warnings that would otherwise be generated should all be suppressed @SuppressWarnings("finally") class Finally1 { int m1(int i) { try { return 0; } finally { throw new IllegalArgumentException(); } } } class Finally2 { @SuppressWarnings("finally") class Bar { int m1(int i) { try { return 0; } finally { throw new IllegalArgumentException(); } } } @SuppressWarnings("finally") int m2(int i) { try { return 0; } finally { throw new IllegalArgumentException(); } } @SuppressWarnings("finally") static int x = new Finally2() { int m1(int i) { try { return 0; } finally { throw new IllegalArgumentException(); } } }.m1(0); }
2,576
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Deprecation.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/warnings/Deprecation.java
/** * @test /nodynamiccopyright/ * @bug 4986256 * @compile/ref=Deprecation.noLint.out -XDrawDiagnostics Deprecation.java * @compile/ref=Deprecation.lintDeprecation.out -Xlint:deprecation -XDrawDiagnostics Deprecation.java * @compile/ref=Deprecation.lintAll.out -Xlint:all,-path -XDrawDiagnostics Deprecation.java */ @Deprecated class Deprecation { } // control: this class should generate warnings class Deprecation2 { void m() { Object d = new Deprecation(); } } // tests: the warnings that would otherwise be generated should all be suppressed @SuppressWarnings("deprecation") class Deprecation3 { void m() { Object d = new Deprecation(); } } class Deprecation4 { @SuppressWarnings("deprecation") void m() { Object d = new Deprecation(); } } class Deprecation5 { void m() { @SuppressWarnings("deprecation") class Inner { void m() { Object d = new Deprecation(); } } } } // this class should produce warnings because @SuppressWarnings should not be inherited class Deprecation6 extends Deprecation3 { void m() { Object d = new Deprecation(); } }
1,258
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T6763518.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/warnings/T6763518.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. */ /** * @test * @bug 6763518 * @summary Impossible to suppress raw-type warnings * @compile -Werror -Xlint:rawtypes T6763518.java */ import java.util.List; class T6763518 { @SuppressWarnings("rawtypes") List l1; void m(@SuppressWarnings("rawtypes") List l2) { @SuppressWarnings("rawtypes") List l3; }; }
1,394
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T6885255.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/warnings/6885255/T6885255.java
/** * @test /nodynamiccopyright/ * @bug 6885255 * @summary -Xlint:rawtypes * @compile/ref=T6885255.out -XDrawDiagnostics -Xlint:rawtypes T6885255.java */ class T6885255 { static class Test<X, Y> {} Class<Test> ct; //no warn - outer Class w/ raw param Class<Test<Test, Test>> ctt; //warn - outer Class w/o raw param (2) Class<Class<Test>> cct; //warn - outer Class w/o raw param Class<Class<Test<Test, Test>>> cctt; //warn - outer Class w/o raw param (2) Object o1 = (Test)null; //no warn - outer raw and cast Object o2 = (Test<Test, Test>)null; //warn - inner raw (2) Object o3 = (Class)null; //no warn - outer raw and cast Object o4 = (Class<Test>)null; //no warn - outer Class w/ raw param Object o5 = (Class<Test<Test, Test>>)null; //warn - outer Class w/ non raw param (2) Object o6 = (Class<Class<Test<Test, Test>>>)null; //warn - outer Class w/ non raw param (2) Object o7 = (Test<Class, Class>)null; //warn - inner raw (2) Object o8 = (Test<Class<Test>, Class<Test>>)null; //warn - inner Class (2) boolean b = null instanceof Test; //no warn - raw and instanceof }
1,142
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T6747671.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/warnings/6747671/T6747671.java
/** * @test /nodynamiccopyright/ * @bug 6747671 * @summary -Xlint:rawtypes * @compile/ref=T6747671.out -XDrawDiagnostics -Xlint:rawtypes T6747671.java */ class T6747671<E> { static class B<X> {} class A<X> { class X {} class Z<Y> {} } A.X x1;//raw warning A.Z z1;//raw warning T6747671.B<Integer> b1;//ok T6747671.B b2;//raw warning A<String>.X x2;//ok A<String>.Z<Integer> z2;//ok A<B>.Z<A<B>> z3;//raw warning (2) void test(Object arg1, B arg2) {//raw warning boolean b = arg1 instanceof A;//ok Object a = (A)arg1;//ok A a2 = new A() {};//raw warning (2) a2.new Z() {};//raw warning } }
699
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
DeprecatedClass.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/warnings/6594914/DeprecatedClass.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. */ @Deprecated class DeprecatedClass extends Exception {}
1,107
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T6594914b.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/warnings/6594914/T6594914b.java
/** * @test /nodynamiccopyright/ * @bug 6594914 * @summary \\@SuppressWarnings("deprecation") does not not work for the type of a variable * @compile/ref=T6594914b.out -XDenableSunApiLintControl -XDrawDiagnostics -Xlint:sunapi T6594914b.java */ class T6747671b { sun.misc.Lock a1; //warn @SuppressWarnings("sunapi") sun.misc.Lock a2; <X extends sun.misc.Lock> sun.misc.Lock m1(sun.misc.Lock a) throws sun.misc.CEFormatException { return null; } //warn @SuppressWarnings("sunapi") <X extends sun.misc.Lock> sun.misc.Lock m2(sun.misc.Lock a) throws sun.misc.CEFormatException { return null; } void test() { sun.misc.Lock a1; //warn @SuppressWarnings("sunapi") sun.misc.Lock a2; } }
773
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T6594914a.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/warnings/6594914/T6594914a.java
/** * @test /nodynamiccopyright/ * @bug 6594914 * @summary \\@SuppressWarnings("deprecation") does not not work for the type of a variable * @compile/ref=T6594914a.out -XDrawDiagnostics -Xlint:deprecation T6594914a.java */ class T6747671a { DeprecatedClass a1; //warn @SuppressWarnings("deprecation") DeprecatedClass a2; <X extends DeprecatedClass> DeprecatedClass m1(DeprecatedClass a) throws DeprecatedClass { return null; } //warn @SuppressWarnings("deprecation") <X extends DeprecatedClass> DeprecatedClass m2(DeprecatedClass a) throws DeprecatedClass { return null; } void test() { DeprecatedClass a1; //warn @SuppressWarnings("deprecation") DeprecatedClass a2; } }
764
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
MyProcessor.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/T6458823/MyProcessor.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. */ import java.util.Set; import javax.annotation.processing.*; import javax.lang.model.element.*; import javax.lang.model.util.ElementFilter; import javax.lang.model.SourceVersion; import static javax.tools.Diagnostic.Kind.*; @SupportedAnnotationTypes("*") public class MyProcessor extends AbstractProcessor { private Messager messager; public void init(ProcessingEnvironment processingEnv) { this.messager = processingEnv.getMessager(); } public boolean process(Set<? extends TypeElement> tes, RoundEnvironment renv) { if (!renv.processingOver()) { for(TypeElement e : ElementFilter.typesIn(renv.getRootElements())) { for (TypeParameterElement tp : e.getTypeParameters()) { if (tp.getSimpleName().toString().length() > 1) { messager.printMessage(WARNING, "Type param names should be of length 1", tp); } } } } return true; } public SourceVersion getSupportedSourceVersion() { return SourceVersion.latest(); } }
2,202
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T6458823.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/T6458823/T6458823.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 6458823 * @summary Messager messages on TypeParamterElements to not include position information. * * @compile MyProcessor.java T6458823.java * @run main T6458823 */ import java.io.File; import java.io.IOException; import java.io.Writer; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import javax.tools.Diagnostic; import javax.tools.DiagnosticCollector; import javax.tools.JavaCompiler; import javax.tools.JavaCompiler.CompilationTask; import javax.tools.JavaFileObject; import javax.tools.StandardJavaFileManager; import javax.tools.ToolProvider; public class T6458823 { public static void main(String[] args) throws Exception { JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); if (compiler == null) { throw new RuntimeException("can't get javax.tools.JavaCompiler!"); } DiagnosticCollector<JavaFileObject> diagColl = new DiagnosticCollector<JavaFileObject>(); StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null); List<String> options = new ArrayList<String>(); options.add("-processor"); options.add("MyProcessor"); options.add("-proc:only"); List<File> files = new ArrayList<File>(); files.add(new File(T6458823.class.getResource("TestClass.java").toURI())); final CompilationTask task = compiler.getTask(null, fm, diagColl, options, null, fm.getJavaFileObjectsFromFiles(files)); task.call(); int diagCount = 0; for (Diagnostic<? extends JavaFileObject> diag : diagColl.getDiagnostics()) { if (diag.getKind() != Diagnostic.Kind.WARNING) { throw new AssertionError("Only warnings expected"); } System.out.println(diag); if (diag.getPosition() == Diagnostic.NOPOS) { throw new AssertionError("No position info in message"); } if (diag.getSource() == null) { throw new AssertionError("No source info in message"); } diagCount++; } if (diagCount != 2) { throw new AssertionError("unexpected number of warnings: " + diagCount + ", expected: 2"); } } }
3,441
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
TestClass.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/T6458823/TestClass.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. */ class TestClass<XYZ, ABC> { }
1,082
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
SourcePath2.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/sourcePath2/SourcePath2.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 4648973 * @summary compiler does not emit code for second class in source file * @author gafter * * @compile/fail SourcePath2.java */ import p.SourcePath2A; public class SourcePath2 {}
1,264
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
SourcePath2A.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/sourcePath2/p/SourcePath2A.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 p; public class SourcePath2A { } class Trash { this_should_not compile_at_all; }
1,147
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T6397652.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/jvm/6397652/T6397652.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 6397652 * @summary javac compilation failure when imported class with $ sign in the name * @author Yuri Gaevsky * @author Peter von der Ah\u00e9 * @compile com/test/Test.java com/test/Test$Test.java com/test/Test$Test$Test.java * @compile T6397652.java */ import com.test.Test$Test$Test; public class T6397652 { Object obj = new Test$Test$Test(); }
1,439
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Test$Test.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/jvm/6397652/com/test/Test$Test.java
package com.test; public class Test$Test { public Test$Test(double value) { } }
91
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Test$Test$Test.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/jvm/6397652/com/test/Test$Test$Test.java
package com.test; public class Test$Test$Test { public Test$Test$Test() { } }
89
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Test.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/jvm/6397652/com/test/Test.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. */ package com.test; public class Test { public Test() { } }
1,121
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T7003595b.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/7003595/T7003595b.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 7003595 * @summary IncompatibleClassChangeError with unreferenced local class with subclass */ public class T7003595b { public static void main(String... args) throws Exception { class A {} class B extends A {} B.class.getSuperclass().getDeclaringClass(); } }
1,367
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T7003595.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/7003595/T7003595.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 7003595 * @summary IncompatibleClassChangeError with unreferenced local class with subclass */ import com.sun.source.util.JavacTask; import com.sun.tools.classfile.Attribute; import com.sun.tools.classfile.ClassFile; import com.sun.tools.classfile.InnerClasses_attribute; import com.sun.tools.classfile.ConstantPool.*; import com.sun.tools.javac.api.JavacTool; import java.io.File; import java.net.URI; import java.util.Arrays; import java.util.ArrayList; import javax.tools.JavaCompiler; import javax.tools.JavaFileObject; import javax.tools.SimpleJavaFileObject; import javax.tools.StandardJavaFileManager; import javax.tools.ToolProvider; public class T7003595 { /** global decls ***/ // Create a single file manager and reuse it for each compile to save time. static StandardJavaFileManager fm = JavacTool.create().getStandardFileManager(null, null, null); //statistics static int checkCount = 0; enum ClassKind { NESTED("static class #N { #B }", "$", true), INNER("class #N { #B }", "$", false), LOCAL_REF("void test() { class #N { #B }; new #N(); }", "$1", false), LOCAL_NOREF("void test() { class #N { #B }; }", "$1", false), ANON("void test() { new Object() { #B }; }", "$1", false), NONE("", "", false); String memberInnerStr; String sep; boolean staticAllowed; private ClassKind(String memberInnerStr, String sep, boolean staticAllowed) { this.memberInnerStr = memberInnerStr; this.sep = sep; this.staticAllowed = staticAllowed; } String getSource(String className, String outerName, String nested) { return memberInnerStr.replaceAll("#O", outerName). replaceAll("#N", className).replaceAll("#B", nested); } static String getClassfileName(String[] names, ClassKind[] outerKinds, int pos) { System.out.println(" pos = " + pos + " kind = " + outerKinds[pos] + " sep = " + outerKinds[pos].sep); String name = outerKinds[pos] != ANON ? names[pos] : ""; if (pos == 0) { return "Test" + outerKinds[pos].sep + name; } else { String outerStr = getClassfileName(names, outerKinds, pos - 1); return outerStr + outerKinds[pos].sep + name; } } boolean isAllowed(ClassKind nestedKind) { return nestedKind != NESTED || staticAllowed; } } enum LocalInnerClass { LOCAL_REF("class L {}; new L();", "Test$1L"), LOCAL_NOREF("class L {};", "Test$1L"), ANON("new Object() {};", "Test$1"), NONE("", ""); String localInnerStr; String canonicalInnerStr; private LocalInnerClass(String localInnerStr, String canonicalInnerStr) { this.localInnerStr = localInnerStr; this.canonicalInnerStr = canonicalInnerStr; } } public static void main(String... args) throws Exception { for (ClassKind ck1 : ClassKind.values()) { String cname1 = "C1"; for (ClassKind ck2 : ClassKind.values()) { if (!ck1.isAllowed(ck2)) continue; String cname2 = "C2"; for (ClassKind ck3 : ClassKind.values()) { if (!ck2.isAllowed(ck3)) continue; String cname3 = "C3"; new T7003595(new ClassKind[] {ck1, ck2, ck3}, new String[] { cname1, cname2, cname3 }).compileAndCheck(); } } } System.out.println("Total checks made: " + checkCount); } /** instance decls **/ ClassKind[] cks; String[] cnames; T7003595(ClassKind[] cks, String[] cnames) { this.cks = cks; this.cnames = cnames; } void compileAndCheck() throws Exception { final JavaCompiler tool = ToolProvider.getSystemJavaCompiler(); JavaSource source = new JavaSource(); JavacTask ct = (JavacTask)tool.getTask(null, fm, null, null, null, Arrays.asList(source)); ct.call(); verifyBytecode(source); } void verifyBytecode(JavaSource source) { for (int i = 0; i < 3 ; i ++) { if (cks[i] == ClassKind.NONE) break; checkCount++; String filename = cks[i].getClassfileName(cnames, cks, i); File compiledTest = new File(filename + ".class"); try { ClassFile cf = ClassFile.read(compiledTest); if (cf == null) { throw new Error("Classfile not found: " + filename); } InnerClasses_attribute innerClasses = (InnerClasses_attribute)cf.getAttribute(Attribute.InnerClasses); ArrayList<String> foundInnerSig = new ArrayList<>(); if (innerClasses != null) { for (InnerClasses_attribute.Info info : innerClasses.classes) { String foundSig = info.getInnerClassInfo(cf.constant_pool).getName(); foundInnerSig.add(foundSig); } } ArrayList<String> expectedInnerSig = new ArrayList<>(); //add inner class (if any) if (i < 2 && cks[i + 1] != ClassKind.NONE) { expectedInnerSig.add(cks[i + 1].getClassfileName(cnames, cks, i + 1)); } //add inner classes for (int j = 0 ; j != i + 1 && j < 3; j++) { expectedInnerSig.add(cks[j].getClassfileName(cnames, cks, j)); } if (expectedInnerSig.size() != foundInnerSig.size()) { throw new Error("InnerClasses attribute for " + cnames[i] + " has wrong size\n" + "expected " + expectedInnerSig.size() + "\n" + "found " + innerClasses.number_of_classes + "\n" + source); } for (String foundSig : foundInnerSig) { if (!expectedInnerSig.contains(foundSig)) { throw new Error("InnerClasses attribute for " + cnames[i] + " has unexpected signature: " + foundSig + "\n" + source + "\n" + expectedInnerSig); } } for (String expectedSig : expectedInnerSig) { if (!foundInnerSig.contains(expectedSig)) { throw new Error("InnerClasses attribute for " + cnames[i] + " does not contain expected signature: " + expectedSig + "\n" + source); } } } catch (Exception e) { e.printStackTrace(); throw new Error("error reading " + compiledTest +": " + e); } } } class JavaSource extends SimpleJavaFileObject { static final String source_template = "class Test { #C }"; String source; public JavaSource() { super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE); String c3 = cks[2].getSource(cnames[2], cnames[1], ""); String c2 = cks[1].getSource(cnames[1], cnames[0], c3); String c1 = cks[0].getSource(cnames[0], "Test", c2); source = source_template.replace("#C", c1); } @Override public String toString() { return source; } @Override public CharSequence getCharContent(boolean ignoreEncodingErrors) { return source; } } }
8,829
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
util.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/PackageClassAmbiguity/util.java
/* * Copyright (c) 1998, 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 java; import java.util.Set; class util { Set x; }
1,122
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Bad.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/PackageClassAmbiguity/Bad.java
/* * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4101529 * @summary The compiler used to create class names which were the same as * existing package names and vice-versa. The compiler now checks * for this before creating a package or a class. * @author turnidge * * @compile/fail Bad.java * @compile/fail util.java */ package java.lang.String; class Bad { }
1,418
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
BoxingConversionTest.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/types/BoxingConversionTest.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 7006109 * @summary Add test library to simplify the task of writing automated type-system tests * @author mcimadamore * @library . * @run main BoxingConversionTest */ import com.sun.tools.javac.code.Type; import com.sun.tools.javac.code.Type.*; import com.sun.tools.javac.code.Symbol.*; import java.lang.reflect.Array; import java.util.EnumSet; /** * Check invariants in assignment/method conversion involving boxing conversions */ public class BoxingConversionTest extends TypeHarness { Type[] types1; Type[] types2; Type[] types3; enum Result { OK_BOTH(true), FAIL_BOTH(false), OK_ASSIGN_ONLY(true); boolean value; Result(boolean value) { this.value = value; } } enum ConversionKind { ASSIGNMENT_CONVERSION(EnumSet.of(Result.OK_BOTH, Result.OK_ASSIGN_ONLY)) { @Override void check(TypeHarness harness, Type from, Type to, Result expected) { harness.assertAssignable(from, to, resSet.contains(expected)); } }, METHOD_CONVERSION(EnumSet.of(Result.OK_BOTH)) { @Override void check(TypeHarness harness, Type from, Type to, Result expected) { harness.assertConvertible(from, to, resSet.contains(expected)); } }; EnumSet<Result> resSet; private ConversionKind(EnumSet<Result> resSet) { this.resSet = resSet; } abstract void check(TypeHarness harness, Type from, Type to, Result expected); } enum TestKind { SIMPLE { @Override Type[] getFromTypes(BoxingConversionTest harness) { return harness.types1; } @Override Type[] getToTypes(BoxingConversionTest harness) { return harness.types1; } @Override Result[][] getResults(BoxingConversionTest harness) { return harness.results1; } }, CONSTANT_TYPES { @Override Type[] getFromTypes(BoxingConversionTest harness) { return harness.types2; } @Override Type[] getToTypes(BoxingConversionTest harness) { return harness.types3; } @Override Result[][] getResults(BoxingConversionTest harness) { return harness.results2; } }; abstract Type[] getFromTypes(BoxingConversionTest harness); abstract Type[] getToTypes(BoxingConversionTest harness); abstract Result[][] getResults(BoxingConversionTest harness); } static final Result T = Result.OK_BOTH; static final Result F = Result.FAIL_BOTH; static final Result A = Result.OK_ASSIGN_ONLY; Result[][] results1 = { //byte, short, int, long, float, double, char, bool, Byte, Short, Integer, Long, Float, Double, Character, Boolean /*byte*/ { T , T , T , T , T , T , F , F , T , F , F , F , F , F , F , F }, /*short*/ { F , T , T , T , T , T , F , F , F , T , F , F , F , F , F , F }, /*int*/ { F , F , T , T , T , T , F , F , F , F , T , F , F , F , F , F }, /*long*/ { F , F , F , T , T , T , F , F , F , F , F , T , F , F , F , F }, /*float*/ { F , F , F , F , T , T , F , F , F , F , F , F , T , F , F , F }, /*double*/ { F , F , F , F , F , T , F , F , F , F , F , F , F , T , F , F }, /*char*/ { F , F , T , T , T , T , T , F , F , F , F , F , F , F , T , F }, /*bool*/ { F , F , F , F , F , F , F , T , F , F , F , F , F , F , F , T }, /*Byte*/ { T , T , T , T , T , T , F , F , T , F , F , F , F , F , F , F }, /*Short*/ { F , T , T , T , T , T , F , F , F , T , F , F , F , F , F , F }, /*Integer*/ { F , F , T , T , T , T , F , F , F , F , T , F , F , F , F , F }, /*Long*/ { F , F , F , T , T , T , F , F , F , F , F , T , F , F , F , F }, /*Float*/ { F , F , F , F , T , T , F , F , F , F , F , F , T , F , F , F }, /*Double*/ { F , F , F , F , F , T , F , F , F , F , F , F , F , T , F , F }, /*Character*/ { F , F , T , T , T , T , T , F , F , F , F , F , F , F , T , F }, /*Boolean*/ { F , F , F , F , F , F , F , T , F , F , F , F , F , F , F , T }}; Result[][] results2 = { //Byte, Short, Integer, Long, Float, Double, Chararacter, Boolean /*byte*/ { T , F , F , F , F , F , F , F }, /*short*/ { F , T , F , F , F , F , F , F }, /*short1*/ { A , T , F , F , F , F , A , F }, /*short2*/ { F , T , F , F , F , F , A , F }, /*int*/ { F , F , T , F , F , F , F , F }, /*int1*/ { A , A , T , F , F , F , A , F }, /*int2*/ { F , A , T , F , F , F , A , F }, /*int4*/ { F , F , T , F , F , F , F , F }, /*long*/ { F , F , F , T , F , F , F , F }, /*long1*/ { F , F , F , T , F , F , F , F }, /*long2*/ { F , F , F , T , F , F , F , F }, /*long4*/ { F , F , F , T , F , F , F , F }, /*long8*/ { F , F , F , T , F , F , F , F }, /*float*/ { F , F , F , F , T , F , F , F }, /*float1*/ { F , F , F , F , T , F , F , F }, /*float2*/ { F , F , F , F , T , F , F , F }, /*float4*/ { F , F , F , F , T , F , F , F }, /*double*/ { F , F , F , F , F , T , F , F }, /*double1*/ { F , F , F , F , F , T , F , F }, /*double2*/ { F , F , F , F , F , T , F , F }, /*double4*/ { F , F , F , F , F , T , F , F }, /*double8*/ { F , F , F , F , F , T , F , F }, /*char*/ { F , F , F , F , F , F , T , F }, /*char1*/ { A , A , F , F , F , F , T , F }, /*char2*/ { F , A , F , F , F , F , T , F }, /*bool*/ { F , F , F , F , F , F , F , T }}; BoxingConversionTest() { Type[] primitiveTypes = new Type[] { predef.byteType, predef.shortType, predef.intType, predef.longType, predef.floatType, predef.doubleType, predef.charType, predef.booleanType }; Type[] boxedTypes = new Type[primitiveTypes.length]; for (int i = 0 ; i < primitiveTypes.length ; i++) { boxedTypes[i] = box(primitiveTypes[i]); } types1 = join(Type.class, primitiveTypes, boxedTypes); types2 = new Type[] { predef.byteType, predef.shortType, fac.Constant((short)0x0001), fac.Constant((short)0x0100), predef.intType, fac.Constant((int)0x0000_0001), fac.Constant((int)0x0000_0100), fac.Constant((int)0x0001_0000), predef.longType, fac.Constant((long)0x0000_0000_0000_0001L), fac.Constant((long)0x0000_0000_0000_0100L), fac.Constant((long)0x0000_0000_0001_0000L), fac.Constant((long)0x0001_0000_0000_0000L), predef.floatType, fac.Constant((float)0x0000_0001), fac.Constant((float)0x0000_0100), fac.Constant((float)0x0001_0000), predef.doubleType, fac.Constant((double)0x0000_0000_0000_0001L), fac.Constant((double)0x0000_0000_0000_0100L), fac.Constant((double)0x0000_0000_0001_0000L), fac.Constant((double)0x0001_0000_0000_0000L), predef.charType, fac.Constant((char)0x0001), fac.Constant((char)0x0100), predef.booleanType }; types3 = boxedTypes; } void testConversion(ConversionKind convKind, TestKind testKind) { Type[] rows = testKind.getFromTypes(this); Type[] cols = testKind.getToTypes(this); for (int i = 0; i < rows.length ; i++) { for (int j = 0; j < cols.length ; j++) { convKind.check(this, rows[i], cols[j], testKind.getResults(this)[i][j]); } } } @SuppressWarnings("unchecked") <T> T[] join(Class<T> type, T[]... args) { int totalLength = 0; for (T[] arr : args) { totalLength += arr.length; } T[] new_arr = (T[])Array.newInstance(type, totalLength); int idx = 0; for (T[] arr : args) { System.arraycopy(arr, 0, new_arr, idx, arr.length); idx += arr.length; } return new_arr; } public static void main(String[] args) { BoxingConversionTest harness = new BoxingConversionTest(); for (ConversionKind convKind : ConversionKind.values()) { for (TestKind testKind : TestKind.values()) { harness.testConversion(convKind, testKind); } } } }
11,277
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
CastTest.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/types/CastTest.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 7006109 * @summary Add test library to simplify the task of writing automated type-system tests * @author mcimadamore * @library . * @run main CastTest */ import com.sun.tools.javac.code.Type; import com.sun.tools.javac.code.Type.*; import com.sun.tools.javac.code.Symbol.*; import java.lang.reflect.Array; import static com.sun.tools.javac.code.Flags.*; /** * Check invariants in cast conversion involving primitive types and arrays */ public class CastTest extends TypeHarness { Type[] types_no_boxing; Type[] types_boxing; static final boolean T = true; static final boolean F = false; boolean[][] cast_result_no_boxing = { //byte, short, int, long, float, double, char, bool, C, +C, I, T, byte[], short[], int[], long[], float[], double[], char[], bool[], C[], +C[], I[], T[] /*byte*/ { T , T , T , T , T , T , T , F , F, F , F, F, F , F , F , F , F , F , F , F , F , F , F , F }, /*short*/ { T , T , T , T , T , T , T , F , F, F , F, F, F , F , F , F , F , F , F , F , F , F , F , F }, /*int*/ { T , T , T , T , T , T , T , F , F, F , F, F, F , F , F , F , F , F , F , F , F , F , F , F }, /*long*/ { T , T , T , T , T , T , T , F , F, F , F, F, F , F , F , F , F , F , F , F , F , F , F , F }, /*float*/ { T , T , T , T , T , T , T , F , F, F , F, F, F , F , F , F , F , F , F , F , F , F , F , F }, /*double*/ { T , T , T , T , T , T , T , F , F, F , F, F, F , F , F , F , F , F , F , F , F , F , F , F }, /*char*/ { T , T , T , T , T , T , T , F , F, F , F, F, F , F , F , F , F , F , F , F , F , F , F , F }, /*bool*/ { F , F , F , F , F , F , F , T , F, F , F, F, F , F , F , F , F , F , F , F , F , F , F , F }, /*C*/ { F , F , F , F , F , F , F , F , T, F , T, T, F , F , F , F , F , F , F , F , F , F , F , F }, /*+C*/ { F , F , F , F , F , F , F , F , F, T , F, T, F , F , F , F , F , F , F , F , F , F , F , F }, /*I*/ { F , F , F , F , F , F , F , F , T, F , T, T, F , F , F , F , F , F , F , F , F , F , F , F }, /*T*/ { F , F , F , F , F , F , F , F , T, T , T, T, T , T , T , T , T , T , T , T , T , T , T , T }, /*byte[]*/ { F , F , F , F , F , F , F , F , F, F , F, T, T , F , F , F , F , F , F , F , F , F , F , F }, /*short[]*/ { F , F , F , F , F , F , F , F , F, F , F, T, F , T , F , F , F , F , F , F , F , F , F , F }, /*int[]*/ { F , F , F , F , F , F , F , F , F, F , F, T, F , F , T , F , F , F , F , F , F , F , F , F }, /*long[]*/ { F , F , F , F , F , F , F , F , F, F , F, T, F , F , F , T , F , F , F , F , F , F , F , F }, /*float[]*/ { F , F , F , F , F , F , F , F , F, F , F, T, F , F , F , F , T , F , F , F , F , F , F , F }, /*double[]*/{ F , F , F , F , F , F , F , F , F, F , F, T, F , F , F , F , F , T , F , F , F , F , F , F }, /*char[]*/ { F , F , F , F , F , F , F , F , F, F , F, T, F , F , F , F , F , F , T , F , F , F , F , F }, /*bool[]*/ { F , F , F , F , F , F , F , F , F, F , F, T, F , F , F , F , F , F , F , T , F , F , F , F }, /*C[]*/ { F , F , F , F , F , F , F , F , F, F , F, T, F , F , F , F , F , F , F , F , T , F , T , T }, /*+C[]*/ { F , F , F , F , F , F , F , F , F, F , F, T, F , F , F , F , F , F , F , F , F , T , F , T }, /*I[]*/ { F , F , F , F , F , F , F , F , F, F , F, T, F , F , F , F , F , F , F , F , T , F , T , T }, /*T[]*/ { F , F , F , F , F , F , F , F , F, F , F, T, F , F , F , F , F , F , F , F , T , T , T , T }}; boolean[][] cast_result_boxing = { //byte, short, int, long, float, double, char, bool, Byte, Short, Integer, Long, Float, Double, Character, Boolean, Object /*byte*/ { T , T , T , T , T , T , T , F , T , F , F , F , F , F , F , F , T }, /*short*/ { T , T , T , T , T , T , T , F , F , T , F , F , F , F , F , F , T }, /*int*/ { T , T , T , T , T , T , T , F , F , F , T , F , F , F , F , F , T }, /*long*/ { T , T , T , T , T , T , T , F , F , F , F , T , F , F , F , F , T }, /*float*/ { T , T , T , T , T , T , T , F , F , F , F , F , T , F , F , F , T }, /*double*/ { T , T , T , T , T , T , T , F , F , F , F , F , F , T , F , F , T }, /*char*/ { T , T , T , T , T , T , T , F , F , F , F , F , F , F , T , F , T }, /*bool*/ { F , F , F , F , F , F , F , T , F , F , F , F , F , F , F , T , T }, /*Byte*/ { T , T , T , T , T , T , F , F , T , F , F , F , F , F , F , F , T }, /*Short*/ { F , T , T , T , T , T , F , F , F , T , F , F , F , F , F , F , T }, /*Integer*/ { F , F , T , T , T , T , F , F , F , F , T , F , F , F , F , F , T }, /*Long*/ { F , F , F , T , T , T , F , F , F , F , F , T , F , F , F , F , T }, /*Float*/ { F , F , F , F , T , T , F , F , F , F , F , F , T , F , F , F , T }, /*Double*/ { F , F , F , F , F , T , F , F , F , F , F , F , F , T , F , F , T }, /*Character*/ { F , F , T , T , T , T , T , F , F , F , F , F , F , F , T , F , T }, /*Boolean*/ { F , F , F , F , F , F , F , T , F , F , F , F , F , F , F , T , T }, /*Object*/ { T , T , T , T , T , T , T , T , T , T , T , T , T , T , T , T , T }}; CastTest() { Type[] primitiveTypes = { predef.byteType, predef.shortType, predef.intType, predef.longType, predef.floatType, predef.doubleType, predef.charType, predef.booleanType }; Type[] boxedTypes = new Type[primitiveTypes.length + 1]; for (int i = 0 ; i < primitiveTypes.length ; i++) { boxedTypes[i] = box(primitiveTypes[i]); } boxedTypes[primitiveTypes.length] = predef.objectType; types_boxing = join(Type.class, primitiveTypes, boxedTypes); Type[] referenceTypes = { fac.Class(), fac.Class(FINAL), fac.Interface(), fac.TypeVariable() }; Type[] arrayTypes = new Type[primitiveTypes.length + referenceTypes.length]; int idx = 0; for (Type t : join(Type.class, primitiveTypes, referenceTypes)) { arrayTypes[idx++] = fac.Array(t); } types_no_boxing = join(Type.class, primitiveTypes, referenceTypes, arrayTypes); } void test(Type[] all_types, boolean[][] cast_result) { for (int i = 0; i < all_types.length ; i++) { for (int j = 0; j < all_types.length ; j++) { assertCastable(all_types[i], all_types[j], cast_result[i][j]); } } } void runTests() { test(types_no_boxing, cast_result_no_boxing); test(types_boxing, cast_result_boxing); } @SuppressWarnings("unchecked") <T> T[] join(Class<T> type, T[]... args) { int totalLength = 0; for (T[] arr : args) { totalLength += arr.length; } T[] new_arr = (T[])Array.newInstance(type, totalLength); int idx = 0; for (T[] arr : args) { System.arraycopy(arr, 0, new_arr, idx, arr.length); idx += arr.length; } return new_arr; } public static void main(String[] args) { new CastTest().runTests(); } }
10,604
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
PrimitiveConversionTest.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/types/PrimitiveConversionTest.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 7006109 * @summary Add test library to simplify the task of writing automated type-system tests * @author mcimadamore * @library . * @run main PrimitiveConversionTest */ import com.sun.tools.javac.code.Type; import com.sun.tools.javac.code.Type.*; import com.sun.tools.javac.code.Symbol.*; import java.lang.reflect.Array; import java.util.EnumSet; /** * Check invariants in assignment/method conversion involving primitive types and arrays */ public class PrimitiveConversionTest extends TypeHarness { Type[] types1; Type[] types2; Type[] types3; enum Result { OK_BOTH(true), FAIL_BOTH(false), OK_ASSIGN_ONLY(true); boolean value; Result(boolean value) { this.value = value; } } enum ConversionKind { ASSIGNMENT_CONVERSION(EnumSet.of(Result.OK_BOTH, Result.OK_ASSIGN_ONLY)) { @Override void check(TypeHarness harness, Type from, Type to, Result expected) { harness.assertAssignable(from, to, resSet.contains(expected)); } }, METHOD_CONVERSION(EnumSet.of(Result.OK_BOTH)) { @Override void check(TypeHarness harness, Type from, Type to, Result expected) { harness.assertConvertible(from, to, resSet.contains(expected)); } }; EnumSet<Result> resSet; private ConversionKind(EnumSet<Result> resSet) { this.resSet = resSet; } abstract void check(TypeHarness harness, Type from, Type to, Result expected); } enum TestKind { SIMPLE { @Override Type[] getFromTypes(PrimitiveConversionTest harness) { return harness.types1; } @Override Type[] getToTypes(PrimitiveConversionTest harness) { return harness.types1; } @Override Result[][] getResults(PrimitiveConversionTest harness) { return harness.results1; } }, CONSTANT_TYPES { @Override Type[] getFromTypes(PrimitiveConversionTest harness) { return harness.types2; } @Override Type[] getToTypes(PrimitiveConversionTest harness) { return harness.types3; } @Override Result[][] getResults(PrimitiveConversionTest harness) { return harness.results2; } }; abstract Type[] getFromTypes(PrimitiveConversionTest harness); abstract Type[] getToTypes(PrimitiveConversionTest harness); abstract Result[][] getResults(PrimitiveConversionTest harness); } static final Result T = Result.OK_BOTH; static final Result F = Result.FAIL_BOTH; static final Result A = Result.OK_ASSIGN_ONLY; Result[][] results1 = { //byte, short, int, long, float, double, char, bool, C1, C2, C3, T , byte[], short[], int[], long[], float[], double[], char[], bool[], C1[], C2[], C3[], T[] /*byte*/ { T , T , T , T , T , T , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F }, /*short*/ { F , T , T , T , T , T , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F }, /*int*/ { F , F , T , T , T , T , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F }, /*long*/ { F , F , F , T , T , T , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F }, /*float*/ { F , F , F , F , T , T , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F }, /*double*/ { F , F , F , F , F , T , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F }, /*char*/ { F , F , T , T , T , T , T , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F }, /*bool*/ { F , F , F , F , F , F , F , T , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F }, /*C1*/ { F , F , F , F , F , F , F , F , T , F , T , F , F , F , F , F , F , F , F , F , F , F , F , F }, /*C2*/ { F , F , F , F , F , F , F , F , T , T , T , F , F , F , F , F , F , F , F , F , F , F , F , F }, /*C3*/ { F , F , F , F , F , F , F , F , T , F , T , F , F , F , F , F , F , F , F , F , F , F , F , F }, /*T*/ { F , F , F , F , F , F , F , F , F , F , F , T , F , F , F , F , F , F , F , F , F , F , F , F }, /*byte[]*/ { F , F , F , F , F , F , F , F , F , F , F , F , T , F , F , F , F , F , F , F , F , F , F , F }, /*short[]*/ { F , F , F , F , F , F , F , F , F , F , F , F , F , T , F , F , F , F , F , F , F , F , F , F }, /*int[]*/ { F , F , F , F , F , F , F , F , F , F , F , F , F , F , T , F , F , F , F , F , F , F , F , F }, /*long[]*/ { F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , T , F , F , F , F , F , F , F , F }, /*float[]*/ { F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , T , F , F , F , F , F , F , F }, /*double[]*/{ F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , T , F , F , F , F , F , F }, /*char[]*/ { F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , T , F , F , F , F , F }, /*bool[]*/ { F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , T , F , F , F , F }, /*C1[]*/ { F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , T , F , T , F }, /*C2[]*/ { F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , T , T , T , F }, /*C3[]*/ { F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , T , F , T , F }, /*T[]*/ { F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , F , T }}; Result[][] results2 = { //byte, short, int, long, float, double, char, bool /*byte*/ { T , T , T , T , T , T , F , F }, /*short*/ { F , T , T , T , T , T , F , F }, /*short1*/ { A , T , T , T , T , T , A , F }, /*short2*/ { F , T , T , T , T , T , A , F }, /*int*/ { F , F , T , T , T , T , F , F }, /*int1*/ { A , A , T , T , T , T , A , F }, /*int2*/ { F , A , T , T , T , T , A , F }, /*int4*/ { F , F , T , T , T , T , F , F }, /*long*/ { F , F , F , T , T , T , F , F }, /*long1*/ { F , F , F , T , T , T , F , F }, /*long2*/ { F , F , F , T , T , T , F , F }, /*long4*/ { F , F , F , T , T , T , F , F }, /*long8*/ { F , F , F , T , T , T , F , F }, /*float*/ { F , F , F , F , T , T , F , F }, /*float1*/ { F , F , F , F , T , T , F , F }, /*float2*/ { F , F , F , F , T , T , F , F }, /*float4*/ { F , F , F , F , T , T , F , F }, /*double*/ { F , F , F , F , F , T , F , F }, /*double1*/ { F , F , F , F , F , T , F , F }, /*double2*/ { F , F , F , F , F , T , F , F }, /*double4*/ { F , F , F , F , F , T , F , F }, /*double8*/ { F , F , F , F , F , T , F , F }, /*char*/ { F , F , T , T , T , T , T , F }, /*char1*/ { A , A , T , T , T , T , T , F }, /*char2*/ { F , A , T , T , T , T , T , F }, /*bool*/ { F , F , F , F , F , F , F , T }}; PrimitiveConversionTest() { Type[] primitiveTypes = new Type[] { predef.byteType, predef.shortType, predef.intType, predef.longType, predef.floatType, predef.doubleType, predef.charType, predef.booleanType }; ClassType c1 = fac.Class(fac.TypeVariable()); ClassType c2 = fac.Class(); c2.supertype_field = subst(c1, Mapping(c1.getTypeArguments().head, predef.stringType)); Type c3 = erasure(c1); Type[] referenceTypes = { subst(c1, Mapping(c1.getTypeArguments().head, predef.stringType)), c2, c3, fac.TypeVariable() }; Type[] arrayTypes = new Type[primitiveTypes.length + referenceTypes.length]; int idx = 0; for (Type t : join(Type.class, primitiveTypes, referenceTypes)) { arrayTypes[idx++] = fac.Array(t); } types1 = join(Type.class, primitiveTypes, referenceTypes, arrayTypes); types2 = new Type[] { predef.byteType, predef.shortType, fac.Constant((short)0x0001), fac.Constant((short)0x0100), predef.intType, fac.Constant((int)0x0000_0001), fac.Constant((int)0x0000_0100), fac.Constant((int)0x0001_0000), predef.longType, fac.Constant((long)0x0000_0000_0000_0001L), fac.Constant((long)0x0000_0000_0000_0100L), fac.Constant((long)0x0000_0000_0001_0000L), fac.Constant((long)0x0001_0000_0000_0000L), predef.floatType, fac.Constant((float)0x0000_0001), fac.Constant((float)0x0000_0100), fac.Constant((float)0x0001_0000), predef.doubleType, fac.Constant((double)0x0000_0000_0000_0001L), fac.Constant((double)0x0000_0000_0000_0100L), fac.Constant((double)0x0000_0000_0001_0000L), fac.Constant((double)0x0001_0000_0000_0000L), predef.charType, fac.Constant((char)0x0001), fac.Constant((char)0x0100), predef.booleanType }; types3 = primitiveTypes; } void testConversion(ConversionKind convKind, TestKind testKind) { Type[] rows = testKind.getFromTypes(this); Type[] cols = testKind.getToTypes(this); for (int i = 0; i < rows.length ; i++) { for (int j = 0; j < cols.length ; j++) { convKind.check(this, rows[i], cols[j], testKind.getResults(this)[i][j]); } } } @SuppressWarnings("unchecked") <T> T[] join(Class<T> type, T[]... args) { int totalLength = 0; for (T[] arr : args) { totalLength += arr.length; } T[] new_arr = (T[])Array.newInstance(type, totalLength); int idx = 0; for (T[] arr : args) { System.arraycopy(arr, 0, new_arr, idx, arr.length); idx += arr.length; } return new_arr; } public static void main(String[] args) { PrimitiveConversionTest harness = new PrimitiveConversionTest(); for (ConversionKind convKind : ConversionKind.values()) { for (TestKind testKind : TestKind.values()) { harness.testConversion(convKind, testKind); } } } }
13,678
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
TypeHarness.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/types/TypeHarness.java
/* * Copyright (c) 2010, 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. */ import com.sun.tools.javac.code.BoundKind; import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.code.Types; import com.sun.tools.javac.code.Symtab; import com.sun.tools.javac.code.Type; import com.sun.tools.javac.code.Type.*; import com.sun.tools.javac.code.Symbol.*; import com.sun.tools.javac.comp.Check; import com.sun.tools.javac.util.List; import com.sun.tools.javac.util.ListBuffer; import com.sun.tools.javac.util.Name; import com.sun.tools.javac.util.Names; import com.sun.tools.javac.file.JavacFileManager; /** * Test harness whose goal is to simplify the task of writing type-system * regression test. It provides functionalities to build custom types as well * as to access the underlying javac's symbol table in order to retrieve * predefined types. Among the features supported by the harness are: type * substitution, type containment, subtyping, cast-conversion, assigment * conversion. * * This class is meant to be a common super class for all concrete type test * classes. A subclass can access the type-factory and the test methods so as * to write compact tests. An example is reported below: * * <pre> * Type X = fac.TypeVariable(); * Type Y = fac.TypeVariable(); * Type A_X_Y = fac.Class(0, X, Y); * Type A_Obj_Obj = fac.Class(0, * predef.objectType, * predef.objectType); * checkSameType(A_Obj_Obj, subst(A_X_Y, * Mapping(X, predef.objectType), * Mapping(Y, predef.objectType))); * </pre> * * The above code is used to create two class types, namely {@code A<X,Y>} and * {@code A<Object,Object>} where both {@code X} and {@code Y} are type-variables. * The code then verifies that {@code [X:=Object,Y:=Object]A<X,Y> == A<Object,Object>}. * * @author mcimadamore */ public class TypeHarness { protected Types types; protected Check chk; protected Symtab predef; protected Names names; protected Factory fac; protected TypeHarness() { Context ctx = new Context(); JavacFileManager.preRegister(ctx); types = Types.instance(ctx); chk = Check.instance(ctx); predef = Symtab.instance(ctx); names = Names.instance(ctx); fac = new Factory(); } // <editor-fold defaultstate="collapsed" desc="type assertions"> /** assert that 's' is a subtype of 't' */ public void assertSubtype(Type s, Type t) { assertSubtype(s, t, true); } /** assert that 's' is/is not a subtype of 't' */ public void assertSubtype(Type s, Type t, boolean expected) { if (types.isSubtype(s, t) != expected) { String msg = expected ? " is not a subtype of " : " is a subtype of "; error(s + msg + t); } } /** assert that 's' is the same type as 't' */ public void assertSameType(Type s, Type t) { assertSameType(s, t, true); } /** assert that 's' is/is not the same type as 't' */ public void assertSameType(Type s, Type t, boolean expected) { if (types.isSameType(s, t) != expected) { String msg = expected ? " is not the same type as " : " is the same type as "; error(s + msg + t); } } /** assert that 's' is castable to 't' */ public void assertCastable(Type s, Type t) { assertCastable(s, t, true); } /** assert that 's' is/is not castable to 't' */ public void assertCastable(Type s, Type t, boolean expected) { if (types.isCastable(s, t) != expected) { String msg = expected ? " is not castable to " : " is castable to "; error(s + msg + t); } } /** assert that 's' is convertible (method invocation conversion) to 't' */ public void assertConvertible(Type s, Type t) { assertCastable(s, t, true); } /** assert that 's' is/is not convertible (method invocation conversion) to 't' */ public void assertConvertible(Type s, Type t, boolean expected) { if (types.isConvertible(s, t) != expected) { String msg = expected ? " is not convertible to " : " is convertible to "; error(s + msg + t); } } /** assert that 's' is assignable to 't' */ public void assertAssignable(Type s, Type t) { assertCastable(s, t, true); } /** assert that 's' is/is not assignable to 't' */ public void assertAssignable(Type s, Type t, boolean expected) { if (types.isAssignable(s, t) != expected) { String msg = expected ? " is not assignable to " : " is assignable to "; error(s + msg + t); } } /** assert that generic type 't' is well-formed */ public void assertValidGenericType(Type t) { assertValidGenericType(t, true); } /** assert that 's' is/is not assignable to 't' */ public void assertValidGenericType(Type t, boolean expected) { if (chk.checkValidGenericType(t) != expected) { String msg = expected ? " is not a valid generic type" : " is a valid generic type"; error(t + msg + " " + t.tsym.type); } } // </editor-fold> private void error(String msg) { throw new AssertionError("Unexpected result: " + msg); } // <editor-fold defaultstate="collapsed" desc="type functions"> /** compute the erasure of a type 't' */ public Type erasure(Type t) { return types.erasure(t); } /** compute the capture of a type 't' */ public Type capture(Type t) { return types.capture(t); } /** compute the boxed type associated with 't' */ public Type box(Type t) { if (!t.isPrimitive()) { throw new AssertionError("Cannot box non-primitive type: " + t); } return types.boxedClass(t).type; } /** compute the unboxed type associated with 't' */ public Type unbox(Type t) { Type u = types.unboxedType(t); if (t == null) { throw new AssertionError("Cannot unbox reference type: " + t); } else { return u; } } /** compute a type substitution on 't' given a list of type mappings */ public Type subst(Type t, Mapping... maps) { ListBuffer<Type> from = ListBuffer.lb(); ListBuffer<Type> to = ListBuffer.lb(); for (Mapping tm : maps) { from.append(tm.from); to.append(tm.to); } return types.subst(t, from.toList(), to.toList()); } /** create a fresh type mapping from a type to another */ public Mapping Mapping(Type from, Type to) { return new Mapping(from, to); } public static class Mapping { Type from; Type to; private Mapping(Type from, Type to) { this.from = from; this.to = to; } } // </editor-fold> // <editor-fold defaultstate="collapsed" desc="type factory"> /** * This class is used to create Java types in a simple way. All main * kinds of type are supported: primitive, reference, non-denotable. The * factory also supports creation of constant types (used by the compiler * to represent the type of a literal). */ public class Factory { private int synthNameCount = 0; private Name syntheticName() { return names.fromString("A$" + synthNameCount++); } public ClassType Class(long flags, Type... typeArgs) { ClassSymbol csym = new ClassSymbol(flags, syntheticName(), predef.noSymbol); csym.type = new ClassType(Type.noType, List.from(typeArgs), csym); ((ClassType)csym.type).supertype_field = predef.objectType; return (ClassType)csym.type; } public ClassType Class(Type... typeArgs) { return Class(0, typeArgs); } public ClassType Interface(Type... typeArgs) { return Class(Flags.INTERFACE, typeArgs); } public ClassType Interface(long flags, Type... typeArgs) { return Class(Flags.INTERFACE | flags, typeArgs); } public Type Constant(byte b) { return predef.byteType.constType(b); } public Type Constant(short s) { return predef.shortType.constType(s); } public Type Constant(int i) { return predef.intType.constType(i); } public Type Constant(long l) { return predef.longType.constType(l); } public Type Constant(float f) { return predef.floatType.constType(f); } public Type Constant(double d) { return predef.doubleType.constType(d); } public Type Constant(char c) { return predef.charType.constType(c + 0); } public ArrayType Array(Type elemType) { return new ArrayType(elemType, predef.arrayClass); } public TypeVar TypeVariable() { return TypeVariable(predef.objectType); } public TypeVar TypeVariable(Type bound) { TypeSymbol tvsym = new TypeSymbol(0, syntheticName(), null, predef.noSymbol); tvsym.type = new TypeVar(tvsym, bound, null); return (TypeVar)tvsym.type; } public WildcardType Wildcard(BoundKind bk, Type bound) { return new WildcardType(bound, bk, predef.boundClass); } public CapturedType CapturedVariable(Type upper, Type lower) { return new CapturedType(syntheticName(), predef.noSymbol, upper, lower, null); } public ClassType Intersection(Type classBound, Type... intfBounds) { ClassType ct = Class(Flags.COMPOUND); ct.supertype_field = classBound; ct.interfaces_field = List.from(intfBounds); return ct; } } // </editor-fold> }
11,158
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
CastObjectToPrimitiveTest.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/types/CastObjectToPrimitiveTest.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 7038363 * @summary cast from object to primitive should be for source >= 1.7 * @compile/fail/ref=CastObjectToPrimitiveTest.out -XDrawDiagnostics -Xlint:-options -source 5 CastObjectToPrimitiveTest.java * @compile/fail/ref=CastObjectToPrimitiveTest.out -XDrawDiagnostics -Xlint:-options -source 6 CastObjectToPrimitiveTest.java * @compile CastObjectToPrimitiveTest.java */ class CastObjectToPrimitiveTest { void m() { Object o = 42; int i = (int) o; } }
1,555
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
GenericTypeWellFormednessTest.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/types/GenericTypeWellFormednessTest.java
/* * Copyright (c) 2010, 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 7007432 7006109 * @summary Test generic types well-formedness * @author mcimadamore * @library . * @run main GenericTypeWellFormednessTest */ import com.sun.tools.javac.code.BoundKind; import com.sun.tools.javac.code.Type; import com.sun.tools.javac.code.Type.*; import com.sun.tools.javac.code.Symbol; import com.sun.tools.javac.code.Symbol.*; import java.lang.reflect.Array; /** * Check parameterized type well-formedness. This test executes a number of checks * in order to establish as to whether an instantiation of a generic type conforms * to the generic class' declared bounds. */ public class GenericTypeWellFormednessTest extends TypeHarness { static int executedCount = 0; static int ignoredCount = 0; InstantiableType[] rows; Type[] columns; static class InstantiableType { protected Type type; public InstantiableType(Type type) { this.type = type; } Type inst(Type clazz) { return type; } } enum Result { /* generic type is well-formed w.r.t. declared bounds */ OK(true), /* generic type is not well-formed w.r.t. declared bounds */ FAIL(false), /* generic type is not well-formed w.r.t. declared bounds according to the JLS 3rd, * but javac allows it (spec for generic type well-formedness is overly restrictive) * See regression test test/tools/generics/wildcards/T5097548.java */ IGNORE(false); boolean value; Result(boolean value) { this.value = value; } } static final Result T = Result.OK; static final Result F = Result.FAIL; static final Result I = Result.IGNORE; /*is a type in 'rows' a valid instantiation for the generic class in 'col' ? */ Result[][] isValidInstantiation = { //Foo<X>, Foo<X ext Object>, Foo<X ext Number>, Foo<X ext Foo<X>>, Foo<X ext Foo<+X>>, Foo<X ext Foo<-X>>, Foo<X ext Foo<?>> /*Foo<Object>*/ { T , T , F , F , F , F , F }, /*Foo<Number>*/ { T , T , T , F , F , F , F }, /*Foo<Integer>*/ { T , T , T , F , F , F , F }, /*Foo<Double>*/ { T , T , T , F , F , F , F }, /*Foo<String>*/ { T , T , F , F , F , F , F }, /*Foo<X1>*/ { T , T , F , F , F , F , F }, /*Foo<X2>*/ { T , T , T , F , F , F , F }, /*Foo<X3>*/ { T , T , T , F , F , F , F }, /*Foo<X4>*/ { T , T , T , F , F , F , F }, /*Foo<X5>*/ { T , T , F , F , F , F , F }, /*Foo<X6>*/ { T , T , F , T , T , T , T }, /*Foo<+Object>*/ { T , T , I , I , I , I , I }, /*Foo<+Number>*/ { T , T , T , F , F , F , F }, /*Foo<+Integer>*/{ T , T , T , F , F , F , F }, /*Foo<+Double>*/ { T , T , T , F , F , F , F }, /*Foo<+String>*/ { T , T , F , F , F , F , F }, /*Foo<+X1>*/ { T , T , F , F , F , F , F }, /*Foo<+X2>*/ { T , T , T , F , F , F , F }, /*Foo<+X3>*/ { T , T , T , F , F , F , F }, /*Foo<+X4>*/ { T , T , T , F , F , F , F }, /*Foo<+X5>*/ { T , T , F , F , F , F , F }, /*Foo<+X6>*/ { T , T , F , T , T , I , T }, /*Foo<-Object>*/ { T , T , F , F , F , F , F }, /*Foo<-Number>*/ { T , T , T , F , F , F , F }, /*Foo<-Integer>*/{ T , T , T , F , F , F , F }, /*Foo<-Double>*/ { T , T , T , F , F , F , F }, /*Foo<-String>*/ { T , T , F , F , F , F , F }, /*Foo<-X1>*/ { T , T , I , I , I , I , I }, /*Foo<-X2>*/ { T , T , I , F , F , F , F }, /*Foo<-X3>*/ { T , T , I , F , F , F , F }, /*Foo<-X4>*/ { T , T , I , F , F , F , F }, /*Foo<-X5>*/ { T , T , I , F , F , F , F }, /*Foo<-X6>*/ { T , T , F , T , I , I , T }, /*Foo<?>*/ { T , T , T , T , T , T , T }}; GenericTypeWellFormednessTest() { InstantiableType[] basicTypes = { new InstantiableType(predef.objectType), new InstantiableType(NumberType()), new InstantiableType(box(predef.intType)), new InstantiableType(box(predef.doubleType)), new InstantiableType(predef.stringType) }; InstantiableType[] typeVars = new InstantiableType[basicTypes.length + 1]; for (int i = 0 ; i < basicTypes.length ; i++) { typeVars[i] = new InstantiableType(fac.TypeVariable(basicTypes[i].type)); } typeVars[typeVars.length - 1] = new InstantiableType(null) { Type inst(Type clazz) { TypeVar tvar = fac.TypeVariable(); tvar.bound = subst(clazz, Mapping(clazz.getTypeArguments().head, tvar)); return tvar; } }; InstantiableType[] typeArgs = join(InstantiableType.class, basicTypes, typeVars); InstantiableType[] invariantTypes = new InstantiableType[typeArgs.length]; for (int i = 0 ; i < typeArgs.length ; i++) { final InstantiableType type1 = typeArgs[i]; invariantTypes[i] = new InstantiableType(typeArgs[i].type) { Type inst(Type clazz) { return subst(clazz, Mapping(clazz.getTypeArguments().head, type1.inst(clazz))); } }; } InstantiableType[] covariantTypes = new InstantiableType[typeArgs.length]; for (int i = 0 ; i < typeArgs.length ; i++) { final InstantiableType type1 = typeArgs[i]; covariantTypes[i] = new InstantiableType(null) { Type inst(Type clazz) { Type t = fac.Wildcard(BoundKind.EXTENDS, type1.inst(clazz)); return subst(clazz, Mapping(clazz.getTypeArguments().head, t)); } }; } InstantiableType[] contravariantTypes = new InstantiableType[typeArgs.length]; for (int i = 0 ; i < typeArgs.length ; i++) { final InstantiableType type1 = typeArgs[i]; contravariantTypes[i] = new InstantiableType(null) { Type inst(Type clazz) { Type t = fac.Wildcard(BoundKind.SUPER, type1.inst(clazz)); return subst(clazz, Mapping(clazz.getTypeArguments().head, t)); } }; } InstantiableType[] bivariantTypes = { new InstantiableType(fac.Wildcard(BoundKind.UNBOUND, predef.objectType)) { Type inst(Type clazz) { return subst(clazz, Mapping(clazz.getTypeArguments().head, type)); } } }; rows = join(InstantiableType.class, invariantTypes, covariantTypes, contravariantTypes, bivariantTypes); Type tv1 = fac.TypeVariable(); Type decl1 = fac.Class(tv1); Type tv2 = fac.TypeVariable(predef.objectType); Type decl2 = fac.Class(tv2); Type tv3 = fac.TypeVariable(NumberType()); Type decl3 = fac.Class(tv3); TypeVar tv4 = fac.TypeVariable(); Type decl4 = fac.Class(tv4); tv4.bound = decl4; tv4.tsym.name = predef.exceptionType.tsym.name; TypeVar tv5 = fac.TypeVariable(); Type decl5 = fac.Class(tv5); tv5.bound = subst(decl5, Mapping(tv5, fac.Wildcard(BoundKind.EXTENDS, tv5))); TypeVar tv6 = fac.TypeVariable(); Type decl6 = fac.Class(tv6); tv6.bound = subst(decl6, Mapping(tv6, fac.Wildcard(BoundKind.SUPER, tv6))); TypeVar tv7 = fac.TypeVariable(); Type decl7 = fac.Class(tv7); tv7.bound = subst(decl7, Mapping(tv7, fac.Wildcard(BoundKind.UNBOUND, predef.objectType))); columns = new Type[] { decl1, decl2, decl3, decl4, decl5, decl6, decl7 }; } void test() { for (int i = 0; i < rows.length ; i++) { for (int j = 0; j < columns.length ; j++) { Type decl = columns[j]; Type inst = rows[i].inst(decl); if (isValidInstantiation[i][j] != Result.IGNORE) { executedCount++; assertValidGenericType(inst, isValidInstantiation[i][j].value); } else { ignoredCount++; } } } } Type NumberType() { Symbol s = box(predef.intType).tsym; s.complete(); return ((ClassType)s.type).supertype_field; } @SuppressWarnings("unchecked") <T> T[] join(Class<T> type, T[]... args) { int totalLength = 0; for (T[] arr : args) { totalLength += arr.length; } T[] new_arr = (T[])Array.newInstance(type, totalLength); int idx = 0; for (T[] arr : args) { System.arraycopy(arr, 0, new_arr, idx, arr.length); idx += arr.length; } return new_arr; } public static void main(String[] args) { new GenericTypeWellFormednessTest().test(); System.out.println("Executed checks : " + executedCount); System.out.println("Ignored checks : " + ignoredCount); } }
12,813
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
InitializeTarget.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/ClassLiterals/InitializeTarget.java
/* * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4468823 * @summary class literal causes the referenced class to be initialized * @author gafter * * @compile InitializeTarget.java * @run main InitializeTarget */ public class InitializeTarget { public static void main(String[] args) { A.class.toString(); } } class A { static { if (true) throw new Error(); } }
1,430
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
ClassLiteralHelperContext.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/ClassLiterals/ClassLiteralHelperContext.java
/* * Copyright (c) 1998, 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 4106051 * @summary A helper method and cache cell should be defined for * every class containing a given class literal, ignoring any * equivalent members that may be inherited. * * @compile ClassLiteralHelperContext.java * @run main ClassLiteralHelperContext */ /* * A failing test will get an access error when run. */ import p1.*; public class ClassLiteralHelperContext extends SuperClass { Class c = C.class; public static void main(String[] args) { // Evaluation of literal 'C.class' will fail // during initialization if the (package private) // cache cell or helper method is inherited. ClassLiteralHelperContext x = new ClassLiteralHelperContext(); System.out.println(x.c); } }
1,828
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
LiteralInterface_3.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/ClassLiterals/LiteralInterface_3.java
/* * Copyright (c) 1998, 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. */ /* * Auxiliary file for "LiteralInterfaceImpl.java". */ interface LiteralInterface_3 { Class frob = Object.class; interface K { interface L { class M { } } } }
1,258
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
InnerClassLiterals.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/ClassLiterals/InnerClassLiterals.java
/* * Copyright (c) 1998, 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. */ /* * @bug 4030384 * @summary Verify inner class can be used in class literal. * Also includes a few other sanity checks. * @author William Maddox (maddox) * * @compile InnerClassLiterals.java * @run main InnerClassLiterals */ public class InnerClassLiterals { // Should not generate access errors. public static void main(String[] args) { Class x1 = int.class; Class x2 = float.class; Class x3 = void.class; Class x4 = String.class; Class x5 = Integer.class; Class x6 = InnerClassLiterals.class; // Bug 4030384: Compiler did not allow this. Class x7 = InnerClassLiterals.Inner1.class; Class x8 = InnerClassLiterals.Inner2.class; } class Inner1 {} static class Inner2 {} }
1,828
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
InitializeOuter.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/ClassLiterals/InitializeOuter.java
/* * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4401576 * @summary Using a class literal causes outermost class to be initialized early * @author gafter * * @compile InitializeOuter.java * @run main InitializeOuter */ public class InitializeOuter { public static void main(String[] args) { new A.B(); } } class A { static { if (true) throw new Error(); } public static class B { B() { Object o = InitializeOuter.class; } }; }
1,532
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
LiteralInterfaceImpl.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/ClassLiterals/LiteralInterfaceImpl.java
/* * Copyright (c) 1998, 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. */ /* * @bug 4055017 * @summary Test use of class literals within interfaces. * @author William Maddox (maddox) * * @compile LiteralInterface_1.java * @compile LiteralInterface_2.java * @compile LiteralInterface_3.java * @compile LiteralInterfaceImpl.java * @run main LiteralInterfaceImpl */ public class LiteralInterfaceImpl implements LiteralInterface_1, LiteralInterface_2, LiteralInterface_3 { private static void check(Class c1, Class c2) throws Exception{ if (c1 != c2) { throw new Exception("mismatch: " + c1 + ", " + c2); } } public static void main(String[] args) throws Exception { check(c1, Object.class); check(c2, Integer.class); check(foo, Object.class); check(bar, String.class); check(baz, Integer.class); // Due to another bug (4119981), // J is not inherited from LiteralInterface. // check(quux, J.class); check(quux, LiteralInterface_2.J.class); LiteralInterface_2.J o = new LiteralInterface_2.J(); check(o.quem, Float.class); } }
2,149
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
LiteralInterface_1.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/ClassLiterals/LiteralInterface_1.java
/* * Copyright (c) 1998, 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. */ /* * Auxiliary file for "LiteralInterfaceImpl.java". */ interface LiteralInterface_1 { Class c1 = Object.class; Class c2 = Integer.class; }
1,203
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
LiteralInterface_2.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/ClassLiterals/LiteralInterface_2.java
/* * Copyright (c) 1998, 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. */ /* * Auxiliary file for "LiteralInterfaceImpl.java". */ interface LiteralInterface_2 { Class foo = Object.class; Class bar = String.class; Class baz = Integer.class; Class quux = J.class; class J { Class quem = Float.class; } }
1,318
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/ClassLiterals/p1/C.java
/* * Copyright (c) 1998, 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. */ /* * Auxiliary file for ClassLiteralHelperContext test. * (4106051) */ package p1; public class C {}
1,158
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
SuperClass.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/ClassLiterals/p1/SuperClass.java
/* * Copyright (c) 1998, 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. */ /* * Auxiliary file for ClassLiteralHelperContext test. * (4106051) */ package p1; public class SuperClass { Class c = C.class; }
1,191
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
ClassLiteralEvalInit.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/ClassLiterals/evalinit/ClassLiteralEvalInit.java
/* * Copyright (c) 2000, 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 4256830 * @summary Check that references to TYPE fields generated during the translation * of class literals are handled correctly even if the wrapper classes haven't yet * been compiled. * * @compile ClassLiteralEvalInit.java */ public class ClassLiteralEvalInit { Class foo = int.class; }
1,374
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Integer.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/ClassLiterals/evalinit/java/lang/Integer.java
/* * Copyright (c) 2000, 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. */ // Dummy java.lang.Integer package java.lang; public final class Integer { public static final Class TYPE = null; }
1,174
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
AnonInnerClass.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/protectedInner/AnonInnerClass.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 4251061 * @summary Verify that we can access inherited, protected method from * an anonymous enclosing superclass. * * @run compile AnonInnerClass.java */ import java.util.Vector; // example superclass with protected method public class AnonInnerClass extends Vector { public static void main(String[] args) { new AnonInnerClass().test(); } public void test() { Runnable r = new Runnable() { public void run() { // call protected method of enclosing class' superclass AnonInnerClass.this.removeRange(0,0); } }; } }
1,693
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
InnerClass.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/protectedInner/InnerClass.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 4269441 * @summary Verify that we can access inherited, protected method from * an inner class. * * @run compile pkg2/Sub.java */ // The test passes if the compile is successful. // // The code necessary for this test is all contained within pkg1/Base.java // and pgk2/Sub.java.
1,358
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Outerclass.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/protectedInner/Outerclass.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 4860741 * @summary VerifyError occurs when 2nd inner class accesses method from outer most class * * @run compile Outerclass.java mypackage/Superclass.java * @run main Outerclass */ import mypackage.Superclass; public class Outerclass extends Superclass { Innerclass innerclass = new Innerclass(); private class Innerclass extends Superclass { InnermostClass innermostClass = new InnermostClass(); private class InnermostClass { public void doAnything() { Outerclass.this.doStuff(); } } } public static void main(String[] args) { new Outerclass(); } }
1,727
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Sub.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/protectedInner/pkg2/Sub.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. */ // Part of test ../ProtecteInner.java package pkg2; public class Sub extends pkg1.Base { private class Inner { public void run() { baseMethod(); Sub.this.baseMethod(); } } }
1,276
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Base.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/protectedInner/pkg1/Base.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. */ // Part of test ../ProtecteInner.java package pkg1; public class Base { protected void baseMethod() { } }
1,168
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Superclass.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/protectedInner/mypackage/Superclass.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. */ package mypackage; public class Superclass { protected void doStuff() { System.out.println("doing stuff"); } }
1,180
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
X.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/nested/5009484/X.java
/* * Copyright (c) 2005, 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 5009484 * @summary Compiler fails to resolve appropriate type for outer member * @author Philippe P Mulet * @compile/fail X.java */ public class X<T> { private T t; X(T t) { this.t = t; } public static void main(String[] args) { new X<String>("OUTER").bar(); } void bar() { new X<X>(this) { // #1 void run() { new Object() { // #2 void run() { X x = t; // #3 <--- which t is bound ? System.out.println(x); } }.run(); } }.run(); } }
1,714
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Y.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/nested/5009484/Y.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 5009484 * @summary Compiler fails to resolve appropriate type for outer member * @author Peter von der Ah\u00e9 * @compile/fail Y.java */ public class Y<T> { private T t; class Foo extends Y<Y<T>> { Y<T> y = t; } }
1,318
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T4903103.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/nested/4903103/T4903103.java
/* * Copyright (c) 2005, 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 4903103 * @summary Can't compile subclasses of inner classes */ public class T4903103 { private class InnerSuperclass extends T4903103 {} private class InnerSubclass extends InnerSuperclass {} public static void main(String[] args) { new T4903103().new InnerSubclass(); } }
1,386
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T6948381.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/6948381/T6948381.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 6948381 * @summary javac Null Pointer Exception in Types.makeCompoundType * @compile npe/A.java npe/B.java */
1,186
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/6948381/npe/A.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. */ package npe; import npe.B.*; public interface A {}
1,105
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/6948381/npe/B.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. */ package npe; public interface B<T extends A & java.io.Serializable> {}
1,124
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Mediator.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/packone/Mediator.java
/* * Copyright (c) 1998, 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. */ /* * Auxiliary file for EnclosingAccessCheck. */ package packone; public class Mediator { public Secret getSecret() { return new Secret(); } }
1,215
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Secret.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/packone/Secret.java
/* * Copyright (c) 1998, 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. */ /* * Auxiliary file for EnclosingAccessCheck. */ package packone; class Secret { public void greet() { System.out.println("hello"); } }
1,208
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
ClassModifiers.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/ClassFileModifiers/ClassModifiers.java
/* * Copyright (c) 1998, 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 4109894 4239646 4785453 * @summary Verify that class modifiers bits written into class * file are correct, including those within InnerClasses attributes. * @author John Rose (jrose). Entered as a regression test by Bill Maddox (maddox). * * @compile/ref=ClassModifiers.out -XDdumpmodifiers=ci ClassModifiers.java * */ class T { //all "protected" type members are transformed to "public" //all "private" type members are transformed to package-scope //all "static" type members are transformed to non-static //a class is one of {,public,private,protected}x{,static}x{,abstract,final} //all of these 24 combinations are legal //all of these 24 combinations generate distinct InnerClasses modifiers //transformed class modifiers can be {,public}x{,abstract,final} //thus, each of the next 6 groups of 4 have identical transformed modifiers class iC{} static class iSC{} private class iVC{} static private class iSVC{} final class iFC{} static final class iSFC{} final private class iFVC{} static final private class iSFVC{} abstract class iAC{} static abstract class iSAC{} abstract private class iAVC{} static abstract private class iSAVC{} protected class iRC{} static protected class iSRC{} public class iUC{} static public class iSUC{} final protected class iFRC{} static final protected class iSFRC{} final public class iFUC{} static final public class iSFUC{} abstract protected class iARC{} static abstract protected class iSARC{} abstract public class iAUC{} static abstract public class iSAUC{} //all interface members are automatically "static" whether marked so or not //all interfaces are automatically "abstract" whether marked so or not //thus, interface modifiers are only distinguished by access permissions //thus, each of the next 4 groups of 4 classes have identical modifiers interface iI{} static interface iSI{} abstract interface iAI{} static abstract interface iSAI{} protected interface iRI{} static protected interface iSRI{} abstract protected interface iARI{} static abstract protected interface iSARI{} private interface iVI{} static private interface iSVI{} abstract private interface iAVI{} static abstract private interface iSAVI{} public interface iUI{} static public interface iSUI{} abstract public interface iAUI{} static abstract public interface iSAUI{} } interface U { //no members can be "protected" or "private" //all type members are automatically "public" whether marked so or not //all type members are automatically "static" whether marked so or not //thus, each of the next 3 groups of 4 classes have identical modifiers class jC{} static class jSC{} public class jUC{} static public class jSUC{} final class jFC{} static final class jSFC{} final public class jFUC{} static final public class jSFUC{} abstract class jAC{} static abstract class jSAC{} abstract public class jAUC{} static abstract public class jSAUC{} //all interface members are automatically "static" whether marked so or not //all interfaces are automatically "abstract" whether marked so or not //thus, all 8 of the following classes have identical modifiers: interface jI{} static interface jSI{} abstract interface jAI{} static abstract interface jSAI{} public interface jUI{} static public interface jSUI{} abstract public interface jAUI{} static abstract public interface jSAUI{} }
4,481
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
MemberModifiers.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/ClassFileModifiers/MemberModifiers.java
/* * Copyright (c) 1999, 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 4249112 4785453 * @summary Verify that implicit member modifiers are set correctly. * * @compile/ref=MemberModifiers.out -source 1.4 -target 1.4.2 -Xlint:-options -XDdumpmodifiers=cfm MemberModifiers.java */ // Currently, we check only that members of final classes are not final. // Originally, we tested that methods were final, per the fix for 4249112. // This fix was backed out, however, based on a determination that the // ACC_FINAL bit need not actually be set, and should not be for compatibility // reasons. public final class MemberModifiers { //Should not be final. int f; void m() {}; class c {}; interface i {} } class MemberModifiersAux { final class Foo { //Should not be final. int f; void m() {}; class c {}; } }
1,884
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
UninitThis.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/stackmap/UninitThis.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 4948063 * @summary Invalid java.io.FileInputStream with v49 generate by javac * @author gafter */ // may fail due to VM bug 4948729 public class UninitThis { UninitThis(String s, int i) { this(i == 0 ? s : "foo"); } UninitThis(String s) {} public static void main(String... args) {} }
1,389
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T4955930.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/stackmap/T4955930.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. */ /* * @test * @bug 4955930 * @summary The "method0" StackMap attribute should have two entries instead of three * @author wtao * * @run shell T4955930.sh */ public class T4955930 { void method0(boolean aboolean) throws Exception { label_0: while (true) { if (aboolean) { ; } else { break label_0; } System.out.println(""); } } }
1,482
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Child2.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/NonAmbiguousField/two/Child2.java
/* * Copyright (c) 1998, 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 two; interface I { int i = 11; } public class Child2 extends one.Parent2 implements I { class inner { void method() { System.out.println(i); } } }
1,249
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Child.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/NonAmbiguousField/two/Child.java
/* * Copyright (c) 1998, 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 two; interface I { int i = 11; } public class Child extends one.Parent implements I { void method() { System.out.println(i); } }
1,211
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Parent2.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/NonAmbiguousField/one/Parent2.java
/* * Copyright (c) 1998, 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 one; public class Parent2 { protected int i; }
1,112
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Parent.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/NonAmbiguousField/one/Parent.java
/* * Copyright (c) 1998, 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 one; public class Parent { int i; }
1,101
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T6840059.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/6840059/T6840059.java
/* * @test /nodynamiccopyright/ * @bug 6840059 * @summary 6758789: Some method resolution diagnostic should be improved * @author Maurizio Cimadamore * * @compile/fail/ref=T6840059.out -XDrawDiagnostics T6840059.java */ class T6840059 { T6840059(Integer x) {} void test() { new T6840059(""){}; } }
328
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/6257443/package-info.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. */ @Deprecated package foo;
1,077
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T6257443.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/6257443/T6257443.java
/* * Copyright (c) 2005, 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 6257443 6350124 6357979 * @summary compiler can produce a .class file in some source output modes * * @compile package-info.java * @run main/othervm T6257443 -yes foo/package-info.class * * @clean foo.package-info * * @compile -XD-printflat package-info.java * @run main/othervm T6257443 -no foo/package-info.class * * @compile -XD-stubs package-info.java * @run main/othervm T6257443 -no foo/package-info.class * * @compile -XD-printsource package-info.java * @run main/othervm T6257443 -no foo/package-info.class */ import java.net.URL; public class T6257443 { public static void main(String[] args) { if (args.length != 2) throw new Error("wrong number of args"); String state = args[0]; String file = args[1]; if (state.equals("-no")) { URL u = find(file); if (u != null) throw new Error("file " + file + " found unexpectedly"); } else if (state.equals("-yes")) { URL u = find(file); if (u == null) throw new Error("file " + file + " not found"); } else throw new Error("bad args"); } public static URL find(String path) { return T6257443.class.getClassLoader().getSystemResource(path); } }
2,387
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Child.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/HiddenAbstractMethod/two/Child.java
/* * Copyright (c) 1998, 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 two; public class Child extends one.Parent { void method() {} }
1,129
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Parent.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/HiddenAbstractMethod/one/Parent.java
/* * Copyright (c) 1998, 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 one; public abstract class Parent { abstract void method(); }
1,127
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/policy/test3/A.java
class A { void m1() { System.err.println("hello"); 0 // syntax error System.err.println("world"); } void m2() { } }
157
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Test.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/policy/test3/Test.java
/* * Copyright (c) 2009, 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 6813059 * @summary */ import java.io.*; import java.util.*; // Simple test of -XDshouldStopPolicy. // For each of the permissable values, we compile a file with an error in it, // then using -XDverboseCompilePolicy we check that the compilation gets as // far as expected, but no further. public class Test { enum ShouldStopPolicy { BLANK(false, null, "attr"), PROCESS(true, null, "attr"), ATTR(true, "attr", "flow"), FLOW(true, "flow", "desugar"), TRANSTYPES(true, "desugar", "generate"), LOWER(true, "desugar", "generate"), GENERATE(true, "generate", null); ShouldStopPolicy(boolean needOption, String expect, String dontExpect) { this.needOption = needOption; this.expect = expect; this.dontExpect = dontExpect; } boolean needOption; String expect; String dontExpect; } enum CompilePolicy { BYFILE, BYTODO } public static void main(String... args) throws Exception { new Test().run(); } public void run() throws Exception { for (CompilePolicy cp: CompilePolicy.values()) { for (ShouldStopPolicy ssp: ShouldStopPolicy.values()) { test(cp, ssp); } } if (errors > 0) throw new Exception(errors + " errors occurred"); } public void test(CompilePolicy cp, ShouldStopPolicy ssp) { System.err.println(); System.err.println("test " + cp + " " + ssp); List<String> args = new ArrayList<String>(); args.add("-XDverboseCompilePolicy"); args.add("-XDcompilePolicy=" + cp.toString().toLowerCase()); args.add("-d"); args.add("."); if (ssp.needOption) args.add("-XDshouldStopPolicy=" + ssp); args.add(new File(System.getProperty("test.src", "."), "A.java").getPath()); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); System.err.println("compile " + args); int rc = com.sun.tools.javac.Main.compile(args.toArray(new String[args.size()]), pw); if (rc == 0) throw new Error("compilation succeeded unexpectedly"); //System.err.println(sw); // The following is a workaround for the current javac implementation, // that in bytodo mode, it will still attribute files after syntax errors. // Changing that behavior may surprise existing users, so for now, we // work around it. if (cp == CompilePolicy.BYTODO && ssp == ShouldStopPolicy.PROCESS) ssp = ShouldStopPolicy.ATTR; boolean foundExpected = (ssp.expect == null); String[] lines = sw.toString().split("\n"); for (String line: lines) { if (ssp.expect != null && line.startsWith("[" + ssp.expect)) foundExpected = true; if (ssp.dontExpect != null && line.startsWith("[" + ssp.dontExpect)) { error("Unexpected output: " + ssp.dontExpect + "\n" + sw); return; } } if (!foundExpected) error("Expected output not found: " + ssp.expect + "\n" + sw); } void error(String message) { System.err.println(message); errors++; } int errors; } // These tests test the ability of the compiler to continue in the face of // errors, accordining to the shouldStopPolicy /* @ test /nodynamiccopyright/ * @bug 6813059 * @summary * @compile/fail/ref=flow.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=FLOW Test.java * @compile/fail/ref=default.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy Test.java * @compile/fail/ref=enter.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=ENTER Test.java * @compile/fail/ref=attr.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=ATTR Test.java * @compile/fail/ref=transtypes.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=TRANSTYPES Test.java * @compile/fail/ref=lower.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=LOWER Test.java * @compile/fail/ref=generate.out -XDrawDiagnostics -XDcompilePolicy=byfile -XDverboseCompilePolicy -XDshouldStopPolicy=GENERATE Test.java */ /* class Test { void m1() { System.err.println("hello"); 0 // syntax error System.err.println("world"); } void m2() { } } class Test2 { } */
5,797
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/policy/test2/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. */ class A { class A1 { } static class A2 extends B { } static class A3 extends B.Inner { } class A4 { void m1() { class A3m1 { } } void m2() { new B() { }; } } }
1,318
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/policy/test2/B.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. */ class B { static class Inner { } }
1,095
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Test.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/policy/test2/Test.java
/* * Copyright (c) 2008, 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 * @compile/ref=byfile.AB.out -XDverboseCompilePolicy -XDcompile.policy=byfile A.java B.java */ /* * @test * @compile/ref=byfile.BA.out -XDverboseCompilePolicy -XDcompile.policy=byfile B.java A.java */ /* * @test * @compile/ref=bytodo.AB.out -XDverboseCompilePolicy -XDcompile.policy=bytodo A.java B.java */ /* * @test * @compile/ref=bytodo.BA.out -XDverboseCompilePolicy -XDcompile.policy=bytodo B.java A.java */
1,497
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/policy/test1/C.java
/* /nodynamiccopyright/ */ class C { C() { } } class C1 { C1() { return; return; } } class C2 { C2() { } }
142
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
D.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/policy/test1/D.java
/* * Copyright (c) 2005, 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. */ class D { D() { } } class D1 { D1() { } } class D2 { D2() { } }
1,148
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Test1a.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/policy/test1/Test1a.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. */ // These tests exercise the various compile policies available via // JavaCompiler.CompilePolicy. Like any golden file tests, they are // somewhat fragile and susceptible to breakage, but like the canary // in the mine, it is useful to know when something is not as it used // to be. The golden files should not be taken as a guarantee of // future behavior, and should be updated, with due care, if the // behavior of the compile policy is deliberately changed. /* * @test * @bug 6260188 6290772 * @summary provide variable policies for javac operation * Default compile policy is now "by file" (reverted to "todo" for 6382700) * Because of attr errors in B, no code should be generated * @compile/fail/ref=bytodo.ABD.out -XDrawDiagnostics -XDverboseCompilePolicy A.java B.java D.java */ /* * @test * @bug 6260188 * @summary provide variable policies for javac operation * Generate code for A, A1, A2, B * @compile/fail/ref=bytodo.ABD.out -XDrawDiagnostics -XDverboseCompilePolicy -XDcompilePolicy=bytodo A.java B.java D.java */ /* * @test * @bug 6260188 * @summary provide variable policies for javac operation * Because of attr errors in B, no code should be generated * @compile/fail/ref=simple.ABD.out -XDrawDiagnostics -XDverboseCompilePolicy -XDcompilePolicy=simple A.java B.java D.java */ /* * @test * @bug 6260188 * @summary provide variable policies for javac operation * Because of attr errors in B, no code should be generated * @compile/fail/ref=byfile.ABD.out -XDrawDiagnostics -XDverboseCompilePolicy -XDcompilePolicy=byfile A.java B.java D.java */ /* * @test * @bug 6260188 6290772 * @summary provide variable policies for javac operation * Default compile policy is now "by file" (reverted to "todo" for 6382700) * Generate code for A, A1, A2, but because of flow errors in C, no more code should be generated * @compile/fail/ref=bytodo.ACD.out -XDrawDiagnostics -XDverboseCompilePolicy A.java C.java D.java */ /* * @test * @bug 6260188 * @summary provide variable policies for javac operation * Generate code for A, A1, A2, C * @compile/fail/ref=bytodo.ACD.out -XDrawDiagnostics -XDverboseCompilePolicy -XDcompilePolicy=bytodo A.java C.java D.java */ /* * @test * @bug 6260188 * @summary provide variable policies for javac operation * Because of flow errors in C, no code should be generated * @compile/fail/ref=simple.ACD.out -XDrawDiagnostics -XDverboseCompilePolicy -XDcompilePolicy=simple A.java C.java D.java */ /* * @test * @bug 6260188 * @summary provide variable policies for javac operation * Generate code for A, A1, A2, but because of flow errors in C, no more code should be generated * @compile/fail/ref=byfile.ACD.out -XDrawDiagnostics -XDverboseCompilePolicy -XDcompilePolicy=byfile A.java C.java D.java */
3,990
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Test1b.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/policy/test1/Test1b.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. */ /* * @test 6420151 * @summary Compile a group of files and validate the set of class files produced * @run main Test1b -XDcompilePolicy=byfile A.java B.java D.java */ /* * @test 6420151 * @summary Compile a group of files and validate the set of class files produced * @run main Test1b -XDcompilePolicy=byfile A.java C.java D.java */ /* * @test 6420151 * @summary Compile a group of files and validate the set of class files produced * @run main Test1b -XDcompilePolicy=simple A.java B.java D.java */ /* * @test 6420151 * @summary Compile a group of files and validate the set of class files produced * @run main Test1b -XDcompilePolicy=simple A.java C.java D.java */ // These test cases should be uncommented when the default compile policy is // changed to "byfile". While the default policy is "bytodo", the test cases fail ///* // * @test 6420151 // * @summary Compile a group of files and validate the set of class files produced // * @run main Test1b A.java B.java D.java // */ // ///* // * @test 6420151 // * @summary Compile a group of files and validate the set of class files produced // * @run main Test1b A.java C.java D.java // */ // These test cases are retained for debugging; if uncommented, they show that // to bytodo mode fails the "all or none" class file test ///* // * @test 6420151 // * @summary Compile a group of files and validate the set of class files produced // * @run main Test1b -XDcompilePolicy=bytodo A.java B.java D.java // */ // ///* // * @test 6420151 // * @summary Compile a group of files and validate the set of class files produced // * @run main Test1b -XDcompilePolicy=bytodo A.java C.java D.java // */ import java.io.File; import java.io.PrintWriter; import java.io.StringWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Test1b { public static void main(String... args) throws Exception { new Test1b().run(args); } void run(String... args) throws Exception { File testSrcDir = new File(System.getProperty("test.src")); File tmpClassDir = new File("."); List<String> l = new ArrayList<String>(); l.add("-d"); l.add(tmpClassDir.getPath()); for (String a: args) { if (a.endsWith(".java")) l.add(new File(testSrcDir, a).getPath()); else l.add(a); } StringWriter sw = new StringWriter(); int rc = com.sun.tools.javac.Main.compile(l.toArray(new String[l.size()]), new PrintWriter(sw)); System.err.println(sw); Pattern p = Pattern.compile("([A-Z]+).*"); for (String name: tmpClassDir.list()) { if (name.endsWith(".class")) { Matcher m = p.matcher(name); if (m.matches()) { found(m.group(1), name); } } } // for all classes that might have been compiled, check that // all the classes in the source file get generated, or none do. check("A", 3); check("B", 3); check("C", 3); check("D", 3); if (errors > 0) throw new Exception(errors + " errors"); } void check(String prefix, int expect) { List<String> names = map.get(prefix); int found = (names == null ? 0 : names.size()); if (found == 0 || found == expect) { System.err.println("Found " + found + " files for " + prefix + ": OK"); return; } error("Found " + found + " files for " + prefix + ": expected 0 or " + expect + " " + names); } void found(String prefix, String name) { List<String> names = map.get(prefix); if (names == null) { names = new ArrayList<String>(); map.put(prefix, names); } names.add(name); } void error(String message) { System.err.println(message); errors++; } Map<String,List<String>> map = new HashMap<String,List<String>>(); int errors; }
5,188
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/policy/test1/A.java
/* * Copyright (c) 2005, 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. */ class A { A() { D d = new D(); } } class A1 { A1() { } } class A2 { A2() { } }
1,171
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/policy/test1/B.java
/* /nodynamiccopyright/ */ class B { B() { } } class B1 { B1() { x = 1; } } class B2 { B2() { } }
133
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/completion/C.java
/* * Copyright (c) 2001, 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 4433676 * @summary javac dies with NullPointerException in com.sun.tools.javac.v8.comp.Resolve.find * @author gafter * * @compile/fail C.java */ public class C { class CInner extends example.B { public CInner(Object o) { } } }
1,338
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Outside.java.back
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/InnerClassesAttribute/Outside.java.back
/* * This file was used to create Outside.class and Outside$1$Inside.class * with a recent (post-4074529-bugfix) compiler. */ public class Outside { void method() { class Inside { } } }
200
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Test.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/InnerClassesAttribute/Test.java
/* * Copyright (c) 1997, 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 4070745 * @summary The compiler used to crash when it saw a correctly-formed * InnerClasses attribute in a .class file. * @author turnidge * * @compile Test.java */ public class Test { Outside x = null; }
1,296
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T5003235a.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/T5003235/T5003235a.java
/* * @test /nodynamiccopyright/ * @bug 5003235 * @summary Private inner class accessible from subclasses * @author Peter von der Ah\u00e9 * @compile/fail/ref=T5003235a.out -XDdiags=%b:%l:%_%m T5003235a.java */ class Super { Inner i; private class Inner { void defaultM() {} protected void protectedM() {} public void publicM() {} private void privateM() {} } } class Sub extends Super { void foo() { i.defaultM(); i.protectedM(); i.publicM(); i.privateM(); } }
559
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T5003235c.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/T5003235/T5003235c.java
/* * @test /nodynamiccopyright/ * @bug 5003235 * @summary Access to private inner classes * @author Peter von der Ah\u00e9 * @compile/fail/ref=T5003235c.out -XDrawDiagnostics T5003235c.java */ class T5003235c { private static class B { static class Inner {} } } class C extends T5003235c.B.Inner {}
329
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T5003235b.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/T5003235/T5003235b.java
/* * @test /nodynamiccopyright/ * @bug 5003235 * @summary Accessibility of private inner class * @author Peter von der Ah\u00e9 * @compile/fail/ref=T5003235b.out -XDdiags=%b:%l:%_%m T5003235b.java */ class Outer { public Inner inner; public void create() { inner = new Inner(); } private class Inner { int k = 100; protected int l = 100; public int m = 100; protected int n = 100; } } class Access { public static void main(String[] args) { Outer outer = new Outer(); outer.create(); System.out.println("Value of k: " + outer.inner.k); System.out.println("Value of l: " + outer.inner.l); System.out.println("Value of m: " + outer.inner.m); System.out.println("Value of n: " + outer.inner.n); } }
828
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/missingClass/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. */ /* * @test * @summary Verify that we check that a source file contains the class sought. * @author gafter * * @run compile/fail A.java */ class A { B b; }
1,218
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/missingClass/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. */ // this file intentionally empty
1,085
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T6356217.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/T6356217/T6356217.java
/* * Copyright (c) 2005, 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 6356217 * @summary ArrayIndexOutOfBoundsException shouldn't be thrown at Code$State.forceStackTop * @author Wei Tao * @compile T6356217.java */ class T { boolean bb; } class T6356217 { public void f(T t1, T t2) { boolean b = false; do { break; } while ((b ? t1 : t2).bb); } }
1,415
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T7068437.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/file/T7068437.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 7068437 * @summary Filer.getResource(SOURCE_OUTPUT, ...) no longer works in JDK 7 w/o -s */ import java.io.FileNotFoundException; import java.io.IOException; import java.io.Writer; import java.util.Arrays; import java.util.Collections; import java.util.Map; import java.util.Set; import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.Filer; import javax.annotation.processing.Messager; import javax.annotation.processing.RoundEnvironment; import javax.annotation.processing.SupportedAnnotationTypes; import javax.annotation.processing.SupportedOptions; import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; import javax.lang.model.element.TypeElement; import javax.tools.Diagnostic.Kind; import javax.tools.JavaCompiler; import javax.tools.JavaCompiler.CompilationTask; import javax.tools.StandardLocation; import javax.tools.ToolProvider; public class T7068437 { public static void main(String[] args) throws Exception { new T7068437().run(); } void run() throws Exception { JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); System.err.println("using " + compiler.getClass() + " from " + compiler.getClass().getProtectionDomain().getCodeSource()); CompilationTask task = compiler.getTask(null, null, null, Collections.singleton("-proc:only"), Collections.singleton("java.lang.Object"), null); task.setProcessors(Collections.singleton(new Proc())); check("compilation", task.call()); task = compiler.getTask(null, null, null, Arrays.asList("-proc:only", "-AexpectFile"), Collections.singleton("java.lang.Object"), null); task.setProcessors(Collections.singleton(new Proc())); check("compilation", task.call()); } void check(String msg, boolean ok) { System.err.println(msg + ": " + (ok ? "ok" : "failed")); if (!ok) throw new AssertionError(msg); } @SupportedAnnotationTypes("*") @SupportedOptions("expectFile") private static class Proc extends AbstractProcessor { int count; @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (roundEnv.processingOver() || count++ > 0) { return false; } Filer filer = processingEnv.getFiler(); Messager messager = processingEnv.getMessager(); Map<String, String> options = processingEnv.getOptions(); System.err.println(options); boolean expectFile = options.containsKey("expectFile"); System.err.println("running Proc: expectFile=" + expectFile); boolean found; try { messager.printMessage(Kind.NOTE, "found previous content of length " + filer.getResource(StandardLocation.SOURCE_OUTPUT, "p", "C.java").getCharContent(false).length()); found = true; } catch (FileNotFoundException x) { messager.printMessage(Kind.NOTE, "not previously there"); found = false; } catch (IOException x) { messager.printMessage(Kind.ERROR, "while reading: " + x); found = false; } if (expectFile && !found) { messager.printMessage(Kind.ERROR, "expected file but file not found"); } try { Writer w = filer.createSourceFile("p.C").openWriter(); w.write("/* hello! */ package p; class C {}"); w.close(); messager.printMessage(Kind.NOTE, "wrote new content"); } catch (IOException x) { messager.printMessage(Kind.ERROR, "while writing: " + x); } return true; } @Override public SourceVersion getSupportedSourceVersion() { return SourceVersion.latest(); } } }
5,189
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T7068451.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/file/T7068451.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 7068451 * @summary Regression: javac compiles fixed sources against previous, * not current, version of generated sources */ import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.io.Writer; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Set; import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.Filer; import javax.annotation.processing.Messager; import javax.annotation.processing.RoundEnvironment; import javax.annotation.processing.SupportedAnnotationTypes; import javax.lang.model.SourceVersion; import javax.lang.model.element.TypeElement; import javax.tools.Diagnostic.Kind; import javax.tools.JavaCompiler; import javax.tools.JavaCompiler.CompilationTask; import javax.tools.StandardLocation; import javax.tools.ToolProvider; public class T7068451 { public static void main(String[] args) throws Exception { new T7068451().run(); } void run() throws Exception { JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); System.err.println("using " + compiler.getClass() + " from " + compiler.getClass().getProtectionDomain().getCodeSource()); File tmp = new File("tmp"); tmp.mkdir(); for (File f: tmp.listFiles()) f.delete(); File input = writeFile(tmp, "X.java", "package p; class X { { p.C.first(); } }"); List<String> opts = Arrays.asList( "-s", tmp.getPath(), "-d", tmp.getPath(), "-XprintRounds"); System.err.println(); System.err.println("FIRST compilation"); System.err.println(); CompilationTask task = compiler.getTask(null, null, null, opts, null, compiler.getStandardFileManager(null, null, null).getJavaFileObjects(input)); task.setProcessors(Collections.singleton(new Proc("first"))); check("compilation", task.call()); writeFile(tmp, "X.java", "package p; class X { { p.C.second(); } }"); //Thread.sleep(2000); System.err.println(); System.err.println("SECOND compilation"); System.err.println(); task = compiler.getTask(null, null, null, opts, null, compiler.getStandardFileManager(null, null, null).getJavaFileObjects(input)); task.setProcessors(Collections.singleton(new Proc("second"))); check("compilation", task.call()); //Thread.sleep(2000); System.err.println(); System.err.println("SECOND compilation, REPEATED"); System.err.println(); task = compiler.getTask(null, null, null, opts, null, compiler.getStandardFileManager(null, null, null).getJavaFileObjects(input)); task.setProcessors(Collections.singleton(new Proc("second"))); check("compilation", task.call()); } void check(String msg, boolean ok) { System.err.println(msg + ": " + (ok ? "ok" : "failed")); if (!ok) throw new AssertionError(msg); } static File writeFile(File base, String path, String body) throws IOException { File f = new File(base, path); FileWriter out = new FileWriter(f); out.write(body); out.close(); System.err.println("wrote " + path + ": " + body); return f; } @SupportedAnnotationTypes("*") private static class Proc extends AbstractProcessor { final String m; Proc(String m) { this.m = m; } int count; @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (roundEnv.processingOver() || count++ > 0) { return false; } Filer filer = processingEnv.getFiler(); Messager messager = processingEnv.getMessager(); System.err.println("running Proc"); try { int len = filer.getResource(StandardLocation.SOURCE_OUTPUT, "p", "C.java").getCharContent(false).length(); messager.printMessage(Kind.NOTE, "C.java: found previous content of length " + len); } catch (FileNotFoundException x) { messager.printMessage(Kind.NOTE, "C.java: not previously there"); } catch (IOException x) { messager.printMessage(Kind.ERROR, "while reading: " + x); } try { String body = "package p; public class C { public static void " + m + "() {} }"; Writer w = filer.createSourceFile("p.C").openWriter(); w.write(body); w.close(); messager.printMessage(Kind.NOTE, "C.java: wrote new content: " + body); } catch (IOException x) { messager.printMessage(Kind.ERROR, "while writing: " + x); } return true; } @Override public SourceVersion getSupportedSourceVersion() { return SourceVersion.latest(); } } }
6,194
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T7018098.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/file/T7018098.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 7018098 * @summary CacheFSInfo persists too long * @library ../lib * @build JavacTestingAbstractProcessor T7018098 * @run main T7018098 */ import java.io.*; import java.util.*; import javax.annotation.processing.RoundEnvironment; import javax.annotation.processing.SupportedOptions; import javax.lang.model.element.TypeElement; import javax.tools.Diagnostic; import com.sun.tools.javac.file.FSInfo; import com.sun.tools.javac.processing.JavacProcessingEnvironment; import com.sun.tools.javac.util.Context; @SupportedOptions("expect") public class T7018098 extends JavacTestingAbstractProcessor { public static void main(String... args) throws Exception { new T7018098().run(); } static File testDir = new File("T7018098.dir"); void run() throws Exception { String myName = T7018098.class.getSimpleName(); File testSrc = new File(System.getProperty("test.src")); File file = new File(testSrc, myName + ".java"); _assert(!testDir.exists()); compile( "-proc:only", "-processor", myName, "-Aexpect=false", file.getPath()); testDir.mkdirs(); _assert(testDir.exists()); compile( "-proc:only", "-processor", myName, "-Aexpect=true", file.getPath()); } void _assert(boolean cond) { if (!cond) throw new AssertionError(); } void compile(String... args) throws Exception { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); int rc = com.sun.tools.javac.Main.compile(args, pw); pw.close(); String out = sw.toString(); if (!out.isEmpty()) System.err.println(out); if (rc != 0) throw new Exception("compilation failed unexpectedly: rc=" + rc); } //--------------- @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { Context context = ((JavacProcessingEnvironment) processingEnv).getContext(); FSInfo fsInfo = context.get(FSInfo.class); round++; if (round == 1) { boolean expect = Boolean.valueOf(options.get("expect")); checkEqual("cache result", fsInfo.isDirectory(testDir), expect); initialFSInfo = fsInfo; } else { checkEqual("fsInfo", fsInfo, initialFSInfo); } return true; } <T> void checkEqual(String label, T actual, T expected) { if (actual != expected) messager.printMessage(Diagnostic.Kind.ERROR, "Unexpected value for " + label + "; expected: " + expected + "; found: " + actual); } int round = 0; FSInfo initialFSInfo; }
3,910
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T6836682.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/file/zip/T6836682.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 6836682 7025988 * @summary JavacFileManager handling of zip64 archives (Scenario A and B) * @compile -XDignore.symbol.file T6836682.java Utils.java * @run main T6836682 */ /* * This test consists of two scenarios: * * Scenario A: create a jar with entries exceeding 64K, and see if the javac * can handle this large jar on the classpath. Generally this test completes * within a minute * * Scenario B: create a jar with a large enough file exceeding 4GB, and * similarly test javac. This test is known to be slow and problematic on * certain operating systems, thus this test can be selected by passing a * property through jtreg as follows: * -javaoptions=-DT6836682.testScenarioB=true. * Note this test will only run iff all the disk requirements are met at runtime. */ import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.nio.file.Files; import java.nio.file.Path; import java.util.zip.CRC32; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; public class T6836682 { private static final long GIGA = 1024 * 1024 * 1024; private static final int BUFFER_LEN = Short.MAX_VALUE * 2; static long getCount(long minlength) { return (minlength / BUFFER_LEN) + 1; } static long computeCRC(long minlength) { CRC32 crc = new CRC32(); byte[] buffer = new byte[BUFFER_LEN]; long count = getCount(minlength); for (long i = 0; i < count; i++) { crc.update(buffer); } return crc.getValue(); } static long computeCRC(File inFile) throws IOException { byte[] buffer = new byte[8192]; CRC32 crc = new CRC32(); FileInputStream fis = null; BufferedInputStream bis = null; try { fis = new FileInputStream(inFile); bis = new BufferedInputStream(fis); int n = bis.read(buffer); while (n > 0) { crc.update(buffer, 0, n); n = bis.read(buffer); } } finally { Utils.close(bis); Utils.close(fis); } return crc.getValue(); } static void createLargeFile(OutputStream os, long minlength) throws IOException { byte[] buffer = new byte[BUFFER_LEN]; long count = getCount(minlength); for (long i = 0; i < count; i++) { os.write(buffer); } os.flush(); } static void createJarWithLargeFile(File jarFile, File javaFile, long minlength) throws IOException { Utils.createClassFile(javaFile, null, true); File classFile = new File(Utils.getClassFileName(javaFile)); ZipOutputStream zos = null; BufferedOutputStream bos = null; FileInputStream fis = null; try { zos = new ZipOutputStream(new FileOutputStream(jarFile)); zos.setLevel(ZipOutputStream.STORED); zos.setMethod(0); bos = new BufferedOutputStream(zos); ZipEntry ze = new ZipEntry("large.data"); ze.setCompressedSize(getCount(minlength) * BUFFER_LEN); ze.setSize(getCount(minlength) * BUFFER_LEN); ze.setCrc(computeCRC(minlength)); ze.setMethod(ZipEntry.STORED); zos.putNextEntry(ze); createLargeFile(bos, minlength); ze = new ZipEntry(classFile.getName()); ze.setCompressedSize(classFile.length()); ze.setSize(classFile.length()); ze.setCrc(computeCRC(classFile)); ze.setMethod(ZipEntry.STORED); zos.putNextEntry(ze); fis = new FileInputStream(classFile); Utils.copyStream(fis, bos); bos.flush(); zos.closeEntry(); } finally { Utils.close(bos); Utils.close(zos); Utils.close(fis); } // deleted to prevent accidental linkage new File(Utils.getClassFileName(javaFile)).delete(); } static void createLargeJar(File jarFile, File javaFile) throws IOException { File classFile = new File(Utils.getClassFileName(javaFile)); Utils.createClassFile(javaFile, null, true); ZipOutputStream zos = null; FileInputStream fis = null; final int MAX = Short.MAX_VALUE * 2 + 10; ZipEntry ze = null; try { zos = new ZipOutputStream(new FileOutputStream(jarFile)); zos.setLevel(ZipOutputStream.STORED); zos.setMethod(ZipOutputStream.STORED); for (int i = 0; i < MAX ; i++) { ze = new ZipEntry("X" + i + ".txt"); ze.setSize(0); ze.setCompressedSize(0); ze.setCrc(0); zos.putNextEntry(ze); } // add a class file ze = new ZipEntry(classFile.getName()); ze.setCompressedSize(classFile.length()); ze.setSize(classFile.length()); ze.setCrc(computeCRC(classFile)); zos.putNextEntry(ze); fis = new FileInputStream(classFile); Utils.copyStream(fis, zos); } finally { Utils.close(zos); Utils.close(fis); // deleted to prevent accidental linkage new File(Utils.getClassFileName(javaFile)).delete(); } } // a jar with entries exceeding 64k + a class file for the existential test public static void testScenarioA(String... args) throws IOException { File largeJar = new File("large.jar"); File javaFile = new File("Foo.java"); createLargeJar(largeJar, javaFile); File testFile = new File("Bar.java"); try { Utils.createJavaFile(testFile, javaFile); if (!Utils.compile("-doe", "-verbose", "-cp", largeJar.getAbsolutePath(), testFile.getAbsolutePath())) { throw new IOException("test failed"); } } finally { Utils.deleteFile(largeJar); } } // a jar with an enormous file + a class file for the existential test public static void testScenarioB(String... args) throws IOException { final File largeJar = new File("huge.jar"); final File javaFile = new File("Foo.java"); final Path path = largeJar.getAbsoluteFile().getParentFile().toPath(); final long available = Files.getFileStore(path).getUsableSpace(); final long MAX_VALUE = 0xFFFF_FFFFL; final long absolute = MAX_VALUE + 1L; final long required = (long)(absolute * 1.1); // pad for sundries System.out.println("\tavailable: " + available / GIGA + " GB"); System.out.println("\trequired: " + required / GIGA + " GB"); if (available > required) { createJarWithLargeFile(largeJar, javaFile, absolute); File testFile = new File("Bar.java"); Utils.createJavaFile(testFile, javaFile); try { if (!Utils.compile("-doe", "-verbose", "-cp", largeJar.getAbsolutePath(), testFile.getAbsolutePath())) { throw new IOException("test failed"); } } finally { Utils.deleteFile(largeJar); } } else { System.out.println("Warning: testScenarioB passes vacuously," + " requirements exceeds available space"); } } public static void main(String... args) throws IOException { testScenarioA(); System.out.println("testScenarioA: PASS"); if (Boolean.getBoolean("T6836682.testScenarioB")) { testScenarioB(); System.out.println("testScenarioB: PASS"); } else { System.out.println("Warning: testScenarioB, large file test skipped"); } } }
9,076
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Utils.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/file/zip/Utils.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. */ import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.Closeable; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintStream; public class Utils { static final sun.tools.jar.Main jarTool = new sun.tools.jar.Main(System.out, System.err, "jar-tool"); static final com.sun.tools.javac.Main javac = new com.sun.tools.javac.Main(); private Utils(){} public static boolean compile(String... args) { return javac.compile(args) == 0; } public static void createClassFile(File javaFile, File superClass, boolean delete) throws IOException { createJavaFile(javaFile, superClass); if (!compile(javaFile.getName())) { throw new RuntimeException("compile failed unexpectedly"); } if (delete) javaFile.delete(); } public static void createJavaFile(File outFile) throws IOException { createJavaFile(outFile, null); } public static void createJavaFile(File outFile, File superClass) throws IOException { PrintStream ps = null; String srcStr = "public class " + getSimpleName(outFile) + " "; if (superClass != null) { srcStr = srcStr.concat("extends " + getSimpleName(superClass) + " "); } srcStr = srcStr.concat("{}"); try { FileOutputStream fos = new FileOutputStream(outFile); ps = new PrintStream(fos); ps.println(srcStr); } finally { close(ps); } } static String getClassFileName(File javaFile) { return javaFile.getName().endsWith(".java") ? javaFile.getName().replace(".java", ".class") : null; } static String getSimpleName(File inFile) { String fname = inFile.getName(); return fname.substring(0, fname.indexOf(".")); } public static void copyStream(InputStream in, OutputStream out) throws IOException { byte[] buf = new byte[8192]; int n = in.read(buf); while (n > 0) { out.write(buf, 0, n); n = in.read(buf); } } public static void close(Closeable c) { if (c != null) { try { c.close(); } catch (IOException ignore) {} } } public static void deleteFile(File f) { if (!f.delete()) { throw new RuntimeException("could not delete file: " + f.getAbsolutePath()); } } public static void cat(File output, File... files) throws IOException { BufferedInputStream bis = null; BufferedOutputStream bos = null; FileOutputStream fos = null; try { fos = new FileOutputStream(output); bos = new BufferedOutputStream(fos); for (File x : files) { FileInputStream fis = new FileInputStream(x); bis = new BufferedInputStream(fis); copyStream(bis, bos); Utils.close(bis); } } finally { Utils.close(bis); Utils.close(bos); Utils.close(fos); } } }
4,364
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T6865530.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/file/zip/T6865530.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 6865530 * @summary ensure JavacFileManager handles non-standard zipfiles. * @compile -XDignore.symbol.file T6865530.java * @run main T6865530 */ import java.io.File; public class T6865530 { public static void main(String... args) throws Exception { File badFile = new File("bad.exe"); File testJar = new File("test.jar"); File fooJava = new File("Foo.java"); File barJava = new File("Bar.java"); // create a jar by compiling a file, and append the jar to some // arbitrary data to offset the start of the zip/jar archive Utils.createJavaFile(fooJava); Utils.compile("-doe", "-verbose", fooJava.getName()); String[] jarArgs = { "cvf", testJar.getAbsolutePath(), "Foo.class" }; Utils.jarTool.run(jarArgs); Utils.cat(badFile, fooJava, testJar); // create test file and use the above file as a classpath Utils.createJavaFile(barJava); try { if (!Utils.compile("-doe", "-verbose", "-cp", badFile.getAbsolutePath(), "Bar.java")) { throw new RuntimeException("test fails javac did not compile"); } } finally { Utils.deleteFile(badFile); Utils.deleteFile(testJar); } } }
2,368
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T1.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/binaryCompat/T1.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 4705305 * @summary javac generates incorrect class_index for static ref by simple name * @author gafter * * @compile T1.java T3.java * @compile T2.java * @run main T3 */ class T1 { static void f() { throw new Error(); } static boolean ok = false; } class T2 extends T1 { }
1,362
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T3.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/binaryCompat/T3.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. */ public class T3 extends T2 { public static void main(String[] args) { f(); if (!ok) throw new Error(); } }
1,183
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
T2.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/binaryCompat/T2.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. */ class T2 extends T1 { static void f() { } static boolean ok = true; }
1,130
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z
Dummy.java
/FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/importContext/namedPackage/Dummy.java
/* * Copyright (c) 2000, 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 4304112 * @summary Verify that imports are resolved in correct scope. * @author maddox * * @compile foo/Foo.java */ class Dummy {}
1,209
Java
.java
openjdk-mirror/jdk7u-langtools
9
3
0
2012-05-07T19:45:34Z
2012-05-08T17:47:06Z