From e55f276286c925cf619040e6db25303ca4adb035 Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 27 Jun 1999 21:03:01 +0000 Subject: [PATCH] Use iterators instead of enumerations git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@934 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/flow/StructuredBlock.java | 34 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/jode/jode/flow/StructuredBlock.java b/jode/jode/flow/StructuredBlock.java index f4fab15..3349d8a 100644 --- a/jode/jode/flow/StructuredBlock.java +++ b/jode/jode/flow/StructuredBlock.java @@ -25,7 +25,11 @@ import jode.decompiler.LocalInfo; import jode.decompiler.Declarable; import jode.util.SimpleSet; -import java.util.Enumeration; +///#ifdef JDK12 +///import java.util.Iterator; +///#else +import jode.util.Iterator; +///#endif /** * A structured block is the building block of the source programm. @@ -364,7 +368,6 @@ public abstract class StructuredBlock { /* All variables used in more than one sub blocks, are * used in this block, too. */ - Enumeration enum = childUse.elements(); SimpleSet intersection = new SimpleSet(); intersection.addAll(childUse); intersection.retainAll(allUse); @@ -441,14 +444,12 @@ public abstract class StructuredBlock { * @param done The set of the already declare variables. */ public void makeDeclaration(SimpleSet done) { -// System.err.println("makeDeclaration: done = "+done); this.done = (SimpleSet) done.clone(); declare = new SimpleSet(); - java.util.Enumeration enum = used.elements(); -// System.err.println("makeDeclaration: used = "+used); + Iterator iter = used.iterator(); next_used: - while (enum.hasMoreElements()) { - Declarable declarable = (Declarable) enum.nextElement(); + while (iter.hasNext()) { + Declarable declarable = (Declarable) iter.next(); // Check if this is already declared. if (done.contains(declarable)) @@ -465,9 +466,9 @@ public abstract class StructuredBlock { // Merge with all locals in this block, that use the same // slot and have compatible types and names. - Enumeration doneEnum = done.elements(); - while (doneEnum.hasMoreElements()) { - Declarable previous = (Declarable) doneEnum.nextElement(); + Iterator doneIter = done.iterator(); + while (doneIter.hasNext()) { + Declarable previous = (Declarable) doneIter.next(); if (!(previous instanceof LocalInfo)) continue; LocalInfo prevLocal = (LocalInfo) previous; @@ -501,9 +502,9 @@ public abstract class StructuredBlock { } if (declarable.getName() != null) { - Enumeration doneEnum = done.elements(); - while (doneEnum.hasMoreElements()) { - Declarable previous = (Declarable) doneEnum.nextElement(); + Iterator doneIter = done.iterator(); + while (doneIter.hasNext()) { + Declarable previous = (Declarable) doneIter.next(); if (declarable.getName().equals(previous.getName())) { /* A name conflict happened. */ declarable.makeNameUnique(); @@ -513,7 +514,6 @@ public abstract class StructuredBlock { done.add(declarable); declare.add(declarable); } -// System.err.println("makeDeclaration: declare = "+declare); StructuredBlock[] subs = getSubBlocks(); for (int i=0; i