diff --git a/jode/jode/flow/StructuredBlock.java b/jode/jode/flow/StructuredBlock.java index c26ce2c..9d50e8c 100644 --- a/jode/jode/flow/StructuredBlock.java +++ b/jode/jode/flow/StructuredBlock.java @@ -426,6 +426,12 @@ public abstract class StructuredBlock { while (enum.hasMoreElements()) { LocalInfo local = (LocalInfo) enum.nextElement(); + /* First generate the names for the locals, since this may + * also change their types, if they are in the local + * variable table. + */ + String localName = local.getName(); + // Merge with all locals in this block, that use the same // slot and have compatible type. int size = done.size(); @@ -442,11 +448,17 @@ public abstract class StructuredBlock { * of prevLocal (it has already a name) doesn't match * the intersected type. * - * A special case: this mustn't be merged, since it is - * special. "this" can't be assigned to. + * We don't want to merge variables, whose names are + * not generated by us and differ. + * + * And don't merge "this" with any other variable + * since it mustn't be written to. */ if (prevLocal.getType().isOfType(local.getType()) - && prevLocal.getName() != "this") { + && prevLocal.getName() != "this" + && (!prevLocal.isNameGenerated() + || !local.isNameGenerated() + || localName.equals(prevLocal.getName()))) { local.combineWith(prevLocal); continue next_used; }