Improving javap output for annotations

Werner Dietl wdietl at gmail.com
Sat Feb 9 18:20:41 PST 2013


Jon,

I hadn't look at how to implement this - I assumed that performing the
substitutions wouldn't be much trouble.
I think this would make the javap output for annotations much more readable.

cu, WMD.

On Sat, Feb 9, 2013 at 9:01 AM, Jonathan Gibbons
<jonathan.gibbons at oracle.com> wrote:
> 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



-- 
http://www.google.com/profiles/wdietl


More information about the type-annotations-dev mailing list