need better printer
Jonathan Gibbons
jonathan.gibbons at oracle.com
Thu Jan 24 19:45:12 PST 2013
On 01/24/2013 07:32 PM, Werner Dietl wrote:
> Also note that that rudimentary logic is duplicated in
> com.sun.tools.javac.code.Printer.visitAnnotatedType.
> Can we just use the Printer?
??? ... I was talking about
com.sun.tools.javac.code.Printer.visitAnnotatedType ... ???
I'm guessing you were talking about AnnotatedType.toString(), or you
thought I was.
Since no other *Type.toString() uses Printer, I'm loathe to break the
pattern.
>
> This also depends on whether we go with delegation or anon subtypes
> for AnnotatedType.
>
> cu, WMD.
>
> On Thu, Jan 24, 2013 at 5:01 PM, Jonathan Gibbons
> <jonathan.gibbons at oracle.com> wrote:
>> Werner,
>>
>> The following code in com.sun.tools.javac.code.Printer needs to be fixed to
>> render the annotation in JLS format, since the text can appear in diagnostic
>> messages;
>>
>> @Override
>> public String visitAnnotatedType(AnnotatedType t, Locale locale) {
>> if (t.typeAnnotations != null &&
>> t.typeAnnotations.nonEmpty()) {
>> // TODO: better logic for arrays, ...
>> return "(" + t.typeAnnotations + " :: " +
>> visit(t.underlyingType, locale) + ")";
>> } else {
>> return "({} :: " + visit(t.underlyingType, locale) + ")";
>> }
>> }
>>
>> Separately, I am working on better printers for debugging.
>>
>> -- Jon
>
>
More information about the type-annotations-dev
mailing list