constant assignments also don't need casts

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@304 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent b3e4eebdc1
commit 8ee12e406c
  1. 8
      jode/jode/expr/ConstOperator.java

@ -111,12 +111,16 @@ public class ConstOperator extends NoArgOperator {
if (type.isOfType(Type.tFloat)) if (type.isOfType(Type.tFloat))
return value+"F"; return value+"F";
if (!type.isOfType(Type.tInt) && type.isOfType(Type.tUInt) if (!type.isOfType(Type.tInt) && type.isOfType(Type.tUInt)
&& !isInitializer) && !isInitializer
&& (parent == null
|| parent.getOperator().getOperatorIndex() != ASSIGN_OP)) {
/* One of the strange things in java. All constants /* One of the strange things in java. All constants
* are int and must be explicitly casted to byte,...,short. * are int and must be explicitly casted to byte,...,short.
* But in initializers this cast is unnecessary. * But in assignments and initializers this cast is unnecessary.
* See JLS section 5.2
*/ */
return "("+type+") "+value; return "("+type+") "+value;
}
return value; return value;
} }

Loading…
Cancel
Save