|
|
@ -855,8 +855,12 @@ public class ExprProcessor implements CodeConstants { |
|
|
|
return defaultval; |
|
|
|
return defaultval; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static boolean getCastedExprent(Exprent exprent, VarType leftType, TextBuffer buffer, int indent, |
|
|
|
public static boolean getCastedExprent(Exprent exprent, |
|
|
|
boolean castNull, BytecodeMappingTracer tracer) { |
|
|
|
VarType leftType, |
|
|
|
|
|
|
|
TextBuffer buffer, |
|
|
|
|
|
|
|
int indent, |
|
|
|
|
|
|
|
boolean castNull, |
|
|
|
|
|
|
|
BytecodeMappingTracer tracer) { |
|
|
|
return getCastedExprent(exprent, leftType, buffer, indent, castNull, false, tracer); |
|
|
|
return getCastedExprent(exprent, leftType, buffer, indent, castNull, false, tracer); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -865,7 +869,8 @@ public class ExprProcessor implements CodeConstants { |
|
|
|
TextBuffer buffer, |
|
|
|
TextBuffer buffer, |
|
|
|
int indent, |
|
|
|
int indent, |
|
|
|
boolean castNull, |
|
|
|
boolean castNull, |
|
|
|
boolean castAlways, BytecodeMappingTracer tracer) { |
|
|
|
boolean castAlways, |
|
|
|
|
|
|
|
BytecodeMappingTracer tracer) { |
|
|
|
|
|
|
|
|
|
|
|
boolean ret = false; |
|
|
|
boolean ret = false; |
|
|
|
VarType rightType = exprent.getExprType(); |
|
|
|
VarType rightType = exprent.getExprType(); |
|
|
@ -873,16 +878,10 @@ public class ExprProcessor implements CodeConstants { |
|
|
|
TextBuffer res = exprent.toJava(indent, tracer); |
|
|
|
TextBuffer res = exprent.toJava(indent, tracer); |
|
|
|
|
|
|
|
|
|
|
|
boolean cast = |
|
|
|
boolean cast = |
|
|
|
!leftType.isSuperset(rightType) && (rightType.equals(VarType.VARTYPE_OBJECT) || leftType.type != CodeConstants.TYPE_OBJECT); |
|
|
|
castAlways || |
|
|
|
cast |= castAlways; |
|
|
|
(!leftType.isSuperset(rightType) && (rightType.equals(VarType.VARTYPE_OBJECT) || leftType.type != CodeConstants.TYPE_OBJECT)) || |
|
|
|
|
|
|
|
(castNull && rightType.type == CodeConstants.TYPE_NULL && !UNDEFINED_TYPE_STRING.equals(getTypeName(leftType))) || |
|
|
|
if (!cast && castNull && rightType.type == CodeConstants.TYPE_NULL) { |
|
|
|
(isIntConstant(exprent) && VarType.VARTYPE_INT.isStrictSuperset(leftType)); |
|
|
|
// check for a nameless anonymous class
|
|
|
|
|
|
|
|
cast = !UNDEFINED_TYPE_STRING.equals(getTypeName(leftType)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!cast) { |
|
|
|
|
|
|
|
cast = isIntConstant(exprent) && VarType.VARTYPE_INT.isStrictSuperset(leftType); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (cast) { |
|
|
|
if (cast) { |
|
|
|
if (exprent.getPrecedence() >= FunctionExprent.getPrecedence(FunctionExprent.FUNCTION_CAST)) { |
|
|
|
if (exprent.getPrecedence() >= FunctionExprent.getPrecedence(FunctionExprent.FUNCTION_CAST)) { |
|
|
|