Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesper S Moller2013-02-06 16:15:57 +0000
committerssankaran2013-02-06 16:15:57 +0000
commitd47987eb8adab327484d0ae6a8b0d36cd720a33c (patch)
tree64519be760bf3a3946fc6b9c310a302a1b7b473c
parentcdb4a253ebaad23d9a4ad57392e614eb4d2c2899 (diff)
downloadeclipse.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.java29
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;
}

Back to the top