Model 3 classfile design document

Rémi Forax forax at
Sun Jan 24 09:52:33 UTC 2016

Nice write up !

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

the bounds of T is not Runnable but any & Runnable, i.e. it's not an object so the specialization has to occur and if run() is called on a variable of type T, the compiler should first cast the value to Runnable and then do an invokeinterface.

This is very similar to the transformation actually done by the compiler when a type variable has several bounds.


Le 22 janvier 2016 17:52:17 CET, Brian Goetz <brian.goetz at> a écrit :
>Please find a document here:
>that describes our current thinking for evolving the classfile format
>clearly and efficiently represent parametric polymorphism.  The early 
>concepts of this approach were outlined in my talk at JVMLS last year; 
>this represents a refinement of those ideas, and a reasonable "stake in
>the ground" description of what seems the most sensible way to balance 
>preserving parametric information in the classfile without imposing 
>excessive runtime costs for loading specializations.
>We're working on an updated compiler prototype which people will be
>to play with soon (along with a formal model.)
>Please ask questions!
>Some things this document does not address yet:
>  - How we deal with types implicit in the bytecodes (aload vs iload) 
>and how they get specialized;
>  - How we represent restricted methods in the classfile;
>  - How we represent the wildcard type Foo<any>

More information about the valhalla-spec-observers mailing list