Descriptor computation in the presence of raw types ?

Srikanth S Adayapalam srikanth_sankaran at in.ibm.com
Thu Feb 14 19:24:23 PST 2013


0.6.1 9.8 is silent about descriptor computation in the presence of raw 
types.
Is this specified somewhere else ? Discouraged though this scenario may 
be, 
we can expect to run into this sooner or later, intentionally coded or 
otherwise.

The reference compiler at 8b74 seems to erase the descriptor as seen by 
the
following program: This seems reasonable from one pov. From another, this 
is
somewhat at odds with the ban on lambdas implementing generic methods in 
that,
in both cases we have (or are likely to have) unadaptable type variable 
usage in
various constituents of the descriptor. And the target type is raw in one 
case
and the lambda is "raw" in the other case (by virtue of there being no 
grammar
support for type parameter encoding)

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 ?

Thanks in advance for clarifications.

// ---
import java.util.List;
interface I<T> {
    void 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) -> {});  // Compiles OK with 8b74
       new Z().zoo((List ls) -> {});          // OK
    }
}


More information about the lambda-spec-observers mailing list