8008444: Inherited generic functional descriptors are merged incorrectly

Thu, 21 Feb 2013 15:27:05 +0000

author
mcimadamore
date
Thu, 21 Feb 2013 15:27:05 +0000
changeset 1600
3fef0cae83b3
parent 1599
9f0ec00514b6
child 1601
cd7340a84bb8

8008444: Inherited generic functional descriptors are merged incorrectly
Summary: Missing call to Types.createMethodWithThrownTypes
Reviewed-by: jjg

src/share/classes/com/sun/tools/javac/code/Types.java file | annotate | diff | comparison | revisions
test/tools/javac/lambda/LambdaConv25.java file | annotate | diff | comparison | revisions
test/tools/javac/lambda/LambdaConv25.out file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java	Thu Feb 21 15:26:46 2013 +0000
     1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java	Thu Feb 21 15:27:05 2013 +0000
     1.3 @@ -512,7 +512,7 @@
     1.4                  @Override
     1.5                  public Type getType(Type origin) {
     1.6                      Type mt = memberType(origin, getSymbol());
     1.7 -                    return new MethodType(mt.getParameterTypes(), mt.getReturnType(), thrown1, syms.methodClass);
     1.8 +                    return createMethodTypeWithThrown(mt, thrown1);
     1.9                  }
    1.10              };
    1.11          }
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/test/tools/javac/lambda/LambdaConv25.java	Thu Feb 21 15:27:05 2013 +0000
     2.3 @@ -0,0 +1,21 @@
     2.4 +/*
     2.5 + * @test /nodynamiccopyright/
     2.6 + * @summary check that merged inherited descriptors preservers type-parameters
     2.7 + * @compile/fail/ref=LambdaConv25.out -XDrawDiagnostics LambdaConv25.java
     2.8 + */
     2.9 +class LambdaConv25 {
    2.10 +
    2.11 +    interface A {
    2.12 +        <X> void m();
    2.13 +    }
    2.14 +
    2.15 +    interface B {
    2.16 +        <X> void m();
    2.17 +    }
    2.18 +
    2.19 +    interface C extends A, B { }
    2.20 +
    2.21 +    void test() {
    2.22 +        C c = ()->{}; //should fail
    2.23 +    }
    2.24 +}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/test/tools/javac/lambda/LambdaConv25.out	Thu Feb 21 15:27:05 2013 +0000
     3.3 @@ -0,0 +1,2 @@
     3.4 +LambdaConv25.java:19:15: compiler.err.prob.found.req: (compiler.misc.invalid.generic.lambda.target: <X>()void, kindname.interface, LambdaConv25.C)
     3.5 +1 error

mercurial