Review Request: 7193406 - Clean-up JDK Build Warnings in java.util, java.io

Ulf Zibis Ulf.Zibis at CoSoCo.de
Thu Aug 30 14:14:27 UTC 2012


Am 30.08.2012 01:20, schrieb Stuart Marks:
> On 8/29/12 4:36 AM, Ulf Zibis wrote:
>>> @SuppressWarnings("fallthrough") is put to suppress warnings generated by
>>> another switch/case statements
>> Can't you move it from method scope to there?
>>
>>>             while (i >= matchlen && !seencomma) {
>>>                 switch(a[i-matchlen]) {
>>>                 case ',':
>>>                     seencomma = true;
>>>                     /*FALLTHROUGH*/
>>>                 case ' ': case '\r': case '\n':
>>>                 case '\f': case '\t':
>>>                     break;
>>>                 default:
>>>                     throw new IllegalArgumentException(
>>>                             "invalid permission: " + actions);
>>>                 }
>>>                 i--;
>>>             }
>
> Unfortunately there is no suitable place to put the annotation. Annotations can only be placed on 
> declarations, and the narrowest enclosing declaration around this switch statement is, 
> unfortunately, the entire method. One might consider refactoring the switch statement into its own 
> method, but that kind of refactoring is too large a change for warnings cleanup.

I can see that it is reasonable/possible to bind a @SuppressWarnings("unchecked") to a declaration 
which contains the unchecked assignment, but which declaration should contain a fallthrough case?

So shouldn't  @SuppressWarnings("fallthrough") better be binded to a switch or case statement?

-Ulf




More information about the core-libs-dev mailing list