From a9e2d0fdaadd0d0d15deeaebee3f1013fd70c2b2 Mon Sep 17 00:00:00 2001 From: hoenicke Date: Thu, 9 Nov 2006 19:06:20 +0000 Subject: [PATCH] Fixed compile problems, but still not working git-svn-id: https://svn.code.sf.net/p/jode/code/branches/generics@1400 379699f6-c40d-0410-875b-85095c16579e --- jode/doc/jode-2.png | Bin 0 -> 7540 bytes .../sf/jode/bytecode/BasicBlockReader.java | 32 +++--- .../sf/jode/bytecode/BasicBlockWriter.java | 15 ++- .../src/net/sf/jode/bytecode/BasicBlocks.java | 6 -- jode/src/net/sf/jode/bytecode/Block.java | 6 -- .../jode/bytecode/ClassFormatException.java | 2 +- jode/src/net/sf/jode/bytecode/ClassInfo.java | 2 - jode/src/net/sf/jode/bytecode/ClassPath.java | 3 - .../sf/jode/bytecode/SwitchInstruction.java | 1 - .../net/sf/jode/bytecode/TypeSignature.java | 44 +++++++- jode/src/net/sf/jode/decompiler/Applet.java | 3 +- .../net/sf/jode/decompiler/ClassAnalyzer.java | 29 +++-- .../net/sf/jode/decompiler/Decompiler.java | 1 - .../net/sf/jode/decompiler/FieldAnalyzer.java | 4 +- jode/src/net/sf/jode/swingui/Main.java | 30 +++--- jode/src/net/sf/jode/type/ArrayType.java | 4 +- jode/src/net/sf/jode/type/ClassInfoType.java | 17 +-- jode/src/net/sf/jode/type/ClassType.java | 23 ++-- jode/src/net/sf/jode/type/MultiClassType.java | 4 +- jode/src/net/sf/jode/type/NullType.java | 4 +- jode/src/net/sf/jode/type/RangeType.java | 84 +++++++-------- jode/src/net/sf/jode/type/Type.java | 2 +- jode/test/CountOpcodes.java | 99 ------------------ jode/test/InlineTest.java | 4 +- jode/test/ResolveConflicts.java | 2 +- jode/test/innerclasses/CheckSuperRemove.java | 9 +- 26 files changed, 179 insertions(+), 251 deletions(-) create mode 100644 jode/doc/jode-2.png delete mode 100644 jode/test/CountOpcodes.java diff --git a/jode/doc/jode-2.png b/jode/doc/jode-2.png new file mode 100644 index 0000000000000000000000000000000000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iu(E^GH9u~&AwarZ4If=v1Mgc0~t38F@bDX~<0+T+z;{`%5)Ye3L(g82eB$wDh z>~?N&lTlhUbuV~Z0V|w>wm_$94S$uql)}nh(8F@?>t@uonnha>i?*?bfEY;=lsvAX ztnnk3_fKGQHVcGjFkz5^y>Jb{C9e?=?YRckG2Gb%uF-SO$1ti5r#%v49e-&b*q$F6 z0baEQT~>oGIVex5BN@xMZi+v4=TDA4zlZqy75S^mUD5W4Ip&^N0q1-Cv{j6K&YrE- zg<)Fgs2|o|-k<;#1>JVzjs`;g{rxHLo12@}kxq{1a68tGth@cy-2^oM|Ho4kLyOxr I`pCHd0Z~R*ApigX literal 0 HcmV?d00001 diff --git a/jode/src/net/sf/jode/bytecode/BasicBlockReader.java b/jode/src/net/sf/jode/bytecode/BasicBlockReader.java index 43878c8..79f95e6 100644 --- a/jode/src/net/sf/jode/bytecode/BasicBlockReader.java +++ b/jode/src/net/sf/jode/bytecode/BasicBlockReader.java @@ -25,9 +25,6 @@ import java.io.IOException; import java.util.Stack; import java.util.Vector; import java.util.Enumeration; -///#def COLLECTIONS java.util -import java.util.Arrays; -///#enddef /** * This is a helper class, that contains the method to read in basic @@ -66,11 +63,6 @@ class BasicBlockReader implements Opcodes { String name, type; } - private class LNTEntry { - int lineNr; - int start; - } - InstrInfo[] infos; HandlerEntry[] handlers; BasicBlocks bb; @@ -546,8 +538,10 @@ class BasicBlockReader implements Opcodes { case opc_ldc: { int index = input.readUnsignedByte(); int tag = cp.getTag(index); - if (tag != cp.STRING && tag != cp.CLASS - && tag != cp.INTEGER && tag != cp.FLOAT) + if (tag != ConstantPool.STRING + && tag != ConstantPool.CLASS + && tag != ConstantPool.INTEGER + && tag != ConstantPool.FLOAT) throw new ClassFormatException ("wrong constant tag: "+tag); instr = new ConstantInstruction @@ -558,8 +552,10 @@ class BasicBlockReader implements Opcodes { case opc_ldc_w: { int index = input.readUnsignedShort(); int tag = cp.getTag(index); - if (tag != cp.STRING && tag != cp.CLASS - && tag != cp.INTEGER && tag != cp.FLOAT) + if (tag != ConstantPool.STRING + && tag != ConstantPool.CLASS + && tag != ConstantPool.INTEGER + && tag != ConstantPool.FLOAT) throw new ClassFormatException ("wrong constant tag: "+tag); instr = new ConstantInstruction @@ -570,7 +566,7 @@ class BasicBlockReader implements Opcodes { case opc_ldc2_w: { int index = input.readUnsignedShort(); int tag = cp.getTag(index); - if (tag != cp.LONG && tag != cp.DOUBLE) + if (tag != ConstantPool.LONG && tag != ConstantPool.DOUBLE) throw new ClassFormatException ("wrong constant tag: "+tag); instr = new ConstantInstruction @@ -680,11 +676,11 @@ class BasicBlockReader implements Opcodes { int index = input.readUnsignedShort(); int tag = cp.getTag(index); if (opcode < opc_invokevirtual) { - if (tag != cp.FIELDREF) + if (tag != ConstantPool.FIELDREF) throw new ClassFormatException ("field tag mismatch: "+tag); } else { - if (tag != cp.METHODREF) + if (tag != ConstantPool.METHODREF) throw new ClassFormatException ("method tag mismatch: "+tag); } @@ -704,7 +700,7 @@ class BasicBlockReader implements Opcodes { case opc_invokeinterface: { int index = input.readUnsignedShort(); int tag = cp.getTag(index); - if (tag != cp.INTERFACEMETHODREF) + if (tag != ConstantPool.INTERFACEMETHODREF) throw new ClassFormatException ("interface tag mismatch: "+tag); Reference ref = cp.getRef(index); @@ -966,8 +962,8 @@ class BasicBlockReader implements Opcodes { int nameIndex = input.readUnsignedShort(); int typeIndex = input.readUnsignedShort(); int slot = input.readUnsignedShort(); - if (nameIndex == 0 || cp.getTag(nameIndex) != cp.UTF8 - || typeIndex == 0 || cp.getTag(typeIndex) != cp.UTF8 + if (nameIndex == 0 || cp.getTag(nameIndex) != ConstantPool.UTF8 + || typeIndex == 0 || cp.getTag(typeIndex) != ConstantPool.UTF8 || slot >= maxLocals) { // This is probably an evil lvt as created by HashJava diff --git a/jode/src/net/sf/jode/bytecode/BasicBlockWriter.java b/jode/src/net/sf/jode/bytecode/BasicBlockWriter.java index 08de109..5fc6875 100644 --- a/jode/src/net/sf/jode/bytecode/BasicBlockWriter.java +++ b/jode/src/net/sf/jode/bytecode/BasicBlockWriter.java @@ -25,8 +25,6 @@ import java.util.BitSet; import java.util.Stack; ///#def COLLECTIONS java.util import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; ///#enddef /** @@ -382,17 +380,18 @@ class BasicBlockWriter implements Opcodes { case opc_getfield: case opc_putstatic: case opc_putfield: - gcp.putRef(gcp.FIELDREF, instr.getReference()); + gcp.putRef(ConstantPool.FIELDREF, instr.getReference()); length = 3; break; case opc_invokespecial: case opc_invokestatic: case opc_invokevirtual: - gcp.putRef(gcp.METHODREF, instr.getReference()); + gcp.putRef(ConstantPool.METHODREF, instr.getReference()); length = 3; break; case opc_invokeinterface: - gcp.putRef(gcp.INTERFACEMETHODREF, instr.getReference()); + gcp.putRef(ConstantPool.INTERFACEMETHODREF, + instr.getReference()); length = 5; break; case opc_new: @@ -880,7 +879,7 @@ class BasicBlockWriter implements Opcodes { case opc_putstatic: case opc_putfield: output.writeByte(opcode); - output.writeShort(gcp.putRef(gcp.FIELDREF, + output.writeShort(gcp.putRef(ConstantPool.FIELDREF, instr.getReference())); break; @@ -892,13 +891,13 @@ class BasicBlockWriter implements Opcodes { output.writeByte(opcode); if (opcode == opc_invokeinterface) { output.writeShort - (gcp.putRef(gcp.INTERFACEMETHODREF, ref)); + (gcp.putRef(ConstantPool.INTERFACEMETHODREF, ref)); output.writeByte (TypeSignature .getParameterSize(ref.getType()) + 1); output.writeByte(0); } else - output.writeShort(gcp.putRef(gcp.METHODREF, ref)); + output.writeShort(gcp.putRef(ConstantPool.METHODREF, ref)); break; } case opc_new: diff --git a/jode/src/net/sf/jode/bytecode/BasicBlocks.java b/jode/src/net/sf/jode/bytecode/BasicBlocks.java index dddb1ae..833fd6d 100644 --- a/jode/src/net/sf/jode/bytecode/BasicBlocks.java +++ b/jode/src/net/sf/jode/bytecode/BasicBlocks.java @@ -32,10 +32,6 @@ import java.util.Stack; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; -import java.util.NoSuchElementException; -///#enddef -///#def COLLECTIONEXTRA java.lang -import java.lang.UnsupportedOperationException; ///#enddef /** @@ -187,8 +183,6 @@ public class BasicBlocks extends BinaryInfo implements Opcodes { BitSet visited = new BitSet(); Stack todo = new Stack(); - int[] poppush = new int[2]; - startBlock.stackHeight = 0; todo.push(startBlock); while (!todo.isEmpty()) { diff --git a/jode/src/net/sf/jode/bytecode/Block.java b/jode/src/net/sf/jode/bytecode/Block.java index 8ad9426..dcf6aeb 100644 --- a/jode/src/net/sf/jode/bytecode/Block.java +++ b/jode/src/net/sf/jode/bytecode/Block.java @@ -20,12 +20,6 @@ package net.sf.jode.bytecode; import java.io.PrintWriter; -///#def COLLECTIONS java.util -import java.util.Collection; -import java.util.Arrays; -import java.util.List; -import java.util.Iterator; -///#enddef /** *

Represents a single basic block. It contains a list of diff --git a/jode/src/net/sf/jode/bytecode/ClassFormatException.java b/jode/src/net/sf/jode/bytecode/ClassFormatException.java index 8b1d5ef..151431f 100644 --- a/jode/src/net/sf/jode/bytecode/ClassFormatException.java +++ b/jode/src/net/sf/jode/bytecode/ClassFormatException.java @@ -24,7 +24,7 @@ package net.sf.jode.bytecode; * * @author Jochen Hoenicke */ -public class ClassFormatException extends java.io.IOException{ +public class ClassFormatException extends java.io.IOException { /** * Constructs a new class format exception with the given detail * message. diff --git a/jode/src/net/sf/jode/bytecode/ClassInfo.java b/jode/src/net/sf/jode/bytecode/ClassInfo.java index b3e802f..f36ed38 100644 --- a/jode/src/net/sf/jode/bytecode/ClassInfo.java +++ b/jode/src/net/sf/jode/bytecode/ClassInfo.java @@ -19,10 +19,8 @@ package net.sf.jode.bytecode; import net.sf.jode.GlobalOptions; -import net.sf.jode.util.UnifyHash; import java.io.DataInputStream; -import java.io.BufferedInputStream; import java.io.DataOutputStream; import java.io.OutputStream; import java.io.IOException; diff --git a/jode/src/net/sf/jode/bytecode/ClassPath.java b/jode/src/net/sf/jode/bytecode/ClassPath.java index cd37b56..78ab323 100644 --- a/jode/src/net/sf/jode/bytecode/ClassPath.java +++ b/jode/src/net/sf/jode/bytecode/ClassPath.java @@ -25,7 +25,6 @@ import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; -import java.io.FilterInputStream; import java.io.IOException; import java.io.InputStream; @@ -36,7 +35,6 @@ import java.net.URLConnection; import java.util.Enumeration; import java.util.NoSuchElementException; import java.util.Hashtable; -import java.util.StringTokenizer; import java.util.Vector; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; @@ -288,7 +286,6 @@ public class ClassPath { if (!directory.endsWith(File.separator)) directory += File.separator; - final String prefix = directory; return new Enumeration() { int i = 0; public boolean hasMoreElements() { diff --git a/jode/src/net/sf/jode/bytecode/SwitchInstruction.java b/jode/src/net/sf/jode/bytecode/SwitchInstruction.java index 66a29af..5219865 100644 --- a/jode/src/net/sf/jode/bytecode/SwitchInstruction.java +++ b/jode/src/net/sf/jode/bytecode/SwitchInstruction.java @@ -18,7 +18,6 @@ */ package net.sf.jode.bytecode; -import net.sf.jode.util.StringQuoter; /** * This class represents an instruction in the byte code. diff --git a/jode/src/net/sf/jode/bytecode/TypeSignature.java b/jode/src/net/sf/jode/bytecode/TypeSignature.java index 4307513..0bd9322 100644 --- a/jode/src/net/sf/jode/bytecode/TypeSignature.java +++ b/jode/src/net/sf/jode/bytecode/TypeSignature.java @@ -18,7 +18,6 @@ */ package net.sf.jode.bytecode; -import net.sf.jode.util.UnifyHash; ///#def COLLECTIONS java.util import java.util.Map; ///#enddef @@ -344,6 +343,49 @@ public class TypeSignature { return methodTypeSig.substring(methodTypeSig.lastIndexOf(')')+1); } + /** + * Gets the names and types of the generic parameters of the given type signature. + * @param typeSig the type signature. + * @return an array containing all generic parameters together with their + * type in correct order, or null if there aren't any generic parameters. + */ + public static String[] getGenericSignatures(String typeSig) { + System.err.println(typeSig); + if (typeSig.charAt(0) != '<') + return null; + int pos = 1; + int count = 0; + while (typeSig.charAt(pos) != '>') { + while (typeSig.charAt(pos) != ':') + pos++; + /* check for empty entry */ + if (typeSig.charAt(pos+1) == ':') + pos++; + while (typeSig.charAt(pos) == ':') { + /* skip colon and type */ + pos = skipType(typeSig, pos + 1); + } + count++; + } + String[] params = new String[count]; + pos = 1; + count = 0; + while (typeSig.charAt(pos) != '>') { + int spos = pos; + while (typeSig.charAt(pos) != ':') + pos++; + /* check for empty entry */ + if (typeSig.charAt(pos+1) == ':') + pos++; + while (typeSig.charAt(pos) == ':') { + /* skip colon and type */ + pos = skipType(typeSig, pos + 1); + } + params[count++] = typeSig.substring(spos, pos); + } + return params; + } + /** * Gets the names of the generic parameters of the given type signature. * @param typeSig the type signature. diff --git a/jode/src/net/sf/jode/decompiler/Applet.java b/jode/src/net/sf/jode/decompiler/Applet.java index a4bf299..b792e27 100644 --- a/jode/src/net/sf/jode/decompiler/Applet.java +++ b/jode/src/net/sf/jode/decompiler/Applet.java @@ -24,7 +24,8 @@ import java.awt.Graphics; import java.awt.Insets; public class Applet extends java.applet.Applet { - private final int BORDER = 10; + private static final long serialVersionUID = -132941289170424862L; + private final int BORDER = 10; private final int BEVEL = 2; private Window jodeWin = new Window(this); private Insets myInsets; diff --git a/jode/src/net/sf/jode/decompiler/ClassAnalyzer.java b/jode/src/net/sf/jode/decompiler/ClassAnalyzer.java index e380b51..82469e7 100644 --- a/jode/src/net/sf/jode/decompiler/ClassAnalyzer.java +++ b/jode/src/net/sf/jode/decompiler/ClassAnalyzer.java @@ -21,11 +21,14 @@ package net.sf.jode.decompiler; import net.sf.jode.GlobalOptions; import net.sf.jode.type.MethodType; import net.sf.jode.type.Type; +import net.sf.jode.type.GenericParameterType; +import net.sf.jode.type.ClassType; import net.sf.jode.bytecode.ClassFormatException; import net.sf.jode.bytecode.ClassInfo; import net.sf.jode.bytecode.ClassPath; import net.sf.jode.bytecode.FieldInfo; import net.sf.jode.bytecode.MethodInfo; +import net.sf.jode.bytecode.TypeSignature; import net.sf.jode.expr.Expression; import net.sf.jode.expr.ThisOperator; import net.sf.jode.flow.TransformConstructors; @@ -33,6 +36,8 @@ import net.sf.jode.flow.StructuredBlock; import net.sf.jode.util.SimpleSet; import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.List; import java.util.NoSuchElementException; import java.util.Vector; import java.util.Enumeration; @@ -96,27 +101,29 @@ public class ClassAnalyzer throws ClassFormatException, IOException { clazz.load(ClassInfo.ALL); - String signatures = clazz.getSignature(); - if (signatures.charAt(0) == '<') { - String[] genericSignatures = signature.getGenericNames(); + String signature = clazz.getSignature(); + if (signature.charAt(0) == '<') { + String[] genericSignatures = TypeSignature.getGenericSignatures(signature); generics = new String[genericSignatures.length]; + genericTypes = new Type[genericSignatures.length]; for (int i = 0; i < generics.length; i++) { - int colon = genericSignatures[i].charAt(':'); + int colon = genericSignatures[i].indexOf(':'); String genName; if (colon == -1) { generics[i] = genericSignatures[i]; - genericType[i] = + genericTypes[i] = new GenericParameterType(genericSignatures[i], Type.tObject, new ClassType[0]); } else { generics[i] = genericSignatures[i].substring(0, colon); String remainder = genericSignatures[i].substring(colon+1); - int nextIndex = remainder.skipType(remainder, 0); - List superClazzes; + int nextIndex = TypeSignature.skipType(remainder, 0); + List superClazzes = new ArrayList(); for (;;) { String clazzSig = remainder.substring(0, nextIndex); - superClazzes.add(Type.tType(clazzSig)); + superClazzes.add(Type.tType(clazz.getClassPath(), + clazzSig)); if (nextIndex >= remainder.length()) break; remainder = remainder.substring(nextIndex+1); @@ -128,9 +135,9 @@ public class ClassAnalyzer genSupClass = Type.tObject; ClassType[] genSupIfaces = (ClassType[]) superClazzes.toArray(new ClassType[0]); - genericType[i] = new GenericParameterType(generics[i], - genSupClass, - genSupIfaces); + genericTypes[i] = new GenericParameterType(generics[i], + genSupClass, + genSupIfaces); } } } diff --git a/jode/src/net/sf/jode/decompiler/Decompiler.java b/jode/src/net/sf/jode/decompiler/Decompiler.java index 3608c73..def0661 100644 --- a/jode/src/net/sf/jode/decompiler/Decompiler.java +++ b/jode/src/net/sf/jode/decompiler/Decompiler.java @@ -24,7 +24,6 @@ import net.sf.jode.bytecode.ClassInfo; import java.io.File; import java.io.PrintWriter; import java.io.Writer; -import java.io.BufferedWriter; /** * This is the interface that other java classes may use to decompile diff --git a/jode/src/net/sf/jode/decompiler/FieldAnalyzer.java b/jode/src/net/sf/jode/decompiler/FieldAnalyzer.java index d637e49..8077173 100644 --- a/jode/src/net/sf/jode/decompiler/FieldAnalyzer.java +++ b/jode/src/net/sf/jode/decompiler/FieldAnalyzer.java @@ -183,7 +183,7 @@ public class FieldAnalyzer implements Analyzer { | Modifier.STATIC | Modifier.FINAL); */ - writer.startOp(writer.NO_PAREN, 0); + writer.startOp(TabbedPrintWriter.NO_PAREN, 0); String modif = Modifier.toString(modifiedModifiers); if (modif.length() > 0) writer.print(modif+" "); @@ -193,7 +193,7 @@ public class FieldAnalyzer implements Analyzer { if (constant != null) { writer.breakOp(); writer.print(" = "); - constant.dumpExpression(writer.IMPL_PAREN, writer); + constant.dumpExpression(TabbedPrintWriter.IMPL_PAREN, writer); } writer.endOp(); writer.println(";"); diff --git a/jode/src/net/sf/jode/swingui/Main.java b/jode/src/net/sf/jode/swingui/Main.java index c1e2984..6d76f0a 100644 --- a/jode/src/net/sf/jode/swingui/Main.java +++ b/jode/src/net/sf/jode/swingui/Main.java @@ -32,8 +32,6 @@ import javax.swing.tree.*; import java.awt.*; import java.awt.event.*; import java.io.*; -import java.util.StringTokenizer; -import java.util.ResourceBundle; import java.util.*; public class Main @@ -147,8 +145,9 @@ public class Main rightPane.setDividerSize(4); allPane.setDividerLocation(200); allPane.setDividerSize(4); - decompiler.setErr(new PrintWriter - (new BufferedWriter(new AreaWriter(errorArea)), true)); + decompiler.setErr(new PrintWriter(System.err)); + //new PrintWriter + // (new BufferedWriter(new AreaWriter(errorArea)), true)); } public synchronized void valueChanged(TreeSelectionEvent e) { @@ -250,16 +249,19 @@ public class Main }; try { decompiler.decompile(lastClassName, writer, progListener); - } catch (Throwable t) { - try { - writer.write(bundle.getString("main.exception")); - PrintWriter pw = new PrintWriter(writer); - t.printStackTrace(pw); - pw.flush(); - } catch (IOException ex) { - /* Shouldn't happen, complain to stderr */ - ex.printStackTrace(); - } +// } catch (Throwable t) { +// try { +// writer.write(bundle.getString("main.exception")); +// PrintWriter pw = new PrintWriter(writer); +// t.printStackTrace(pw); +// pw.flush(); +// } catch (IOException ex) { +// /* Shouldn't happen, complain to stderr */ +// ex.printStackTrace(); +// } + } catch (IOException e) { + // TODO Auto-generated catch block + throw (RuntimeException) new RuntimeException().initCause(e); } finally { try { writer.close(); diff --git a/jode/src/net/sf/jode/type/ArrayType.java b/jode/src/net/sf/jode/type/ArrayType.java index a825164..1324700 100644 --- a/jode/src/net/sf/jode/type/ArrayType.java +++ b/jode/src/net/sf/jode/type/ArrayType.java @@ -124,7 +124,7 @@ public class ArrayType extends ClassType { * tArray(x), other -> tError */ if (type.getTypeCode() == TC_RANGE) { - type = ((RangeType) type).getBottom(); + type = ((RangeType) type).getTop(); } if (type == tNull) return this; @@ -150,7 +150,7 @@ public class ArrayType extends ClassType { * tArray(x), other -> tError */ if (type.getTypeCode() == TC_RANGE) { - type = ((RangeType) type).getTop(); + type = ((RangeType) type).getBottom(); } if (type == tNull) return this; diff --git a/jode/src/net/sf/jode/type/ClassInfoType.java b/jode/src/net/sf/jode/type/ClassInfoType.java index 6b44337..c3a261e 100644 --- a/jode/src/net/sf/jode/type/ClassInfoType.java +++ b/jode/src/net/sf/jode/type/ClassInfoType.java @@ -20,6 +20,8 @@ package net.sf.jode.type; import net.sf.jode.bytecode.ClassInfo; import net.sf.jode.bytecode.TypeSignature; +import net.sf.jode.util.SimpleMap; +import net.sf.jode.util.SimpleSet; import net.sf.jode.GlobalOptions; import java.lang.reflect.Modifier; @@ -30,6 +32,7 @@ import java.util.Hashtable; ///#def COLLECTIONS java.util import java.util.Map; +import java.util.Set; ///#enddef /** @@ -68,22 +71,24 @@ public class ClassInfoType extends ClassType { return; } - genInstances = generics; + genericInstances = generics; + Map genericMap = new SimpleMap(); if (generics != null) { /* parse generic names */ String[] genNames; - if (signature.charAt(0) == '<') - genNames = TypeSignature.getGenericNames(signature); - - if (genNames == null) + if (signature.charAt(0) != '<') throw new IllegalArgumentException ("Generic parameters for non-generic class"); + + genNames = TypeSignature.getGenericNames(signature); if (generics.length != genNames.length) throw new IllegalArgumentException ("Wrong number of generic parameters"); + for (int i = 0; i < generics.length; i++) + genericMap.put(genNames[i], generics[i].getTypeSignature()); } - signature = TypeSignature.mapGenerics(signature, getGenerics()); + signature = TypeSignature.mapGenerics(signature, genericMap); } public boolean isUnknown() { diff --git a/jode/src/net/sf/jode/type/ClassType.java b/jode/src/net/sf/jode/type/ClassType.java index acf7cfc..0959c0c 100644 --- a/jode/src/net/sf/jode/type/ClassType.java +++ b/jode/src/net/sf/jode/type/ClassType.java @@ -18,15 +18,8 @@ */ package net.sf.jode.type; -import java.util.Stack; import java.util.Hashtable; -import java.util.Enumeration; -import java.io.IOException; - -///#def COLLECTIONS java.util -import java.util.Collections; -import java.util.Map; -///#enddef +import java.util.Stack; /** * This class is the base class of all types representing a class type.

@@ -70,7 +63,7 @@ public abstract class ClassType extends ReferenceType { super(typecode); className = clazzName; genericNames = genNames; - genericTypes = genTypes; + genericInstances = genTypes; } /** @@ -208,7 +201,7 @@ public abstract class ClassType extends ReferenceType { */ public Type getSpecializedType(Type type) { if (type instanceof RangeType) { - type = ((RangeType) type).getBottom(); + type = ((RangeType) type).getTop(); } /* Most times (almost always) one of the two classes is @@ -238,7 +231,7 @@ public abstract class ClassType extends ReferenceType { public Type getGeneralizedType(Type type) { int code = type.typecode; if (code == TC_RANGE) { - type = ((RangeType) type).getTop(); + type = ((RangeType) type).getBottom(); code = type.typecode; } if (code == TC_NULL) @@ -270,12 +263,12 @@ public abstract class ClassType extends ReferenceType { public String toString() { - if (genInstances == null) + if (genericInstances == null) return className; StringBuffer sb = new StringBuffer(className).append('<'); String comma = ""; - for (int i = 0; i < genInstances.length; i++) { - sb.append(comma).append(genInstances[i].toString()); + for (int i = 0; i < genericInstances.length; i++) { + sb.append(comma).append(genericInstances[i].toString()); } sb.append('>'); return sb.toString(); @@ -289,7 +282,7 @@ public abstract class ClassType extends ReferenceType { public Type getCastHelper(Type fromType) { if (isInterface() || fromType == tNull || (fromType instanceof RangeType - && ((RangeType)fromType).getBottom() == tNull)) + && ((RangeType)fromType).getTop() == tNull)) return null; Type hint = fromType.getHint(); if (hint.isSuperTypeOf(this) diff --git a/jode/src/net/sf/jode/type/MultiClassType.java b/jode/src/net/sf/jode/type/MultiClassType.java index db999db..74d35d0 100644 --- a/jode/src/net/sf/jode/type/MultiClassType.java +++ b/jode/src/net/sf/jode/type/MultiClassType.java @@ -154,7 +154,7 @@ public class MultiClassType extends ReferenceType { */ public Type getSpecializedType(Type type) { if (type instanceof RangeType) - type = ((RangeType) type).getBottom(); + type = ((RangeType) type).getTop(); /* Most times (almost always) one of the two types is * already more specialized. Optimize for this case. @@ -212,7 +212,7 @@ public class MultiClassType extends ReferenceType { */ public Type getGeneralizedType(Type type) { if (type instanceof RangeType) - type = ((RangeType) type).getTop(); + type = ((RangeType) type).getBottom(); /* Often one of the two classes is already more generalized. * Optimize for this case. diff --git a/jode/src/net/sf/jode/type/NullType.java b/jode/src/net/sf/jode/type/NullType.java index c52482f..a339542 100644 --- a/jode/src/net/sf/jode/type/NullType.java +++ b/jode/src/net/sf/jode/type/NullType.java @@ -55,7 +55,7 @@ public class NullType extends ReferenceType { */ public Type getGeneralizedType(Type type) { if (type.typecode == TC_RANGE) - type = ((RangeType) type).getTop(); + type = ((RangeType) type).getBottom(); if (type instanceof ReferenceType) return type; return tError; @@ -69,7 +69,7 @@ public class NullType extends ReferenceType { */ public Type getSpecializedType(Type type) { if (type.typecode == TC_RANGE) - type = ((RangeType) type).getBottom(); + type = ((RangeType) type).getTop(); if (type != tNull) return tError; return tNull; diff --git a/jode/src/net/sf/jode/type/RangeType.java b/jode/src/net/sf/jode/type/RangeType.java index 9d734e8..e41817b 100644 --- a/jode/src/net/sf/jode/type/RangeType.java +++ b/jode/src/net/sf/jode/type/RangeType.java @@ -53,25 +53,25 @@ import java.util.Hashtable; * @date 98/08/06 */ public class RangeType extends Type { /** - * The bottom type set. Each type in the set represented by + * The top type set. Each type in the set represented by * this range type can be casted to all types in bottom type. */ - final ReferenceType bottomType; + final ReferenceType topType; /** - * The top type set. For each type in this range type, there is a + * The bottom type set. For each type in this range type, there is a * top type, that can be casted to this type. */ - final ReferenceType topType; + final ReferenceType bottomType; /** * Create a new range type with the given bottom and top set. */ - RangeType(ReferenceType bottomType, ReferenceType topType) { + RangeType(ReferenceType topType, ReferenceType bottomType) { super(TC_RANGE); - if (bottomType == tNull) - throw new InternalError("bottom is NULL"); - this.bottomType = bottomType; + if (topType == tNull) + throw new InternalError("top is NULL"); this.topType = topType; + this.bottomType = bottomType; } /** @@ -79,17 +79,17 @@ public class RangeType extends Type { * be casted to all bottom types by a widening cast. * @return the bottom type set */ - ReferenceType getBottom() { - return bottomType; + ReferenceType getTop() { + return topType; } /** - * Returns the top type set. For each type in this range type, - * there is a top type, that can be casted to this type. - * @return the top type set + * Returns the bottom type set. For each type in this range type, + * there is a bottom type, that can be casted to this type. + * @return the bottom type set */ - ReferenceType getTop() { - return topType; + ReferenceType getBottom() { + return bottomType; } @@ -101,13 +101,13 @@ public class RangeType extends Type { * @return the hint type. */ public Type getHint() { - Type bottomHint = bottomType.getHint(); Type topHint = topType.getHint(); + Type bottomHint = bottomType.getHint(); - if (topType == tNull && bottomType.equals(bottomHint)) - return bottomHint; + if (bottomType == tNull && topType.equals(topHint)) + return topHint; - return topHint; + return bottomHint; } /** @@ -116,7 +116,7 @@ public class RangeType extends Type { * @return the canonic type. */ public Type getCanonic() { - return topType.getCanonic(); + return bottomType.getCanonic(); } /** @@ -125,7 +125,7 @@ public class RangeType extends Type { * @return the set of super types. */ public Type getSuperType() { - return topType.getSuperType(); + return bottomType.getSuperType(); } /** @@ -134,7 +134,7 @@ public class RangeType extends Type { * @return the set of super types. */ public Type getSubType() { - return tRange(bottomType, tNull); + return tRange(topType, tNull); } /** @@ -143,26 +143,26 @@ public class RangeType extends Type { * @return the middle type, or null if it is not necessary. */ public Type getCastHelper(Type fromType) { - return topType.getCastHelper(fromType); + return bottomType.getCastHelper(fromType); } public String getTypeSignature() { - if (topType.isClassType() || !bottomType.isValidType()) - return topType.getTypeSignature(); - else + if (bottomType.isClassType() || !topType.isValidType()) return bottomType.getTypeSignature(); + else + return topType.getTypeSignature(); } public Class getTypeClass() throws ClassNotFoundException { - if (topType.isClassType() || !bottomType.isValidType()) - return topType.getTypeClass(); - else + if (bottomType.isClassType() || !topType.isValidType()) return bottomType.getTypeClass(); + else + return topType.getTypeClass(); } public String toString() { - return "<" + bottomType + "-" + topType + ">"; + return "<" + topType + "-" + bottomType + ">"; } public String getDefaultName() { @@ -170,29 +170,29 @@ public class RangeType extends Type { } public int hashCode() { - int hashcode = topType.hashCode(); - return (hashcode << 16 | hashcode >>> 16) ^ bottomType.hashCode(); + int hashcode = bottomType.hashCode(); + return (hashcode << 16 | hashcode >>> 16) ^ topType.hashCode(); } public boolean equals(Object o) { if (o instanceof RangeType) { RangeType type = (RangeType) o; - return topType.equals(type.topType) - && bottomType.equals(type.bottomType); + return bottomType.equals(type.bottomType) + && topType.equals(type.topType); } return false; } public boolean containsClass(ClassInfo clazz) { ClassType clazzType = Type.tClass(clazz, null); - if (!bottomType.maybeSuperTypeOf(clazzType)) + if (!topType.maybeSuperTypeOf(clazzType)) return false; - if (topType == tNull) + if (bottomType == tNull) return true; - if (topType instanceof ClassType) - return clazzType.maybeSuperTypeOf((ClassType) topType); - if (topType instanceof MultiClassType) { - ClassType[] classes = ((MultiClassType) topType).classes; + if (bottomType instanceof ClassType) + return clazzType.maybeSuperTypeOf((ClassType) bottomType); + if (bottomType instanceof MultiClassType) { + ClassType[] classes = ((MultiClassType) bottomType).classes; for (int i = 0; i < classes.length; i++) { if (clazzType.maybeSuperTypeOf(classes[i])) return true; @@ -213,8 +213,8 @@ public class RangeType extends Type { return this; Type top, bottom, result; - bottom = bottomType.getSpecializedType(type); - top = topType.getGeneralizedType(type); + bottom = topType.getSpecializedType(type); + top = bottomType.getGeneralizedType(type); if (top.equals(bottom)) result = top; else if (top instanceof ReferenceType diff --git a/jode/src/net/sf/jode/type/Type.java b/jode/src/net/sf/jode/type/Type.java index cb80a72..ad0ac70 100644 --- a/jode/src/net/sf/jode/type/Type.java +++ b/jode/src/net/sf/jode/type/Type.java @@ -327,7 +327,7 @@ public class Type { while (iter.hasNext()) { ClassInfoType type = (ClassInfoType) iter.next(); if (type.getClassInfo() == clazzinfo - && Arrays.equals(generics, type.genInstances)) + && Arrays.equals(generics, type.genericInstances)) return type; } ClassInfoType type = new ClassInfoType(clazzinfo, generics); diff --git a/jode/test/CountOpcodes.java b/jode/test/CountOpcodes.java deleted file mode 100644 index 79a6d25..0000000 --- a/jode/test/CountOpcodes.java +++ /dev/null @@ -1,99 +0,0 @@ -import jode.bytecode.*; -import java.util.*; -import com.sun.java.util.collections.Iterator; - -public class CountOpcodes { - static int[] opcodeCount = new int[256]; - static int[] predsCount = new int[1024]; - static int[] succsCount = new int[1024]; - static Vector instructions = new Vector(73400); - - public static void handleBytecode(BytecodeInfo bc) { - for (Iterator i = bc.getInstructions().iterator(); i.hasNext();) { - Instruction instr = (Instruction) i.next(); - instructions.addElement(instr); - opcodeCount[instr.getOpcode()]++; - Instruction[] p = instr.getPreds(); - if (p == null) - predsCount[0]++; - else - predsCount[p.length]++; - - Instruction[] s = instr.getSuccs(); - if (s == null) - succsCount[0]++; - else - succsCount[s.length]++; - } - } - - public static void handlePackage(String pack) { - Enumeration subs = ClassInfo.getClassesAndPackages(pack); - while (subs.hasMoreElements()) { - String comp = (String) subs.nextElement(); - String full = pack + "." + comp; - if (ClassInfo.isPackage(full)) - handlePackage(full); - else { - ClassInfo clazz = ClassInfo.forName(full); - clazz.loadInfo(ClassInfo.FULLINFO); - MethodInfo[] ms = clazz.getMethods(); - for (int i=0; i < ms.length; i++) { - BytecodeInfo bc = ms[i].getBytecode(); - if (bc != null) - handleBytecode(bc); - } - } - } - } - - public static void main(String[] params) { - ClassInfo.setClassPath(params[0]); - Runtime runtime = Runtime.getRuntime(); - long free = runtime.freeMemory(); - long last; - do { - last = free; - runtime.gc(); - runtime.runFinalization(); - free = runtime.freeMemory(); - } while (free < last); - System.err.println("used before: "+(runtime.totalMemory()- free)); - long time = System.currentTimeMillis(); - handlePackage("com"); - System.err.println("Time used: "+(System.currentTimeMillis() - time)); - free = runtime.freeMemory(); - do { - last = free; - runtime.gc(); - runtime.runFinalization(); - free = runtime.freeMemory(); - } while (free < last); - System.err.println("used after: "+(runtime.totalMemory()- free)); - System.err.println("instruction count: "+instructions.size()); - for (int i=0; i< 256; i++) { - if (opcodeCount[i] > 0) - System.err.println("Opcode "+i+": \t ("+Opcodes.opcodeString[i]+")\t"+opcodeCount[i]); - } - int moreThanTwo = 0; - for (int i=0; i< predsCount.length; i++) { - if (predsCount[i] > 0) { - System.err.println("preds "+i+": \t"+predsCount[i]); - if (i>1) - moreThanTwo +=predsCount[i]; - } - } - System.err.println("preds >2: \t"+moreThanTwo); - - moreThanTwo = 0; - for (int i=0; i< succsCount.length; i++) { - if (succsCount[i] > 0) { - System.err.println("succs "+i+": \t"+succsCount[i]); - if (i>1) - moreThanTwo +=succsCount[i]; - } - } - System.err.println("succs >2: \t"+moreThanTwo); - } -} - diff --git a/jode/test/InlineTest.java b/jode/test/InlineTest.java index 3e9b05f..cf28000 100644 --- a/jode/test/InlineTest.java +++ b/jode/test/InlineTest.java @@ -23,12 +23,12 @@ * in a different package to check if inlining works over package borders. * * @author Jochen Hoenicke - * @see jode.test.OptimizeTest + * @see OptimizeTest */ public class InlineTest { public static final int - difficultSideInline(jode.test.OptimizeTest ot, int a) { + difficultSideInline(OptimizeTest ot, int a) { return ot.g++ + a; } } diff --git a/jode/test/ResolveConflicts.java b/jode/test/ResolveConflicts.java index c115dc3..61424e4 100644 --- a/jode/test/ResolveConflicts.java +++ b/jode/test/ResolveConflicts.java @@ -119,7 +119,7 @@ public class ResolveConflicts ///#endif ///#endif ///#ifdef JAVAC11 - return null; +/// return null; ///#else return ResolveConflicts.this.new Conflicts().new Inner(); ///#endif diff --git a/jode/test/innerclasses/CheckSuperRemove.java b/jode/test/innerclasses/CheckSuperRemove.java index 8c00b2b..75bb9fa 100644 --- a/jode/test/innerclasses/CheckSuperRemove.java +++ b/jode/test/innerclasses/CheckSuperRemove.java @@ -5,11 +5,12 @@ public class CheckSuperRemove { } MyInner myInner = new MyInner(); Inner anonInner = new Inner() { - public void test() {} - }; + public void test() {} + }; + /*FIXME: Understand why this does not work: MyInner anonInner2 = new MyInner() { - public void test() {} - }; + public void test() {} + };*/ } }