test failures

Jonathan Gibbons jonathan.gibbons at oracle.com
Thu Apr 25 19:58:37 PDT 2013


Actually, I think javadoc is using
     new Co [] @TB []

with spaces before and after the annos.

There are no specific test cases that I know of for Pretty.
Maybe we should start a test containing interesting test cases.

-- Jon


On 04/25/2013 07:53 PM, Jonathan Gibbons wrote:
> 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