Changed enum to enumeration to make it compile with Java 5

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1390 379699f6-c40d-0410-875b-85095c16579e
master
hoenicke 20 years ago
parent 183db2f66c
commit 4ff081adef
  1. 12
      jode/src/net/sf/jode/bytecode/BasicBlockReader.java
  2. 2
      jode/src/net/sf/jode/bytecode/BinaryInfo.java
  3. 20
      jode/src/net/sf/jode/bytecode/ClassPath.java
  4. 36
      jode/src/net/sf/jode/decompiler/LocalInfo.java
  5. 6
      jode/src/net/sf/jode/decompiler/Main.java
  6. 36
      jode/src/net/sf/jode/decompiler/MethodAnalyzer.java
  7. 6
      jode/src/net/sf/jode/decompiler/OuterValues.java
  8. 32
      jode/src/net/sf/jode/decompiler/TabbedPrintWriter.java
  9. 12
      jode/src/net/sf/jode/obfuscator/PackageIdentifier.java
  10. 18
      jode/src/net/sf/jode/obfuscator/modules/LocalOptimizer.java
  11. 12
      jode/src/net/sf/jode/swingui/HierarchyTreeModel.java
  12. 6
      jode/src/net/sf/jode/swingui/PackagesTreeModel.java
  13. 6
      jode/src/net/sf/jode/type/ReferenceType.java

@ -1003,10 +1003,10 @@ class BasicBlockReader implements Opcodes {
&& instr.getOpcode() <= opc_astore)
addr = infos[i].nextAddr;
Enumeration enum = lvt[slot].elements();
Enumeration enumeration = lvt[slot].elements();
LVTEntry match = null;
while (enum.hasMoreElements()) {
LVTEntry lve = (LVTEntry) enum.nextElement();
while (enumeration.hasMoreElements()) {
LVTEntry lve = (LVTEntry) enumeration.nextElement();
if (lve.start <= addr && lve.end > addr) {
if (match != null
&& (!match.name.equals(lve.name)
@ -1028,10 +1028,10 @@ class BasicBlockReader implements Opcodes {
for (int slot=0; slot< paramCount; slot++) {
if (lvt[slot] == null)
continue;
Enumeration enum = lvt[slot].elements();
Enumeration enumeration = lvt[slot].elements();
LVTEntry match = null;
while (enum.hasMoreElements()) {
LVTEntry lve = (LVTEntry) enum.nextElement();
while (enumeration.hasMoreElements()) {
LVTEntry lve = (LVTEntry) enumeration.nextElement();
if (lve.start == 0) {
if (match != null
&& (!match.name.equals(lve.name)

@ -106,7 +106,7 @@ public class BinaryInfo {
*/
public static int ACC_VARARGS = 0x0080;
/**
* The bit mask representing enum fields.
* The bit mask representing enumeration fields.
*/
public static int ACC_ENUM = 0x0100;
/**

@ -942,29 +942,29 @@ public class ClassPath {
public Enumeration listFiles(final String dirName) {
return new Enumeration() {
int i = 0;
Enumeration enum;
Enumeration enumeration;
public boolean hasMoreElements() {
while (true) {
while (enum == null && i < paths.length) {
while (enumeration == null && i < paths.length) {
if (paths[i] != null && paths[i].exists(dirName)
&& paths[i].isDirectory(dirName))
enum = paths[i].listFiles(dirName);
enumeration = paths[i].listFiles(dirName);
i++;
}
if (enum == null)
if (enumeration == null)
return false;
if (enum.hasMoreElements())
if (enumeration.hasMoreElements())
return true;
enum = null;
enumeration = null;
}
}
public Object nextElement() {
if (!hasMoreElements())
return new NoSuchElementException();
return enum.nextElement();
return enumeration.nextElement();
}
};
}
@ -977,14 +977,14 @@ public class ClassPath {
*/
public Enumeration listClassesAndPackages(String packageName) {
String dir = packageName.replace('.','/');
final Enumeration enum = listFiles(dir);
final Enumeration enumeration = listFiles(dir);
final String prefix = dir.length() > 0 ? dir + "/" : dir;
return new Enumeration() {
String next = getNext();
private String getNext() {
while (enum.hasMoreElements()) {
String name = (String) enum.nextElement();
while (enumeration.hasMoreElements()) {
String name = (String) enumeration.nextElement();
if (name.indexOf('.') == -1
&& isDirectory(prefix + name))
// This is a package

@ -153,10 +153,10 @@ public class LocalInfo implements Declarable {
boolean needTypeUpdate = !shadow.type.equals(type);
java.util.Enumeration enum = operators.elements();
while (enum.hasMoreElements()) {
java.util.Enumeration enumeration = operators.elements();
while (enumeration.hasMoreElements()) {
LocalVarOperator lvo =
(LocalVarOperator) enum.nextElement();
(LocalVarOperator) enumeration.nextElement();
if (needTypeUpdate) {
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_TYPES) != 0)
@ -166,9 +166,9 @@ public class LocalInfo implements Declarable {
shadow.operators.addElement(lvo);
}
enum = hints.elements();
while (enum.hasMoreElements()) {
Object hint = enum.nextElement();
enumeration = hints.elements();
while (enumeration.hasMoreElements()) {
Object hint = enumeration.nextElement();
if (!shadow.hints.contains(hint))
shadow.hints.addElement(hint);
}
@ -209,9 +209,9 @@ public class LocalInfo implements Declarable {
return shadow.guessName();
}
if (name == null) {
Enumeration enum = hints.elements();
while (enum.hasMoreElements()) {
Hint hint = (Hint) enum.nextElement();
Enumeration enumeration = hints.elements();
while (enumeration.hasMoreElements()) {
Hint hint = (Hint) enumeration.nextElement();
if (type.isOfType(hint.getType())) {
name = hint.getName();
setType(hint.getType());
@ -325,9 +325,9 @@ public class LocalInfo implements Declarable {
if (!li.type.equals(newType)) {
li.type = newType;
java.util.Enumeration enum = li.operators.elements();
while (enum.hasMoreElements()) {
LocalVarOperator lvo = (LocalVarOperator) enum.nextElement();
java.util.Enumeration enumeration = li.operators.elements();
while (enumeration.hasMoreElements()) {
LocalVarOperator lvo = (LocalVarOperator) enumeration.nextElement();
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_TYPES) != 0)
GlobalOptions.err.println("updating "+lvo);
lvo.updateType();
@ -365,10 +365,10 @@ public class LocalInfo implements Declarable {
public boolean isConstant() {
LocalInfo li = getLocalInfo();
Enumeration enum = li.operators.elements();
Enumeration enumeration = li.operators.elements();
int writes = 0;
while (enum.hasMoreElements()) {
if (((LocalVarOperator) enum.nextElement()).isWrite())
while (enumeration.hasMoreElements()) {
if (((LocalVarOperator) enumeration.nextElement()).isWrite())
writes++;
}
if (writes > 1)
@ -382,10 +382,10 @@ public class LocalInfo implements Declarable {
public boolean markFinal() {
LocalInfo li = getLocalInfo();
Enumeration enum = li.operators.elements();
Enumeration enumeration = li.operators.elements();
int writes = 0;
while (enum.hasMoreElements()) {
if (((LocalVarOperator) enum.nextElement()).isWrite())
while (enumeration.hasMoreElements()) {
if (((LocalVarOperator) enumeration.nextElement()).isWrite())
writes++;
}
/* FIXME: Check if declaring final is okay */

@ -388,10 +388,10 @@ public class Main extends Options {
*/
ClassPath zipClassPath
= new ClassPath(params[i], classPath);
Enumeration enum = new ZipFile(params[i]).entries();
while (enum.hasMoreElements()) {
Enumeration enumeration = new ZipFile(params[i]).entries();
while (enumeration.hasMoreElements()) {
String entry
= ((ZipEntry) enum.nextElement()).getName();
= ((ZipEntry) enumeration.nextElement()).getName();
if (entry.endsWith(".class")) {
entry = entry.substring(0, entry.length() - 6)
.replace('/', '.');

@ -633,9 +633,9 @@ public class MethodAnalyzer implements Scope, ClassDeclarer {
*/
public void makeDeclaration(Set done) {
if (innerAnalyzers != null) {
for (Enumeration enum = innerAnalyzers.elements();
enum.hasMoreElements(); ) {
ClassAnalyzer classAna = (ClassAnalyzer) enum.nextElement();
for (Enumeration enumeration = innerAnalyzers.elements();
enumeration.hasMoreElements(); ) {
ClassAnalyzer classAna = (ClassAnalyzer) enumeration.nextElement();
if (classAna.getParent() == this) {
OuterValues innerOV = classAna.getOuterValues();
for (int i=0; i < innerOV.getCount(); i++) {
@ -651,9 +651,9 @@ public class MethodAnalyzer implements Scope, ClassDeclarer {
}
}
for (Enumeration enum = allLocals.elements();
enum.hasMoreElements(); ) {
LocalInfo li = (LocalInfo)enum.nextElement();
for (Enumeration enumeration = allLocals.elements();
enumeration.hasMoreElements(); ) {
LocalInfo li = (LocalInfo)enumeration.nextElement();
if (!li.isShadow())
imports.useType(li.getType());
}
@ -915,9 +915,9 @@ public class MethodAnalyzer implements Scope, ClassDeclarer {
* exists.
*/
public LocalInfo findLocal(String name) {
Enumeration enum = allLocals.elements();
while (enum.hasMoreElements()) {
LocalInfo li = (LocalInfo) enum.nextElement();
Enumeration enumeration = allLocals.elements();
while (enumeration.hasMoreElements()) {
LocalInfo li = (LocalInfo) enumeration.nextElement();
if (li.getName().equals(name))
return li;
}
@ -932,9 +932,9 @@ public class MethodAnalyzer implements Scope, ClassDeclarer {
*/
public ClassAnalyzer findAnonClass(String name) {
if (innerAnalyzers != null) {
Enumeration enum = innerAnalyzers.elements();
while (enum.hasMoreElements()) {
ClassAnalyzer classAna = (ClassAnalyzer) enum.nextElement();
Enumeration enumeration = innerAnalyzers.elements();
while (enumeration.hasMoreElements()) {
ClassAnalyzer classAna = (ClassAnalyzer) enumeration.nextElement();
if (classAna.getParent() == this
&& classAna.getName() != null
&& classAna.getName().equals(name)) {
@ -1089,9 +1089,9 @@ public class MethodAnalyzer implements Scope, ClassDeclarer {
*/
public ClassAnalyzer getClassAnalyzer(ClassInfo cinfo) {
if (innerAnalyzers != null) {
Enumeration enum = innerAnalyzers.elements();
while (enum.hasMoreElements()) {
ClassAnalyzer classAna = (ClassAnalyzer) enum.nextElement();
Enumeration enumeration = innerAnalyzers.elements();
while (enumeration.hasMoreElements()) {
ClassAnalyzer classAna = (ClassAnalyzer) enumeration.nextElement();
if (classAna.getClazz().equals(cinfo)) {
if (classAna.getParent() != this) {
ClassDeclarer declarer = classAna.getParent();
@ -1124,9 +1124,9 @@ public class MethodAnalyzer implements Scope, ClassDeclarer {
if (usedAnalyzers != null)
used.addAll(usedAnalyzers);
if (innerAnalyzers != null) {
Enumeration enum = innerAnalyzers.elements();
while (enum.hasMoreElements()) {
ClassAnalyzer classAna = (ClassAnalyzer) enum.nextElement();
Enumeration enumeration = innerAnalyzers.elements();
while (enumeration.hasMoreElements()) {
ClassAnalyzer classAna = (ClassAnalyzer) enumeration.nextElement();
if (classAna.getParent() == this)
classAna.fillDeclarables(used);
}

@ -363,9 +363,9 @@ public class OuterValues
}
if (ovListeners != null) {
for (Enumeration enum = ovListeners.elements();
enum.hasMoreElements();)
((OuterValueListener) enum.nextElement()
for (Enumeration enumeration = ovListeners.elements();
enumeration.hasMoreElements();)
((OuterValueListener) enumeration.nextElement()
).shrinkingOuterValues(this, newHeadCount);
}
}

@ -152,16 +152,16 @@ public class TabbedPrintWriter {
String parens = "{\010{}\010}<\010<>\010>[\010[]\010]`\010`'\010'"
.substring(options*6, options*6+6);
pw.print(parens.substring(0,3));
Enumeration enum = childBPs.elements();
Enumeration enumeration = childBPs.elements();
int cur = startPos;
BreakPoint child = (BreakPoint) enum.nextElement();
BreakPoint child = (BreakPoint) enumeration.nextElement();
if (child.startPos >= 0) {
pw.print(line.substring(cur, child.startPos));
child.dumpRegion(line);
cur = child.endPos;
}
while (enum.hasMoreElements()) {
child = (BreakPoint) enum.nextElement();
while (enumeration.hasMoreElements()) {
child = (BreakPoint) enumeration.nextElement();
pw.print(line.substring(cur, child.breakPos));
pw.print("!\010!"+breakPenalty);
cur = child.breakPos;
@ -191,9 +191,9 @@ public class TabbedPrintWriter {
indent++;
}
Enumeration enum = childBPs.elements();
Enumeration enumeration = childBPs.elements();
int cur = startPos;
BreakPoint child = (BreakPoint) enum.nextElement();
BreakPoint child = (BreakPoint) enumeration.nextElement();
if (child.startPos >= 0) {
pw.print(line.substring(cur, child.startPos));
child.printRegion(indent + child.startPos - cur, line);
@ -202,8 +202,8 @@ public class TabbedPrintWriter {
if (options == NO_PAREN)
indent += indentsize;
String indentStr = makeIndentStr(indent);
while (enum.hasMoreElements()) {
child = (BreakPoint) enum.nextElement();
while (enumeration.hasMoreElements()) {
child = (BreakPoint) enumeration.nextElement();
pw.print(line.substring(cur, child.breakPos));
pw.println();
pw.print(indentStr);
@ -311,14 +311,14 @@ public class TabbedPrintWriter {
lastSpace -= 2;
}
Enumeration enum = childBPs.elements();
Enumeration enumeration = childBPs.elements();
childBPs = new Vector();
int currInd = 0;
BreakPoint lastChild, nextChild;
boolean indentNext = options == NO_PAREN;
for (lastChild = (BreakPoint) enum.nextElement();
enum.hasMoreElements(); lastChild = nextChild) {
nextChild = (BreakPoint) enum.nextElement();
for (lastChild = (BreakPoint) enumeration.nextElement();
enumeration.hasMoreElements(); lastChild = nextChild) {
nextChild = (BreakPoint) enumeration.nextElement();
int childStart = lastChild.breakPos;
int childEnd = nextChild.breakPos;
@ -384,12 +384,12 @@ public class TabbedPrintWriter {
}
if (space < 0)
return minPenalty;
Enumeration enum = childBPs.elements();
Enumeration enumeration = childBPs.elements();
BreakPoint lastChild, nextChild;
boolean indentNext = options == NO_PAREN;
for (lastChild = (BreakPoint) enum.nextElement();
enum.hasMoreElements(); lastChild = nextChild) {
nextChild = (BreakPoint) enum.nextElement();
for (lastChild = (BreakPoint) enumeration.nextElement();
enumeration.hasMoreElements(); lastChild = nextChild) {
nextChild = (BreakPoint) enumeration.nextElement();
int childStart = lastChild.breakPos;
int childEnd = nextChild.breakPos;

@ -80,10 +80,10 @@ public class PackageIdentifier extends Identifier {
(fullName.length() > 0) ? fullName + "." : "";
// Load all classes and packages now, so they don't get stripped
Enumeration enum =
Enumeration enumeration =
bundle.getClassPath().listClassesAndPackages(getFullName());
while (enum.hasMoreElements()) {
String subclazz = ((String)enum.nextElement()).intern();
while (enumeration.hasMoreElements()) {
String subclazz = ((String)enumeration.nextElement()).intern();
if (loadedClasses.containsKey(subclazz))
continue;
String subFull = (fullNamePrefix + subclazz).intern();
@ -163,10 +163,10 @@ public class PackageIdentifier extends Identifier {
String fullNamePrefix =
(fullName.length() > 0) ? fullName + "." : "";
/* Load all matching classes and packages */
Enumeration enum =
Enumeration enumeration =
bundle.getClassPath().listClassesAndPackages(getFullName());
while (enum.hasMoreElements()) {
String subclazz = ((String)enum.nextElement()).intern();
while (enumeration.hasMoreElements()) {
String subclazz = ((String)enumeration.nextElement()).intern();
if (loadedClasses.containsKey(subclazz))
continue;
String subFull = (fullNamePrefix + subclazz).intern();

@ -424,9 +424,9 @@ public class LocalOptimizer implements Opcodes, CodeTransformer {
if (v2 == null || v2.isEmpty())
return v1;
Vector result = (Vector) v1.clone();
Enumeration enum = v2.elements();
while (enum.hasMoreElements()) {
Object elem = enum.nextElement();
Enumeration enumeration = v2.elements();
while (enumeration.hasMoreElements()) {
Object elem = enumeration.nextElement();
if (!result.contains(elem))
result.addElement(elem);
}
@ -594,9 +594,9 @@ public class LocalOptimizer implements Opcodes, CodeTransformer {
/* Find the local with the least conflicts. */
int min = Integer.MAX_VALUE;
LocalInfo bestLocal = null;
Enumeration enum = locals.elements();
while (enum.hasMoreElements()) {
LocalInfo li = (LocalInfo) enum.nextElement();
Enumeration enumeration = locals.elements();
while (enumeration.hasMoreElements()) {
LocalInfo li = (LocalInfo) enumeration.nextElement();
int conflicts = 0;
Enumeration conflenum = li.conflictingLocals.elements();
while (conflenum.hasMoreElements()) {
@ -741,9 +741,9 @@ public class LocalOptimizer implements Opcodes, CodeTransformer {
if (info.local != null && !locals.contains(info.local))
locals.addElement(info.local);
}
// Enumeration enum = locals.elements();
// while (enum.hasMoreElements()) {
// LocalInfo li = (LocalInfo) enum.nextElement();
// Enumeration enumeration = locals.elements();
// while (enumeration.hasMoreElements()) {
// LocalInfo li = (LocalInfo) enumeration.nextElement();
// int slot = ((InstrInfo)li.usingInstrs.elementAt(0))
// .instr.getLocalSlot();
// GlobalOptions.err.print("Slot: "+slot+" conflicts:");

@ -128,10 +128,10 @@ public class HierarchyTreeModel implements TreeModel, Runnable {
if (depth++ >= MAX_PACKAGE_LEVEL)
return count;
String prefix = packageName.length() == 0 ? "" : packageName + ".";
Enumeration enum = classPath.listClassesAndPackages(packageName);
while (enum.hasMoreElements()) {
Enumeration enumeration = classPath.listClassesAndPackages(packageName);
while (enumeration.hasMoreElements()) {
//insert sorted and remove double elements;
String name = (String)enum.nextElement();
String name = (String)enumeration.nextElement();
String fqn = prefix + name;
if (classPath.isPackage(fqn)) {
count = readPackage(depth, classes, fqn, count);
@ -153,10 +153,10 @@ public class HierarchyTreeModel implements TreeModel, Runnable {
return 0;
int number = 0;
String prefix = packageName.length() == 0 ? "" : packageName + ".";
Enumeration enum = classPath.listClassesAndPackages(packageName);
while (enum.hasMoreElements()) {
Enumeration enumeration = classPath.listClassesAndPackages(packageName);
while (enumeration.hasMoreElements()) {
//insert sorted and remove double elements;
String name = (String)enum.nextElement();
String name = (String)enumeration.nextElement();
String fqn = prefix + name;
if (classPath.isPackage(fqn)) {
number += countClasses(depth, fqn);

@ -122,11 +122,11 @@ public class PackagesTreeModel implements TreeModel {
if (result == null) {
TreeSet v = new TreeSet();
String prefix = parent == root ? "" : parent.getFullName() + ".";
Enumeration enum
Enumeration enumeration
= classPath.listClassesAndPackages(parent.getFullName());
while (enum.hasMoreElements()) {
while (enumeration.hasMoreElements()) {
//insert sorted and remove double elements;
String name = (String)enum.nextElement();
String name = (String)enumeration.nextElement();
String fqn = prefix + name;
boolean isClass = !classPath.isPackage(fqn);

@ -85,9 +85,9 @@ public abstract class ReferenceType extends Type {
/* tObject is always implied. */
continue type_loop;
for (Enumeration enum = classes.elements();
enum.hasMoreElements(); ) {
if (type.isSubTypeOf((Type) enum.nextElement()))
for (Enumeration enumeration = classes.elements();
enumeration.hasMoreElements(); ) {
if (type.isSubTypeOf((Type) enumeration.nextElement()))
/* We can skip this, as another class already
* implies it. */
continue type_loop;

Loading…
Cancel
Save