boolean (List<Exprent> list, int index) { Exprent current = list.get(index); if (current.type == Exprent.EXPRENT_ASSIGNMENT) { AssignmentExprent as = (AssignmentExprent)current; if (as.getLeft().type == Exprent.EXPRENT_VAR && as.getRight().type == Exprent.EXPRENT_NEW) { NewExprent newExpr = (NewExprent)as.getRight(); VarType newType = newExpr.getNewType(); VarVersionPair leftPair = new VarVersionPair((VarExprent)as.getLeft()); if (newType.getType() == CodeConstants.TYPE_OBJECT && newType.getArrayDim() == 0 && newExpr.getConstructor() == null) { for (int i = index + 1; i < list.size(); i++) { Exprent remote = list.get(i); // <init> invocation if (remote.type == Exprent.EXPRENT_INVOCATION) { InvocationExprent in = (InvocationExprent)remote; if (in.getFuncType() == InvocationExprent.TYPE_INIT && in.getInstance().type == Exprent.EXPRENT_VAR && as.getLeft().equals(in.getInstance())) { newExpr.setConstructor(in); in.setInstance(null); list.set(i, as.copy()); return true; } } // check for variable in use Set<VarVersionPair> setVars = remote.getAllVariables(); if (setVars.contains(leftPair)) { // variable used somewhere in between -> exit, need a better reduced code return false; } } } } } return false; }