redundant cast test failing

Jonathan Gibbons jonathan.gibbons at
Mon Sep 23 12:21:00 PDT 2013

On 09/23/2013 12:14 PM, Steve Sides wrote:
> Hi Werner,
> I also noticed a recent change removed an '@A' from the expected 
> output of the test
> test/tools/javac/annotations/typeAnnotation/failures/
> and the test now fails.
> The test case in is
>     void array() {
>         int @A [] a = null;
>         int[] a1 = (int[])a;     //this line is the one in question
>         int[] a2 = (int @A [])a;
>     }
> This casts 'int @A[]'a  to 'int[]'.  The expected was changed to:
> compiler.warn.redundant.cast: int[]
> which removed the @A.  The warning text is more explicit than the 
> diagnostic key and states,
> Xlint:cast
> warning: [cast] redundant cast to int @A []
>         int[] a1 = (int[])a;
>                    ^
> 1 warning
> Was the change to the out file expected? I makes more sense, but was 
> it expected?
> -steve


Thanks for the detail you provide here.

I raised this issue with Werner in my review of a recent changeset last 

Looking at the details you provide, it does seem that the change is 
correct: after all, there is no annotation on the statement in question, 
and so it seems like it was an error that it appears in the diagnostic.

-- jon

More information about the type-annotations-dev mailing list