Model 3 classfile design document

Ali Ebrahimi ali.ebrahimi1781 at
Sun Jan 24 08:32:17 UTC 2016

Another two typo:


To illustrate this, consider the class below:

class Bar<any V> { }
class Foo<any T extends Runnable, any U> extends Bar<T> {
    T aT;
    Foo<T,U> aFoo;

In the parameterized type Foo<Integer, int>, the first type parameter is
erased, and its erasure is Runnable."

Here is not better we use some subtype of Runnable such as Thread:

Foo<Thread, int>


Member References

To illustrate further the complexity of erasure, and why we want to leave
it in the hands of the static compiler, suppose we have a method invocation:

class Foo<X> { void m(X x) { } }

class Bar<any Y extends Bound> {
    Foo<Y> foo = ...
    Y y = ...

How do we describe the invocation foo.m(y)? The invokevirtual instruction
describes both the receiver type and the descriptor. If Y is erased, we
want the descriptor to be List::m(Object); if not, we want it to be
List<Y>::m(Y). "

If Y is erased, we want the descriptor to be Foo::m(Object); if not, we
want it to be Foo<Y>::m(Y).

But, one question:

Does your proposed translation scheme for generic methods only apply to
static ones or both (static & instance)?


Best Regards,
Ali Ebrahimi

More information about the valhalla-spec-observers mailing list