Descriptor computation in the presence of raw types ?

Srikanth S Adayapalam srikanth_sankaran at in.ibm.com
Thu Feb 14 20:04:14 PST 2013


> From: Srikanth S Adayapalam/India/IBM at IBMIN
> Sent by: lambda-spec-experts-bounces at openjdk.java.net

> I am happy erasing the descriptor, but (a) should this stay 
> unspecified if it indeed 
> is and (b) does the inconsistency in treatment with generic lambdas OK ? 


To see the correlation between generic lambdas and raw types in target 
type
study this program in which 8b74 is inadvertently allowing a generic 
lambda
since it does not see the descriptor as being generic due to erasure:

// -----
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!!
    }
}

Srikanth.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/lambda-spec-experts/attachments/20130214/f647827f/attachment.html 


More information about the lambda-spec-experts mailing list