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,9 +1185,10 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
case Token.DEBUGGER: {
return Ast.makeConstant(null);
}
}
default:
throw new RuntimeException("unexpected keyword literal " + node + " (" + node.getType() +")");
}
}
@Override
public CAstNode visitLabel(Label node, WalkContext arg) {

View File

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

View File

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

View File

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