Changes to signatures?

Brian Goetz brian.goetz at oracle.com
Mon Oct 27 15:24:22 UTC 2014


>> Things that are currently expressible will retain their current
>> expression.  There may be new forms of expression added, such as
>>
>>    class Foo<any T> { ... }
>>    class Foo<ref T> { ... } // existing declarations of Foo<T>
>>                             // become shorthand for this
> No, I didn't mean Generics at the language level, but the Generic
> Signatures emitted in class files. Sorry, if that was not clear.

So, at the very least, we have to have a way to encode any-ness (or 
various other new capabilities or restrictions) of type variables in the 
classfile.  Its possible this will be stuffed into the signature 
attribute, and also possible we'll add another attribute instead.  This 
is effectively a "syntax" decision that can be late-bound (if in your 
capacity as compiler-maintainer, you have an opinion, feel free to share.)

It's a good time to revisit the generics-related attributes in the class 
file; one thing that has been a persistent source of pain, that we might 
fix now, is to have an attribute that encodes metadata about *all* the 
type variables from enclosing lexical scopes, rather than having to go 
to N different class files to gather that.  (The status quo is OK for 
compilers, which have probably pulled in the classes anyway, but less OK 
for a runtime specializer.)  The specializer needs this since to 
transform TT; to something, it has to know what T is being specialized 
to, and that means it has to know all the tvars in scope, not just the 
ones declared in the current class/method.


More information about the valhalla-dev mailing list