Cleanup (formatting)

master
Roman Shevchenko 10 years ago
parent 99404ea6cf
commit c64b0aaa10
  1. 25
      src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java
  2. 12
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java

@ -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)) {

@ -357,21 +357,23 @@ public class InvocationExprent extends Exprent {
Set<Integer> setAmbiguousParameters = getAmbiguousParameters(); Set<Integer> setAmbiguousParameters = getAmbiguousParameters();
boolean firstpar = true; boolean firstParameter = true;
int start = isEnum ? 2 : 0; int start = isEnum ? 2 : 0;
for (int i = start; i < lstParameters.size(); i++) { for (int i = start; i < lstParameters.size(); i++) {
if (sigFields == null || sigFields.get(i) == null) { if (sigFields == null || sigFields.get(i) == null) {
if (!firstpar) { if (!firstParameter) {
buf.append(", "); buf.append(", ");
} }
TextBuffer buff = new TextBuffer(); TextBuffer buff = new TextBuffer();
ExprProcessor.getCastedExprent(lstParameters.get(i), descriptor.params[i], buff, indent, true, setAmbiguousParameters.contains(i), tracer); boolean ambiguous = setAmbiguousParameters.contains(i);
ExprProcessor.getCastedExprent(lstParameters.get(i), descriptor.params[i], buff, indent, true, ambiguous, tracer);
buf.append(buff); buf.append(buff);
firstpar = false;
firstParameter = false;
} }
} }
buf.append(")"); buf.append(")");
return buf; return buf;

Loading…
Cancel
Save