diff options
author | Stephan Herrmann | 2012-05-26 13:31:36 +0000 |
---|---|---|
committer | Stephan Herrmann | 2012-05-26 13:31:36 +0000 |
commit | f8fb8a32a24c251b55971dda2ecc2df22a130a8d (patch) | |
tree | ff6691f16a27cf00e30b3a31d2b87d1d696d282c /org.eclipse.jdt.core.tests.compiler | |
parent | 2feba959ea1fba7d77fd5c42fd53456a9090b428 (diff) | |
download | org.eclipse.objectteams-f8fb8a32a24c251b55971dda2ecc2df22a130a8d.tar.gz org.eclipse.objectteams-f8fb8a32a24c251b55971dda2ecc2df22a130a8d.tar.xz org.eclipse.objectteams-f8fb8a32a24c251b55971dda2ecc2df22a130a8d.zip |
Update JDT/Core tests to 4.2 RC2 from tag I20120524-2100
Diffstat (limited to 'org.eclipse.jdt.core.tests.compiler')
2 files changed, 116 insertions, 1 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF b/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF index 845f7ee8b..a08cfcf58 100644 --- a/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF +++ b/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF @@ -22,4 +22,5 @@ Require-Bundle: org.junit;bundle-version="3.8.1", org.eclipse.jdt.annotation;bundle-version="[1.0.0,2.0.0)", org.eclipse.objectteams.otdt Bundle-RequiredExecutionEnvironment: J2SE-1.4 +Eclipse-BundleShape: dir Bundle-ActivationPolicy: lazy diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TryWithResourcesStatementTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TryWithResourcesStatementTest.java index e606150ea..43a7fa40a 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TryWithResourcesStatementTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TryWithResourcesStatementTest.java @@ -14,6 +14,7 @@ *******************************************************************************/ package org.eclipse.jdt.core.tests.compiler.regression; +import java.io.File; import java.util.Map; import junit.framework.Test; @@ -22,7 +23,7 @@ import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; public class TryWithResourcesStatementTest extends AbstractRegressionTest { static { -// TESTS_NAMES = new String[] { "test061m"}; +// TESTS_NAMES = new String[] { "test380112e"}; // TESTS_NUMBERS = new int[] { 50 }; // TESTS_RANGE = new int[] { 11, -1 }; } @@ -4078,6 +4079,119 @@ public void test375326g() { "The local variable a may not have been initialized\n" + "----------\n"); } +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=380112 +public void test380112a() { + this.runConformTest( + new String[] { + "X.java", + "import java.io.*;\n" + + "interface I extends Closeable, Serializable {}\n" + + "public class X {\n"+ + " public static void main(String [] args) {\n" + + " try (I i = getX()) {\n" + + " } catch (IOException x) {\n" + + " }\n"+ + " System.out.println(\"Done\");\n" + + " }\n" + + " public static I getX() { return null;}\n"+ + " public X(){}\n" + + "}\n" + }, + "Done"); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=380112 +//variant with finally +public void test380112b() { + this.runConformTest( + new String[] { + "X.java", + "import java.io.*;\n" + + "interface I extends Closeable, Serializable {}\n" + + "public class X {\n"+ + " public static void main(String [] args) {\n" + + " try (I i = getX()) {\n" + + " } catch (IOException x) {\n" + + " } finally {\n"+ + " System.out.println(\"Done\");\n" + + " }\n" + + " }\n" + + " public static I getX() { return null;}\n"+ + " public X(){}\n" + + "}\n" + }, + "Done"); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=380112 +//variant with two methods throwing different Exceptions (one subtype of other) +//subtype should be the one to be caught +public void test380112c() { + this.runConformTest( + new String[] { + "X.java", + "import java.io.*;\n" + + "interface I2 { public void close() throws FileNotFoundException; }\n"+ + "interface I extends Closeable, I2 {}\n" + + "public class X {\n"+ + " public static void main(String [] args) {\n" + + " try (I i = getX()) {\n" + + " } catch (FileNotFoundException x) {\n" + + " }\n"+ + " System.out.println(\"Done\");\n" + + " }\n" + + " public static I getX() { return null;}\n"+ + " public X(){}\n" + + "}\n" + }, + "Done"); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=380112 +//test380112c's variant with finally +public void test380112d() { + this.runConformTest( + new String[] { + "X.java", + "import java.io.*;\n" + + "interface I2 { public void close() throws FileNotFoundException; }\n"+ + "interface I extends Closeable, I2 {}\n" + + "public class X {\n"+ + " public static void main(String [] args) {\n" + + " try (I i = getX()) {\n" + + " } catch (FileNotFoundException x) {\n" + + " } finally {\n"+ + " System.out.println(\"Done\");\n" + + " }\n" + + " }\n" + + " public static I getX() { return null;}\n"+ + " public X(){}\n" + + "}\n" + }, + "Done"); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=380112 +//test380112a variant moving the Interface into a binary +public void test380112e() { + String path = this.getCompilerTestsPluginDirectoryPath() + File.separator + "workspace" + File.separator + "Test380112.jar"; + String[] defaultLibs = getDefaultClassPaths(); + String[] libs = new String[defaultLibs.length + 1]; + System.arraycopy(defaultLibs, 0, libs, 0, defaultLibs.length); + libs[defaultLibs.length] = path; + this.runConformTest( + new String[] { + "X.java", + "import java.io.*;\n" + + "import pkg380112.I;\n" + + "public class X {\n"+ + " public static void main(String [] args) {\n" + + " try (I i = getX()) {\n" + + " } catch (IOException x) {\n" + + " }\n"+ + " System.out.println(\"Done\");\n" + + " }\n" + + " public static I getX() { return null;}\n"+ + " public X(){}\n" + + "}\n" + }, "Done", libs, true, new String[] {"-cp", path}); +} public static Class testClass() { return TryWithResourcesStatementTest.class; } |