RFE for easy bytecode signatures
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Mon Jul 18 20:56:01 UTC 2016
Disclaimer: I'm parsing your 'bytecode signature' as 'descriptor' i.e.
not as signature as in Signature attribute.
This is a nice idea - or at least used to be nice before Valhalla where
a descriptor mapped 1-1 with an Utf8_info entry in the constant pool.
With Valhalla, a descriptor is a structural thing - it has some kind of
toString representation, but mostly for javap purposes - for instance, a
type variable in a descriptor is just an index plus some erasure info,
so that kind of stuff doesn't translate well into a string
representation; javap currently uses something like:
List<X/Object>
To denote the generic type List<X> (where X's erasure is Object). I'm
not sure what benefit there could be in exposing this representation,
given that the same representation does not make any sense at the VM
level - in other words, things are now different from the Utf8-based
world we had before Valhalla.
Does it make any sense?
Maurizio
On 18/07/16 20:12, Paul Benedict wrote:
> I'd like to make a request. I haven't found any feature yet in the JDK
> where one can take a reflective object and the JDK can hand back its
> bytecode signature. There is some support for it in toString() methods, but
> I don't find that ideal. I'd like to have a dedicated method that
> understands scope and generics, too.
>
> With the advent of Maurizio's new reflection API [1], I am eagerly
> wondering if you can please add additional methods to return the signatures
> behind any mirror/scope? Hopefully, it shouldn't be too hard, because there
> is a ton of signature code already written (according to the commits I
> follow). I imagine it could be lifted from the compiler and into the
> reflective classes.
>
> Thoughts please?
>
> [1] http://cr.openjdk.java.net/~mcimadamore/x-reflection/index.html
>
> Cheers,
> Paul
More information about the valhalla-dev
mailing list