From a2bee154c0af9920204a913f5de8eafd008535c9 Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 20 Mar 1999 00:28:06 +0000 Subject: [PATCH] calculate the "empty" ConstOperator git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@452 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/expr/ConstantArrayOperator.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/jode/jode/expr/ConstantArrayOperator.java b/jode/jode/expr/ConstantArrayOperator.java index b0a8f94..b4142dc 100644 --- a/jode/jode/expr/ConstantArrayOperator.java +++ b/jode/jode/expr/ConstantArrayOperator.java @@ -33,7 +33,22 @@ public class ConstantArrayOperator extends NoArgOperator { values = new Expression[size]; argType = (type instanceof ArrayType) ? Type.tSubType(((ArrayType)type).getElementType()) : Type.tError; - empty = new ConstOperator(argType, "0"); + Object emptyVal; + if (argType == type.tError || argType.isOfType(Type.tUObject)) + emptyVal = null; + else if (argType.isOfType(Type.tBoolUInt)) + emptyVal = new Integer(0); + else if (argType.isOfType(Type.tLong)) + emptyVal = new Long(0); + else if (argType.isOfType(Type.tFloat)) + emptyVal = new Float(0); + else if (argType.isOfType(Type.tDouble)) + emptyVal = new Double(0); + else + throw new IllegalArgumentException("Illegal Type: "+argType); + + empty = new ConstOperator(emptyVal); + empty.setType(argType); empty.makeInitializer(); }