test failures
Jonathan Gibbons
jonathan.gibbons at oracle.com
Thu Apr 25 19:53:17 PDT 2013
Thanks for the explanation.
I agree with the extra space when annotations are present.
I'll push the patch probably tomorrow.
-- Jon
On 04/25/2013 06:59 PM, Werner Dietl wrote:
> Jon,
>
> thanks for looking into this!
>
> JCNewArray.dimAnnotations is the array of type annotations per array
> dimension. It contains empty lists for dimensions without annotations
> in between, but is not guaranteed to be the same length as
> JCNewArray.dims. So it might be shorter if there are fewer annotated
> dimensions.
>
> The reason I added the space was that otherwise we would see
> new Co []@TB[]
>
> instead of
> new Co [] @TB[]
>
> which I think made the relation of the type annotation clearer.
> Are there any test cases for Pretty? Looking at the code it's not
> quite clear to me that the component type annotations are output
> correctly, that is, whether "new @TA Co @TB[]" appears correctly.
>
> In any case, if da.get(i).isEmpty() we do not need to output that
> space, so I agree with your patch.
>
> cu, WMD.
>
>
>
> On Thu, Apr 25, 2013 at 4:06 PM, Jonathan Gibbons
> <jonathan.gibbons at oracle.com> wrote:
>> On 04/24/2013 09:51 PM, Jonathan Gibbons wrote:
>>>
>>> The generics test is mostly OK -- the failure is a white-space change, so
>>> someone has messed with generating a string.
>>
>> The problem is the space character written to the output in Pretty.java,
>> line 951. This patch fixes it, but I would like Werner to confirm it
>> before I push it. In particular, I don't yet understand the "if (da.size()
>>> i)" part of the expression.
>> diff -r ac33d03e35b8 src/share/classes/com/sun/tools/javac/tree/Pretty.java
>> --- a/src/share/classes/com/sun/tools/javac/tree/Pretty.java Thu Apr 25
>> 08:27:04 2013 +0200
>> +++ b/src/share/classes/com/sun/tools/javac/tree/Pretty.java Thu Apr 25
>> 12:56:21 2013 -0700
>> @@ -951,7 +951,7 @@
>> int i = 0;
>> List<List<JCAnnotation>> da = tree.dimAnnotations;
>> for (List<JCExpression> l = tree.dims; l.nonEmpty(); l =
>> l.tail) {
>> - if (da.size() > i) {
>> + if (da.size() > i && !da.get(i).isEmpty()) {
>> print(' ');
>> printTypeAnnotations(da.get(i));
>> }
>>
>> -- Jon
>
>
More information about the type-annotations-dev
mailing list