From e00cff956c4674ed5cfbaca231e5fa48007f11c5 Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 30 Oct 1999 09:16:52 +0000 Subject: [PATCH] InvokeOperator has new constructor syntax Const/IInc-Operator.getValue() changed return type. git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1184 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/flow/CreateClassField.java | 4 ++-- jode/jode/flow/CreateConstantArray.java | 8 ++++---- jode/jode/flow/CreateIfThenElseOperator.java | 2 +- jode/jode/flow/CreateNewConstructor.java | 4 ++-- jode/jode/flow/CreatePrePostIncExpression.java | 11 +++++------ 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/jode/jode/flow/CreateClassField.java b/jode/jode/flow/CreateClassField.java index f27c00e..afaa91e 100644 --- a/jode/jode/flow/CreateClassField.java +++ b/jode/jode/flow/CreateClassField.java @@ -67,8 +67,8 @@ public class CreateClassField { if (invoke.isGetClass() && param instanceof ConstOperator - && param.getType().equals(Type.tString)) { - String clazz = ((ConstOperator)param).getValue(); + && ((ConstOperator)param).getValue() instanceof String) { + String clazz = (String) ((ConstOperator)param).getValue(); if (put.getField().setClassConstant(clazz)) { cmp.setSubExpressions (0, new ClassFieldOperator(clazz.charAt(0) == '[' diff --git a/jode/jode/flow/CreateConstantArray.java b/jode/jode/flow/CreateConstantArray.java index e8119d0..2cb0bb3 100644 --- a/jode/jode/flow/CreateConstantArray.java +++ b/jode/jode/flow/CreateConstantArray.java @@ -61,11 +61,11 @@ public class CreateConstantArray { if (dup.type != SpecialBlock.DUP || dup.depth != 0 || dup.count != 1 - || !(indexOp.getType().isOfType(Type.tUInt)) + || !(indexOp.getValue() instanceof Integer) || !(sequBlock.subBlocks[0] instanceof InstructionBlock)) return false; - int index = Integer.parseInt(indexOp.getValue()); + int index = ((Integer) indexOp.getValue()).intValue(); InstructionBlock ib = (InstructionBlock)sequBlock.subBlocks[0]; if (ib.getInstruction() instanceof NewArrayOperator) { @@ -79,10 +79,10 @@ public class CreateConstantArray { ConstOperator countop = (ConstOperator) newArray.getSubExpressions()[0]; - if (!countop.getType().isOfType(Type.tUInt)) + if (!(countop.getValue() instanceof Integer)) return false; - int arraylength = Integer.parseInt(countop.getValue()); + int arraylength = ((Integer) countop.getValue()).intValue(); if (arraylength <= index) return false; diff --git a/jode/jode/flow/CreateIfThenElseOperator.java b/jode/jode/flow/CreateIfThenElseOperator.java index 24d016e..fe8bf1a 100644 --- a/jode/jode/flow/CreateIfThenElseOperator.java +++ b/jode/jode/flow/CreateIfThenElseOperator.java @@ -96,7 +96,7 @@ public class CreateIfThenElseOperator { (ConstOperator) pushBlock.getInstruction(); if (condBlock.trueBlock.jump.destination == trueDest - && constOp.getValue().equals("0")) { + && constOp.getValue().equals(new Integer(0))) { Expression cond = condBlock.getInstruction(); condBlock.flowBlock.removeSuccessor(condBlock.trueBlock.jump); diff --git a/jode/jode/flow/CreateNewConstructor.java b/jode/jode/flow/CreateNewConstructor.java index c3fa073..4387887 100644 --- a/jode/jode/flow/CreateNewConstructor.java +++ b/jode/jode/flow/CreateNewConstructor.java @@ -87,14 +87,14 @@ public class CreateNewConstructor { Type appendType = appendCall.getMethodType().getParameterTypes()[0]; if (!appendType.equals(Type.tString)) { InvokeOperator valueOf = new InvokeOperator - (methodAna, true, false, + (methodAna, InvokeOperator.STATIC, Reference.getReference("Ljava/lang/String;", "valueOf", "(" + appendType.getTypeSignature() + ")Ljava/lang/String;")); expr = valueOf.addOperand(expr); } InvokeOperator newConstr = new InvokeOperator - (methodAna, false, true, + (methodAna, InvokeOperator.CONSTRUCTOR, Reference.getReference("Ljava/lang/StringBuffer;", "", "(Ljava/lang/String;)V")); newConstr.makeNonVoid(); diff --git a/jode/jode/flow/CreatePrePostIncExpression.java b/jode/jode/flow/CreatePrePostIncExpression.java index ba92a0c..7faf8b6 100644 --- a/jode/jode/flow/CreatePrePostIncExpression.java +++ b/jode/jode/flow/CreatePrePostIncExpression.java @@ -72,9 +72,9 @@ public class CreatePrePostIncExpression { else return false; - if (iinc.getValue().equals("-1")) + if (iinc.getValue() == -1) op ^= 1; - else if (!iinc.getValue().equals("1")) + else if (iinc.getValue() != 1) return false; if (!iinc.lvalueMatches(load)) @@ -134,11 +134,10 @@ public class CreatePrePostIncExpression { else return false; - if (constOp.getValue().equals("-1") - || constOp.getValue().equals("-1.0")) + /* Why doubleValue? This is the most exact measurement. */ + if (((Number)constOp.getValue()).doubleValue() == -1.0) op ^= 1; - else if (!constOp.getValue().equals("1") - && !constOp.getValue().equals("-1.0")) + else if (((Number)constOp.getValue()).doubleValue() != 1.0) return false; if (!(last.outer instanceof SequentialBlock))