From b856b2484b8a623980b111146a252157f5766786 Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 6 May 1999 12:04:21 +0000 Subject: [PATCH] New StoreInstruction/LValue expressions remove try {} catch(ClassCastException) git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@787 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/flow/CompleteSynchronized.java | 29 ++++++++++++------------ 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/jode/jode/flow/CompleteSynchronized.java b/jode/jode/flow/CompleteSynchronized.java index ba30822..9bf42ee 100644 --- a/jode/jode/flow/CompleteSynchronized.java +++ b/jode/jode/flow/CompleteSynchronized.java @@ -72,24 +72,25 @@ public class CompleteSynchronized { /* Is there another expression? */ if (!(last.outer instanceof SequentialBlock)) return false; + SequentialBlock sequBlock = (SequentialBlock) last.outer; - Expression object; - try { - SequentialBlock sequBlock = (SequentialBlock) last.outer; - - LocalStoreOperator assign = (LocalStoreOperator) - ((InstructionBlock) sequBlock.subBlocks[0]).getInstruction(); + if (!(sequBlock.subBlocks[0] instanceof InstructionBlock)) + return false; + InstructionBlock ib = (InstructionBlock) sequBlock.subBlocks[0]; - if (assign.getLocalInfo() != synBlock.local.getLocalInfo()) - return false; - - object = assign.getSubExpressions()[0]; + if (!(ib.getInstruction() instanceof StoreInstruction)) + return false; + StoreInstruction assign = (StoreInstruction) ib.getInstruction(); - } catch (ClassCastException ex) { - return false; - } + if (!(assign.getLValue() instanceof LocalStoreOperator)) + return false; + LocalStoreOperator lvalue = (LocalStoreOperator) assign.getLValue(); + + if (lvalue.getLocalInfo() != synBlock.local.getLocalInfo() + || assign.getSubExpressions()[1] == null) + return false; - synBlock.object = object; + synBlock.object = assign.getSubExpressions()[1]; synBlock.moveDefinitions(last.outer,last); last.replace(last.outer); return true;