From 8ee12e406c51c8c1829cb4a72b1371eb58ad3fe9 Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 6 Mar 1999 21:32:53 +0000 Subject: [PATCH] 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 --- jode/jode/expr/ConstOperator.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jode/jode/expr/ConstOperator.java b/jode/jode/expr/ConstOperator.java index ccc14d1..86df76b 100644 --- a/jode/jode/expr/ConstOperator.java +++ b/jode/jode/expr/ConstOperator.java @@ -111,12 +111,16 @@ public class ConstOperator extends NoArgOperator { if (type.isOfType(Type.tFloat)) return value+"F"; 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 * 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 value; }