redundant cast test LintCast.java failing

Steve Sides steve.sides at oracle.com
Mon Sep 23 12:14:10 PDT 2013


Hi Werner,
I also noticed a recent change removed an '@A' from the expected output 
of the test
test/tools/javac/annotations/typeAnnotation/failures/LintCast.java
and the test now fails.

The test case in LintCast.java 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:

  LintCast.java:27:20: compiler.warn.redundant.cast: int[]

which removed the @A.  The warning text is more explicit than the 
diagnostic key and states,

Xlint:cast Test.java
Test.java:13: 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


More information about the type-annotations-dev mailing list