Skip to content
Permalink
Browse files
These type casts are not needed.
  • Loading branch information
garydgregory committed May 25, 2020
1 parent c4e5d40 commit a90b69652be2d2d538e4aea175468f41cd455f20
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
@@ -119,7 +119,7 @@ public LexicalFrame pop() {
frame.set(symbol, value);
}
}
return (LexicalFrame) previous;
return previous;
}

}
@@ -106,7 +106,7 @@ public boolean debug(JxltEngine.Template jt) {
protected Object visit(ASTBlock node, Object data) {
// if not really a template, must use super impl
if (exprs == null) {
return super.visit((ASTBlock) node, data);
return super.visit(node, data);
}
// open the block
builder.append('{');
@@ -68,7 +68,7 @@ public Object invoke(Object obj, Object... params) throws Exception {
boolean invoke = true;
if (obj != null) {
if (obj instanceof Class<?>) {
invoke = ctorClass.equals((Class<?>) obj);
invoke = ctorClass.equals(obj);
} else {
invoke = ctorClass.getName().equals(obj.toString());
}
@@ -86,7 +86,7 @@ public Object tryInvoke(String name, Object obj, Object... params) {
boolean invoke = true;
if (obj != null) {
if (obj instanceof Class<?>) {
invoke = ctorClass.equals((Class<?>) obj);
invoke = ctorClass.equals(obj);
} else {
invoke = ctorClass.getName().equals(obj.toString());
}
@@ -320,7 +320,7 @@ public void testBigdOp() throws Exception {
String expr = "2.3*SO/100";

Object evaluate = JEXL.createExpression(expr).evaluate(jc);
Assert.assertEquals(sevendot475, (BigDecimal) evaluate);
Assert.assertEquals(sevendot475, evaluate);
}

// JEXL-24: big integers and big decimals
@@ -98,7 +98,7 @@ private boolean isLexicalShade() {
}

private static String refactor(TemplateDebugger td, JxltEngine.Template ts) {
boolean dbg = td.debug((TemplateScript)ts);
boolean dbg = td.debug(ts);
if (dbg) {
return td.toString();
} else {
@@ -580,7 +580,7 @@ public void test42() throws Exception {
Assert.assertNotNull(dstr);

TemplateDebugger td = new TemplateDebugger();
String refactored = refactor(td, (TemplateScript) t);
String refactored = refactor(td, t);
Assert.assertNotNull(refactored);
Assert.assertEquals(test42, refactored);
}
@@ -647,7 +647,7 @@ public void testReport() throws Exception {
Assert.assertEquals(ctl, output);

TemplateDebugger td = new TemplateDebugger();
String refactored = refactor(td, (TemplateScript) t);
String refactored = refactor(td, t);
Assert.assertNotNull(refactored);
Assert.assertEquals(rpt, refactored);
}
@@ -707,7 +707,7 @@ public void testReport2() throws Exception {
Assert.assertTrue(output.indexOf("45") > 0);

TemplateDebugger td = new TemplateDebugger();
String xxx = refactor(td, (TemplateScript) t);
String xxx = refactor(td, t);
Assert.assertNotNull(xxx);
Assert.assertEquals(rpt, xxx);
}
@@ -182,7 +182,7 @@ public void testHoistLambda() throws Exception {
hvars = s15.getVariables();
Assert.assertEquals(1, hvars.size());
// evidence this is not (strictly) a local since it inherited a captured value
result = ((JexlScript) s15).execute(ctx, 27);
result = s15.execute(ctx, 27);
Assert.assertEquals(42, result);
}

@@ -288,13 +288,13 @@ public void testSideEffectBean() throws Exception {
Assert.assertEquals(foo.value, i41 % 2);
foo.value = i41;
asserter.assertExpression("foo.value &= 3", (long) (i41 & 3));
Assert.assertEquals(foo.value, (long)(i41 & 3));
Assert.assertEquals(foo.value, i41 & 3);
foo.value = i41;
asserter.assertExpression("foo.value |= 2", (long)(i41 | 2));
Assert.assertEquals(foo.value, (long)(i41 | 2));
Assert.assertEquals(foo.value, i41 | 2);
foo.value = i41;
asserter.assertExpression("foo.value ^= 2", (long)(i41 ^ 2));
Assert.assertEquals(foo.value, (long)(i41 ^ 2));
Assert.assertEquals(foo.value, i41 ^ 2);
}

@Test
@@ -322,13 +322,13 @@ public void testSideEffectBeanContainer() throws Exception {
Assert.assertEquals(foo.value, i41 % 2);
foo.value = i41;
asserter.assertExpression("foo.bar[0] &= 3", (long) (i41 & 3));
Assert.assertEquals(foo.value, (long)(i41 & 3));
Assert.assertEquals(foo.value, i41 & 3);
foo.value = i41;
asserter.assertExpression("foo.bar[0] |= 2", (long)(i41 | 2));
Assert.assertEquals(foo.value, (long)(i41 | 2));
Assert.assertEquals(foo.value, i41 | 2);
foo.value = i41;
asserter.assertExpression("foo.bar[0] ^= 2", (long)(i41 ^ 2));
Assert.assertEquals(foo.value, (long)(i41 ^ 2));
Assert.assertEquals(foo.value, i41 ^ 2);
}

@Test

0 comments on commit a90b696

Please sign in to comment.