Review Request: 7193406 - Clean-up JDK Build Warnings in java.util, java.io (original) (raw)
Rémi Forax forax at univ-mlv.fr
Fri Aug 31 07:20:15 UTC 2012
- Previous message: Review Request: 7193406 - Clean-up JDK Build Warnings in java.util, java.io
- Next message: Review Request: 7193406 - Clean-up JDK Build Warnings in java.util, java.io
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 08/30/2012 04:14 PM, Ulf Zibis wrote:
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
You can't put an annotation on a statement and the last time I check JSR 308, (a long time ago), it was something that was put aside.
Rémi
- Previous message: Review Request: 7193406 - Clean-up JDK Build Warnings in java.util, java.io
- Next message: Review Request: 7193406 - Clean-up JDK Build Warnings in java.util, java.io
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]