changeset 1599:3fef0cae83b3

8008444: Inherited generic functional descriptors are merged incorrectly Summary: Missing call to Types.createMethodWithThrownTypes Reviewed-by: jjg
author mcimadamore
date Thu, 21 Feb 2013 15:27:05 +0000
parents 9f0ec00514b6
children cd7340a84bb8
files src/share/classes/com/sun/tools/javac/code/Types.java test/tools/javac/lambda/LambdaConv25.java test/tools/javac/lambda/LambdaConv25.out
diffstat 3 files changed, 24 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/code/Types.java	Thu Feb 21 15:26:46 2013 +0000
+++ b/src/share/classes/com/sun/tools/javac/code/Types.java	Thu Feb 21 15:27:05 2013 +0000
@@ -512,7 +512,7 @@
                 @Override
                 public Type getType(Type origin) {
                     Type mt = memberType(origin, getSymbol());
-                    return new MethodType(mt.getParameterTypes(), mt.getReturnType(), thrown1, syms.methodClass);
+                    return createMethodTypeWithThrown(mt, thrown1);
                 }
             };
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/LambdaConv25.java	Thu Feb 21 15:27:05 2013 +0000
@@ -0,0 +1,21 @@
+/*
+ * @test /nodynamiccopyright/
+ * @summary check that merged inherited descriptors preservers type-parameters
+ * @compile/fail/ref=LambdaConv25.out -XDrawDiagnostics LambdaConv25.java
+ */
+class LambdaConv25 {
+
+    interface A {
+        <X> void m();
+    }
+
+    interface B {
+        <X> void m();
+    }
+
+    interface C extends A, B { }
+
+    void test() {
+        C c = ()->{}; //should fail
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/LambdaConv25.out	Thu Feb 21 15:27:05 2013 +0000
@@ -0,0 +1,2 @@
+LambdaConv25.java:19:15: compiler.err.prob.found.req: (compiler.misc.invalid.generic.lambda.target: <X>()void, kindname.interface, LambdaConv25.C)
+1 error