Improving javap output for annotations
Jonathan Gibbons
jonathan.gibbons at oracle.com
Sat Feb 9 09:01:46 PST 2013
On 02/09/2013 01:21 AM, Werner Dietl wrote:
> The current output from javap -v is quite hard to read when it comes
> to annotations.
> For a declaration annotation, it displays:
>
> RuntimeInvisibleAnnotations:
> 0: #29()
>
> Similarly, for a complex type annotation, we see:
>
> 2: #18(#19=s#20,#21=I#22,#23=[I#24,I#22,I#25]):
> METHOD_REFERENCE, offset=0, location=[TYPE_ARGUMENT(1)]
>
> The value of constant pool references is resolved in other locations -
> as a comment. For example:
>
> 0: invokedynamic #2, 0 // InvokeDynamic
> #0:lambda:()Ljava/util/function/Function;
>
> Would it be possible to implement similar logic for annotations? Or is
> there an option I'm missing?
>
> cu, WMD.
>
Werner,
The annotations attributes are complex, and so it has proved
a challenge to come up with a reasonable display for javap
to use to show the contents of the annotations. If you have
any suggestions, I'd be interested. That being said, a multi-line
display similar to that used by the recent DPrinter utility might
work well.
-- Jon
More information about the type-annotations-dev
mailing list