Descriptor computation in the presence of raw types ?

Dan Smith daniel.smith at oracle.com
Fri Feb 15 09:09:32 PST 2013


On Feb 14, 2013, at 9:04 PM, Srikanth S Adayapalam <srikanth_sankaran at in.ibm.com> wrote:

> import java.util.List; 
> interface I<T> { 
>     <P> P foo(List<T> f); 
> } 
> 
> class Y { 
>     void goo(I<String> f) { 
>     } 
> } 
> 
> class Z { 
>     void zoo(I f) { 
>     } 
> } 
> public class X { 
>     public static void main(String [] args) { 
>       new Y().goo((List<String> ls) -> { return null; }); // Fails: descriptor is generic 
>       new Z().zoo((List ls) -> { return null; }); // compiles fine, we are overriding a generic method with another that has no type variables!! 
>     } 
> } 

This doesn't bother me.  The raw type I does not have a generic method, even if the parameterized type I<String> does.

It's also somewhat analogous to the situation in which we allow an erased-signature method to override a generic one.

—Dan


More information about the lambda-spec-experts mailing list