Fix compiler warnings about missing switch cases for ChangeType
There are several places in the code where an enumerated type is used in a switch statement, but not all of the enumeration's values have a corresponding case block, and there is no default block. This causes compiler warnings. The missing cases are not necessarily a problem, but the warnings cause a lot of noise and make it easier to overlook other new warnings that appear when adding new code. The warnings could be silenced by simply adding a default block in the switch, but this would prevent the warnings from appearing again if any new value is added in the enumeration, which would make it a bit more difficult to track down all the places that need to be updated. Instead, add explicit case statements for the missing values, containing only a break statement. Thus, the compiler warnings are silenced, the code behaves the same as before, and warnings will appear again if any new enumeration value is added. Change-Id: Ifcbef809348f710e38764fbb642ee859983d035e
This commit is contained in:
committed by
Shawn Pearce
parent
213d5ec4cd
commit
272d5c92d7
@@ -687,14 +687,19 @@ public class PatchTable extends Composite {
|
||||
case ADDED:
|
||||
m.append(Util.M.patchTableSize_Lines(ins));
|
||||
break;
|
||||
|
||||
case DELETED:
|
||||
m.nbsp();
|
||||
break;
|
||||
|
||||
case MODIFIED:
|
||||
case COPIED:
|
||||
case RENAMED:
|
||||
m.append(Util.M.patchTableSize_Modify(ins, dels));
|
||||
break;
|
||||
|
||||
case REWRITE:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
m.nbsp();
|
||||
|
||||
@@ -241,6 +241,12 @@ class PatchScriptFactory extends Handler<PatchScript> {
|
||||
name = oldName;
|
||||
}
|
||||
break;
|
||||
|
||||
case MODIFIED:
|
||||
case DELETED:
|
||||
case ADDED:
|
||||
case REWRITE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,6 +272,9 @@ class PatchScriptFactory extends Handler<PatchScript> {
|
||||
}
|
||||
loadPublished(byKey, aic, newName);
|
||||
break;
|
||||
|
||||
case REWRITE:
|
||||
break;
|
||||
}
|
||||
|
||||
final CurrentUser user = control.getCurrentUser();
|
||||
@@ -288,6 +297,9 @@ class PatchScriptFactory extends Handler<PatchScript> {
|
||||
}
|
||||
loadDrafts(byKey, aic, me, newName);
|
||||
break;
|
||||
|
||||
case REWRITE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -169,10 +169,14 @@ public class ChangeData {
|
||||
case COPIED:
|
||||
r.add(e.getNewName());
|
||||
break;
|
||||
|
||||
case RENAMED:
|
||||
r.add(e.getOldName());
|
||||
r.add(e.getNewName());
|
||||
break;
|
||||
|
||||
case REWRITE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
currentFiles = r.toArray(new String[r.size()]);
|
||||
|
||||
@@ -169,6 +169,8 @@ public class PRED_commit_delta_4 extends Predicate.P4 {
|
||||
return rename;
|
||||
case COPIED:
|
||||
return copy;
|
||||
case REWRITE:
|
||||
break;
|
||||
}
|
||||
throw new IllegalArgumentException("ChangeType not recognized");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user