Semantics-preserving control-flow tweaks to fix switch warnings

Eclipse was warning that these `switch` statements had no `default`
cases.  Each did have some default behavior, but implemented outside
the `switch`.  By moving the default behavior into a `default` case
within the `switch`, we eliminate a static warning with no change
whatsoever to the run-time behavior.
This commit is contained in:
Ben Liblit 2017-08-06 14:20:39 -05:00 committed by Manu Sridharan
parent 30966195c8
commit 61e9641094
4 changed files with 8 additions and 4 deletions

View File

@ -1185,8 +1185,9 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
case Token.DEBUGGER: {
return Ast.makeConstant(null);
}
default:
throw new RuntimeException("unexpected keyword literal " + node + " (" + node.getType() +")");
}
throw new RuntimeException("unexpected keyword literal " + node + " (" + node.getType() +")");
}
@Override

View File

@ -169,8 +169,9 @@ public class BinaryLiteralOperation extends Instruction {
return IBinaryOpInstruction.Operator.DIV;
case REM_DOUBLE:
return IBinaryOpInstruction.Operator.REM;
default:
return null;
}
return null;
}
public boolean isFloat()

View File

@ -166,8 +166,9 @@ public class BinaryOperation extends Instruction {
return IBinaryOpInstruction.Operator.DIV;
case REM_DOUBLE:
return IBinaryOpInstruction.Operator.REM;
default:
return null;
}
return null;
}
public boolean isFloat()
{

View File

@ -262,8 +262,9 @@ public class CopyWriter {
return w.addCPDouble(cp.getCPDouble(i));
case ClassConstants.CONSTANT_Utf8:
return w.addCPUtf8(cp.getCPUtf8(i));
default:
return -1;
}
return -1;
}
private void doClass(final ClassInstrumenter ci) throws Exception {