diff options
author | Jesper S Moller | 2013-02-06 16:15:57 +0000 |
---|---|---|
committer | ssankaran | 2013-02-06 16:15:57 +0000 |
commit | d47987eb8adab327484d0ae6a8b0d36cd720a33c (patch) | |
tree | 64519be760bf3a3946fc6b9c310a302a1b7b473c | |
parent | cdb4a253ebaad23d9a4ad57392e614eb4d2c2899 (diff) | |
download | eclipse.jdt.core-d47987eb8adab327484d0ae6a8b0d36cd720a33c.tar.gz eclipse.jdt.core-d47987eb8adab327484d0ae6a8b0d36cd720a33c.tar.xz eclipse.jdt.core-d47987eb8adab327484d0ae6a8b0d36cd720a33c.zip |
Test for bug 399537
-rw-r--r-- | org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeLambdaExpressionsTest.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeLambdaExpressionsTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeLambdaExpressionsTest.java index 0936bc29ff..8e0db2fd48 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeLambdaExpressionsTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeLambdaExpressionsTest.java @@ -1095,6 +1095,35 @@ public void test031() { "The method goo() is undefined for the type X\n" + "----------\n"); } +// Bug 399537 - [1.8][compiler] Exceptions thrown from lambda body must match specification per function descriptor +public void test032() { + this.runNegativeTest( + new String[] { + "X.java", + "interface IA {\r\n" + + " void snazz();\r\n" + + "}\r\n" + + "interface IB {\r\n" + + " void baz() throws java.io.IOException;\r\n" + + "}\r\n" + + "public class X {\r\n" + + " public static void main(String[] args) {\n" + + " IA i1 = () -> {\n" + + " throw new java.io.EOFException(); // Error: not declared\n" + + " };\n" + + " IB i2 = () -> {\n" + + " throw new java.io.EOFException(); // Fine: IOException is declared\n" + + " }; // No error, it's all good\n" + + " }\n" + + "}"}, + "----------\n" + + "1. ERROR in X.java (at line 10)\n" + + " throw new java.io.EOFException(); // Error: not declared\n" + + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + + "Unhandled exception type EOFException\n" + + "----------\n"); +} + public static Class testClass() { return NegativeLambdaExpressionsTest.class; } |