* jode/AssertError.java: removed, all uses are now replaced

by java.lang.InternalError.
* jode/Makefile.am: removed AssertError.java
* jode/bytecode/ClassInfo.java: reworked handling of inner
classes.
(extraClasses): removed, they are calculated automatically.
(hasInnerClassesAttr): new variable.
(readInnerClassesAttribute): Mark all classes in the constant
pool as having OUTERCLASS info filled.  Don't handle extraClasses
specially.
(prepareWriting): Change for automatically generating outer
class info.
(getKnownAttributes): dito.
(writeKnownAttributes): dito.
(getExtraClasses): removed.
(setExtraClasses): removed.

* jode/bytecode/ClassAnalyzer.java (conflicts): load or guess
declarations of info before getting inner classes.
* jode/decompiler/TabbedPrintWriter.java (BreakPoint.endOp):
Set options correctly.
* jode/expr/InvokeOperator.java (getMethodInfo): load or guess
declarations before accessing methods.
* jode/flow/FlowBlock.java (resolveSomeJumps): When creating a
if-then-else move the jump from the then branch to the if, before
restarting analysis.
(doT1): handle the case when lastModified.jump is null.  Throw
statements have no jump now.
* jode/jvm/SyntheticAnalyzer (checkAccess): Fix the detection for
PUTDUPSTATIC/FIELD.
* jode/type/ClassType.java (getCastHelper): More checks when
cast is not needed: interfaces and null pointer.


git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1331 379699f6-c40d-0410-875b-85095c16579e
master
hoenicke 24 years ago
parent e78e8b0472
commit f2d8663e9f
  1. 35
      jode/ChangeLog
  2. 29
      jode/jode/AssertError.java
  3. 1
      jode/jode/Makefile.am
  4. 212
      jode/jode/bytecode/ClassInfo.java
  5. 3
      jode/jode/bytecode/TypeSignature.java
  6. 5
      jode/jode/decompiler/ClassAnalyzer.java
  7. 2
      jode/jode/decompiler/LocalInfo.java
  8. 3
      jode/jode/decompiler/MethodAnalyzer.java
  9. 2
      jode/jode/decompiler/Opcodes.java
  10. 4
      jode/jode/decompiler/TabbedPrintWriter.java
  11. 2
      jode/jode/expr/ConstOperator.java
  12. 2
      jode/jode/expr/FieldOperator.java
  13. 2
      jode/jode/expr/IIncOperator.java
  14. 11
      jode/jode/expr/InvokeOperator.java
  15. 1
      jode/jode/expr/NoArgOperator.java
  16. 4
      jode/jode/expr/Operator.java
  17. 2
      jode/jode/expr/StoreInstruction.java
  18. 2
      jode/jode/flow/CaseBlock.java
  19. 4
      jode/jode/flow/ConditionalBlock.java
  20. 32
      jode/jode/flow/FlowBlock.java
  21. 2
      jode/jode/flow/SequentialBlock.java
  22. 2
      jode/jode/flow/SlotSet.java
  23. 9
      jode/jode/flow/StructuredBlock.java
  24. 7
      jode/jode/flow/TransformExceptionHandlers.java
  25. 2
      jode/jode/flow/VariableSet.java
  26. 2
      jode/jode/flow/VariableStack.java
  27. 5
      jode/jode/jvm/CodeVerifier.java
  28. 3
      jode/jode/jvm/Interpreter.java
  29. 1
      jode/jode/jvm/SimpleRuntimeEnvironment.java
  30. 3
      jode/jode/jvm/SyntheticAnalyzer.java
  31. 3
      jode/jode/obfuscator/MethodIdentifier.java
  32. 15
      jode/jode/obfuscator/modules/ConstantAnalyzer.java
  33. 7
      jode/jode/obfuscator/modules/LocalOptimizer.java
  34. 9
      jode/jode/obfuscator/modules/RemovePopAnalyzer.java
  35. 9
      jode/jode/type/ClassType.java
  36. 2
      jode/jode/type/IntegerType.java
  37. 2
      jode/jode/type/MultiClassType.java
  38. 1
      jode/jode/type/NullType.java
  39. 5
      jode/jode/type/RangeType.java
  40. 5
      jode/jode/type/Type.java
  41. 2
      jode/jode/util/SimpleSet.java

@ -1,3 +1,38 @@
2001-07-28 Jochen Hoenicke <jochen@gnu.org>
* jode/AssertError.java: removed, all uses are now replaced
by java.lang.InternalError.
* jode/Makefile.am: removed AssertError.java
* jode/bytecode/ClassInfo.java: reworked handling of inner
classes.
(extraClasses): removed, they are calculated automatically.
(hasInnerClassesAttr): new variable.
(readInnerClassesAttribute): Mark all classes in the constant
pool as having OUTERCLASS info filled. Don't handle extraClasses
specially.
(prepareWriting): Change for automatically generating outer
class info.
(getKnownAttributes): dito.
(writeKnownAttributes): dito.
(getExtraClasses): removed.
(setExtraClasses): removed.
* jode/bytecode/ClassAnalyzer.java (conflicts): load or guess
declarations of info before getting inner classes.
* jode/decompiler/TabbedPrintWriter.java (BreakPoint.endOp):
Set options correctly.
* jode/expr/InvokeOperator.java (getMethodInfo): load or guess
declarations before accessing methods.
* jode/flow/FlowBlock.java (resolveSomeJumps): When creating a
if-then-else move the jump from the then branch to the if, before
restarting analysis.
(doT1): handle the case when lastModified.jump is null. Throw
statements have no jump now.
* jode/jvm/SyntheticAnalyzer (checkAccess): Fix the detection for
PUTDUPSTATIC/FIELD.
* jode/type/ClassType.java (getCastHelper): More checks when
cast is not needed: interfaces and null pointer.
2001-07-15 Jochen Hoenicke <jochen@gnu.org> 2001-07-15 Jochen Hoenicke <jochen@gnu.org>
* jode/decompiler/Decompiler.java (decompile): removed * jode/decompiler/Decompiler.java (decompile): removed
setClassPath call. ClassInfo.forName() is no longer used. setClassPath call. ClassInfo.forName() is no longer used.

@ -1,29 +0,0 @@
/* AssertError Copyright (C) 1998-1999 Jochen Hoenicke.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id$
*/
package jode;
public class AssertError extends Error {
public AssertError() {
}
public AssertError(String detail) {
super(detail);
}
}

@ -11,7 +11,6 @@ SUBSTCP = @SUBSTCP@
FULL_CLASSPATH := $(shell $(SUBSTCP) $(top_srcdir):$(top_builddir):$(CLASSPATH):$(CLASSLIB)) FULL_CLASSPATH := $(shell $(SUBSTCP) $(top_srcdir):$(top_builddir):$(CLASSPATH):$(CLASSLIB))
MY_JAVA_FILES = \ MY_JAVA_FILES = \
AssertError.java \
GlobalOptions.java GlobalOptions.java
noinst_DATA = $(MY_JAVA_FILES:.java=.class) noinst_DATA = $(MY_JAVA_FILES:.java=.class)

@ -34,8 +34,9 @@ import java.security.NoSuchAlgorithmException;
///#def COLLECTIONS java.util ///#def COLLECTIONS java.util
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator; import java.util.ListIterator;
import java.util.List;
import java.util.ArrayList;
///#enddef ///#enddef
///#def COLLECTIONEXTRA java.lang ///#def COLLECTIONEXTRA java.lang
import java.lang.Comparable; import java.lang.Comparable;
@ -239,10 +240,10 @@ public final class ClassInfo extends BinaryInfo implements Comparable {
private ClassInfo outerClass; private ClassInfo outerClass;
private ClassInfo[] interfaces; private ClassInfo[] interfaces;
private ClassInfo[] innerClasses; private ClassInfo[] innerClasses;
private ClassInfo[] extraClasses;
private FieldInfo[] fields; private FieldInfo[] fields;
private MethodInfo[] methods; private MethodInfo[] methods;
private String sourceFile; private String sourceFile;
private boolean hasInnerClassesAttr;
/** /**
* This constant can be used as parameter to drop. It specifies * This constant can be used as parameter to drop. It specifies
@ -470,6 +471,8 @@ public final class ClassInfo extends BinaryInfo implements Comparable {
* doesn't work. * doesn't work.
*/ */
hasInnerClassesAttr = true;
int count = input.readUnsignedShort(); int count = input.readUnsignedShort();
if (length != 2 + 8 * count) if (length != 2 + 8 * count)
throw new ClassFormatException throw new ClassFormatException
@ -559,12 +562,21 @@ public final class ClassInfo extends BinaryInfo implements Comparable {
} else } else
innerClasses = null; innerClasses = null;
if (extraCount > 0) { /* All remaining classes that are mentioned in the constant
extraClasses = new ClassInfo[extraCount]; * pool must have an empty outer class info. This is
for (int i = 0; i < extraCount; i++) * specified in the 2nd edition of the JVM specification.
extraClasses[i] = innerExtra[count - i - 1]; */
} else for (int i = 1; i < cp.size(); i++) {
extraClasses = null; if (cp.tags[i] == cp.CLASS) {
String clName = cp.getUTF8(cp.indices1[i]);
if (clName.charAt(0) != '[') {
ClassInfo ci = classpath.getClassInfo
(clName.replace('/','.'));
if (ci.status < OUTERCLASS)
ci.mergeOuterInfo(null, null, -1, false);
}
}
}
} }
void readAttribute(String name, int length, void readAttribute(String name, int length,
@ -810,9 +822,9 @@ public final class ClassInfo extends BinaryInfo implements Comparable {
private void prepareWriting(GrowableConstantPool gcp) { private void prepareWriting(GrowableConstantPool gcp) {
gcp.putClassName(name); gcp.putClassName(name);
gcp.putClassName(superclass.getName()); gcp.putClassName(superclass.name);
for (int i=0; i < interfaces.length; i++) for (int i=0; i < interfaces.length; i++)
gcp.putClassName(interfaces[i].getName()); gcp.putClassName(interfaces[i].name);
for (int i=0; i < fields.length; i++) for (int i=0; i < fields.length; i++)
fields[i].prepareWriting(gcp); fields[i].prepareWriting(gcp);
@ -820,52 +832,46 @@ public final class ClassInfo extends BinaryInfo implements Comparable {
for (int i=0; i < methods.length; i++) for (int i=0; i < methods.length; i++)
methods[i].prepareWriting(gcp); methods[i].prepareWriting(gcp);
for (int i=0; i < innerClasses.length; i++)
gcp.putClassName(innerClasses[i].name);
if (sourceFile != null) { if (sourceFile != null) {
gcp.putUTF8("SourceFile"); gcp.putUTF8("SourceFile");
gcp.putUTF8(sourceFile); gcp.putUTF8(sourceFile);
} }
if (outerClass != null || methodScoped
|| innerClasses != null || extraClasses != null) {
gcp.putUTF8("InnerClasses");
ClassInfo outer = this;
while (outer.outerClass != null || outer.methodScoped) {
if (outer.status <= OUTERCLASS)
throw new IllegalStateException
(outer.name + "'s state is " + outer.status);
if (outer.className != null)
gcp.putClassName(outer.className);
if (outer.outerClass == null)
break;
gcp.putClassName(outer.outerClass.name);
outer = outer.outerClass;
}
int innerCount = innerClasses != null ? innerClasses.length : 0;
for (int i = innerCount; i-- > 0; i++) {
if (innerClasses[i].status <= OUTERCLASS)
throw new IllegalStateException
(innerClasses[i].name + "'s state is "
+ innerClasses[i].status);
if (innerClasses[i].outerClass != this)
throw new IllegalStateException
(innerClasses[i].name + "'s outer is " +
innerClasses[i].outerClass.name);
gcp.putClassName(innerClasses[i].name); /* All classes mentioned in the constant pool must have an
if (innerClasses[i].className != null) * outer class info. This is clearly specified in the 2nd
gcp.putUTF8(innerClasses[i].className); * edition of the JVM specification.
} */
int extraCount = extraClasses != null ? extraClasses.length : 0; hasInnerClassesAttr = false;
for (int i=extraCount; i-- >= 0; ) { for (int i = 1; i < gcp.size(); i++) {
if (extraClasses[i].status <= OUTERCLASS) if (gcp.tags[i] == gcp.CLASS) {
throw new IllegalStateException String clName;
(extraClasses[i].name + "'s state is " try {
+ extraClasses[i].status); clName = gcp.getUTF8(gcp.indices1[i]);
gcp.putClassName(extraClasses[i].name); } catch (ClassFormatException ex) {
if (extraClasses[i].outerClass != null) throw new InternalError(ex.getMessage());
gcp.putClassName(extraClasses[i].outerClass.name); }
if (extraClasses[i].className != null) if (clName.charAt(0) != '[') {
gcp.putUTF8(extraClasses[i].className); ClassInfo ci = classpath.getClassInfo
(clName.replace('/','.'));
if (ci.status < OUTERCLASS) {
GlobalOptions.err.println
("WARNING: "+ ci.name
+ "'s outer class isn't known.");
} else {
if ((ci.outerClass != null || ci.methodScoped)
&& ! hasInnerClassesAttr) {
gcp.putUTF8("innerClasses");
hasInnerClassesAttr = true;
}
if (ci.outerClass != null)
gcp.putClassName(ci.outerClass.name);
if (ci.className != null)
gcp.putUTF8(ci.className);
}
}
} }
} }
prepareAttributes(gcp); prepareAttributes(gcp);
@ -875,8 +881,7 @@ public final class ClassInfo extends BinaryInfo implements Comparable {
int count = 0; int count = 0;
if (sourceFile != null) if (sourceFile != null)
count++; count++;
if (outerClass != null || methodScoped if (hasInnerClassesAttr)
|| innerClasses != null || extraClasses != null)
count++; count++;
return count; return count;
} }
@ -889,71 +894,48 @@ public final class ClassInfo extends BinaryInfo implements Comparable {
output.writeInt(2); output.writeInt(2);
output.writeShort(gcp.putUTF8(sourceFile)); output.writeShort(gcp.putUTF8(sourceFile));
} }
if (outerClass != null || methodScoped
|| innerClasses != null || extraClasses != null) {
// XXX TODO: Closeness of extra outer information.
gcp.putUTF8("InnerClasses");
ClassInfo outer; List outers = new ArrayList();
LinkedList outerExtraClasses = new LinkedList(); for (int i = 0; i < gcp.size(); i++) {
if (gcp.tags[i] == gcp.CLASS) {
outer = this; String clName;
while (outer.outerClass != null || outer.methodScoped) { try {
/* Outers must be written in backward order, so we clName = gcp.getUTF8(gcp.indices1[i]);
* add them to the beginning of the list. } catch (ClassFormatException ex) {
*/ throw new InternalError(ex.getMessage());
outerExtraClasses.add(0, outer); }
if (outer.outerClass == null) if (clName.charAt(0) != '[') {
break; ClassInfo ci = classpath.getClassInfo
outer = outer.outerClass; (clName.replace('/','.'));
} while (ci.status >= OUTERCLASS
if (extraClasses != null) { && ci.outerClass != null || ci.methodScoped) {
int extraCount = extraClasses.length; /* Order is important so remove ci if it
for (int i = 0; i < extraCount; i++) { * already exists and add it to the end. This
outer = extraClasses[i]; * way the outermost classes go to the end.
ListIterator insertIter
= outerExtraClasses.listIterator
(outerExtraClasses.size());
int insertPos = outerExtraClasses.size();
while (outer.outerClass != null || outer.methodScoped) {
if (outerExtraClasses.contains(outer))
break;
/* We have to add outers in reverse order to the
* end of the list. We use the insertIter to do
* this trick.
*/ */
insertIter.add(outer); outers.remove(ci);
insertIter.previous(); outers.add(ci);
if (outer.outerClass == null) ci = ci.outerClass;
break;
outer = outer.outerClass;
} }
} }
} }
}
int innerCount = (innerClasses != null) ? innerClasses.length : 0; if (hasInnerClassesAttr) {
int count = outerExtraClasses.size() + innerCount; int count = outers.size();
output.writeShort(gcp.putUTF8("InnerClasses"));
output.writeInt(2 + count * 8); output.writeInt(2 + count * 8);
output.writeShort(count); output.writeShort(count);
for (Iterator i = outerExtraClasses.iterator(); i.hasNext(); ) { ListIterator iter = outers.listIterator(count);
outer = (ClassInfo) i.next(); while (iter.hasPrevious()) {
ClassInfo ci = (ClassInfo) iter.previous();
output.writeShort(gcp.putClassName(outer.name)); output.writeShort(gcp.putClassName(ci.name));
output.writeShort(outer.outerClass == null ? 0 : output.writeShort(ci.outerClass == null ? 0 :
gcp.putClassName(outer.outerClass.name)); gcp.putClassName(ci.outerClass.name));
output.writeShort(outer.className == null ? 0 : output.writeShort(ci.className == null ? 0 :
gcp.putUTF8(outer.className)); gcp.putUTF8(ci.className));
output.writeShort(outer.modifiers); output.writeShort(ci.modifiers);
}
for (int i = innerCount; i-- > 0; i++) {
output.writeShort(gcp.putClassName(innerClasses[i].name));
output.writeShort(innerClasses[i].outerClass != null ?
gcp.putClassName(innerClasses[i]
.outerClass.name) : 0);
output.writeShort(innerClasses[i].className != null ?
gcp.putUTF8(innerClasses[i].className) : 0);
output.writeShort(innerClasses[i].modifiers);
} }
} }
} }
@ -1122,7 +1104,6 @@ public final class ClassInfo extends BinaryInfo implements Comparable {
methodScoped = false; methodScoped = false;
outerClass = null; outerClass = null;
innerClasses = null; innerClasses = null;
extraClasses = null;
} }
if (keep < PUBLICDECLARATIONS) { if (keep < PUBLICDECLARATIONS) {
@ -1285,12 +1266,6 @@ public final class ClassInfo extends BinaryInfo implements Comparable {
return innerClasses; return innerClasses;
} }
public ClassInfo[] getExtraClasses() {
if (status < OUTERCLASS)
throw new IllegalStateException("status is "+status);
return extraClasses;
}
public String getSourceFile() { public String getSourceFile() {
return sourceFile; return sourceFile;
} }
@ -1340,11 +1315,6 @@ public final class ClassInfo extends BinaryInfo implements Comparable {
modified = true; modified = true;
} }
public void setExtraClasses(ClassInfo[] ec) {
extraClasses = ec;
modified = true;
}
public void setSourceFile(String newSource) { public void setSourceFile(String newSource) {
sourceFile = newSource; sourceFile = newSource;
modified = true; modified = true;

@ -18,7 +18,6 @@
*/ */
package jode.bytecode; package jode.bytecode;
import jode.AssertError;
import jode.util.UnifyHash; import jode.util.UnifyHash;
/** /**
@ -51,7 +50,7 @@ public class TypeSignature {
else if (javaType == Void.TYPE) else if (javaType == Void.TYPE)
return sb.append('V'); return sb.append('V');
else else
throw new AssertError("Unknown primitive type: "+javaType); throw new InternalError("Unknown primitive type: "+javaType);
} else if (javaType.isArray()) { } else if (javaType.isArray()) {
return appendSignature(sb.append('['), return appendSignature(sb.append('['),
javaType.getComponentType()); javaType.getComponentType());

@ -705,6 +705,11 @@ public class ClassAnalyzer
} }
} }
if (usageType == CLASSNAME || usageType == AMBIGUOUSNAME) { if (usageType == CLASSNAME || usageType == AMBIGUOUSNAME) {
try {
info.load(info.DECLARATIONS);
} catch (IOException ex) {
info.guess(info.DECLARATIONS);
}
ClassInfo[] iinfos = info.getClasses(); ClassInfo[] iinfos = info.getClasses();
if (iinfos != null) { if (iinfos != null) {
for (int i=0; i < iinfos.length; i++) { for (int i=0; i < iinfos.length; i++) {

@ -141,7 +141,7 @@ public class LocalInfo implements Declarable {
shadow.name = name; shadow.name = name;
if (constExpr != null) { if (constExpr != null) {
if (shadow.constExpr != null) if (shadow.constExpr != null)
throw new jode.AssertError throw new InternalError
("local has multiple constExpr"); ("local has multiple constExpr");
shadow.constExpr = constExpr; shadow.constExpr = constExpr;
} }

@ -18,7 +18,6 @@
*/ */
package jode.decompiler; package jode.decompiler;
import jode.AssertError;
import jode.GlobalOptions; import jode.GlobalOptions;
import jode.bytecode.BasicBlocks; import jode.bytecode.BasicBlocks;
import jode.bytecode.Block; import jode.bytecode.Block;
@ -572,7 +571,7 @@ public class MethodAnalyzer implements Scope, ClassDeclarer {
verifier.verify(); verifier.verify();
} catch (VerifyException ex) { } catch (VerifyException ex) {
ex.printStackTrace(GlobalOptions.err); ex.printStackTrace(GlobalOptions.err);
throw new jode.AssertError("Verification error"); throw new InternalError("Verification error");
} }
} }
} }

@ -425,7 +425,7 @@ public abstract class Opcodes implements jode.bytecode.Opcodes {
opcode - (opc_ifnull-Operator.COMPARE_OP)))); opcode - (opc_ifnull-Operator.COMPARE_OP))));
break; break;
default: default:
throw new jode.AssertError("Invalid opcode "+opcode); throw new InternalError("Invalid opcode "+opcode);
} }
} }
} }

@ -22,7 +22,6 @@ import java.io.*;
import java.util.Stack; import java.util.Stack;
import java.util.Vector; import java.util.Vector;
import java.util.Enumeration; import java.util.Enumeration;
import jode.AssertError;
import jode.GlobalOptions; import jode.GlobalOptions;
import jode.bytecode.ClassInfo; import jode.bytecode.ClassInfo;
import jode.type.*; import jode.type.*;
@ -131,9 +130,8 @@ public class TabbedPrintWriter {
* our child, if possible. * our child, if possible.
*/ */
BreakPoint child = (BreakPoint) childBPs.elementAt(0); BreakPoint child = (BreakPoint) childBPs.elementAt(0);
options = child.options; options = Math.min(options, child.options);
startPos = child.startPos; startPos = child.startPos;
options = child.options;
endPos = child.endPos; endPos = child.endPos;
breakPenalty = child.breakPenalty; breakPenalty = child.breakPenalty;
childBPs = child.childBPs; childBPs = child.childBPs;

@ -123,7 +123,7 @@ public class ConstOperator extends NoArgOperator {
else if (intVal == 1) else if (intVal == 1)
return "true"; return "true";
else else
throw new jode.AssertError throw new InternalError
("boolean is neither false nor true"); ("boolean is neither false nor true");
} }
if (type.getHint().equals(Type.tChar)) { if (type.getHint().equals(Type.tChar)) {

@ -132,7 +132,7 @@ public abstract class FieldOperator extends Operator {
else if (ana.getParent() instanceof ClassAnalyzer) else if (ana.getParent() instanceof ClassAnalyzer)
ana = (ClassAnalyzer) ana.getParent(); ana = (ClassAnalyzer) ana.getParent();
else else
throw new jode.AssertError("Unknown parent"); throw new InternalError("Unknown parent");
} }
} }
return null; return null;

@ -61,7 +61,7 @@ public class IIncOperator extends Operator
*/ */
public void makeNonVoid() { public void makeNonVoid() {
if (type != Type.tVoid) if (type != Type.tVoid)
throw new jode.AssertError("already non void"); throw new InternalError("already non void");
type = subExpressions[0].getType(); type = subExpressions[0].getType();
} }

@ -213,6 +213,11 @@ public final class InvokeOperator extends Operator
private static MethodInfo getMethodInfo(ClassInfo clazz, private static MethodInfo getMethodInfo(ClassInfo clazz,
String name, String type) { String name, String type) {
while (clazz != null) { while (clazz != null) {
try {
clazz.load(clazz.DECLARATIONS);
} catch (IOException ex) {
clazz.guess(clazz.DECLARATIONS);
}
MethodInfo method = clazz.findMethod(name, type); MethodInfo method = clazz.findMethod(name, type);
if (method != null) if (method != null)
return method; return method;
@ -268,7 +273,7 @@ public final class InvokeOperator extends Operator
*/ */
public void makeNonVoid() { public void makeNonVoid() {
if (type != Type.tVoid) if (type != Type.tVoid)
throw new jode.AssertError("already non void"); throw new InternalError("already non void");
ClassInfo clazz = classInfo; ClassInfo clazz = classInfo;
if (clazz != null if (clazz != null
&& clazz.isMethodScoped() && clazz.getClassName() == null) { && clazz.isMethodScoped() && clazz.getClassName() == null) {
@ -340,7 +345,7 @@ public final class InvokeOperator extends Operator
& Options.OPTION_INNER) != 0) & Options.OPTION_INNER) != 0)
ana = (ClassAnalyzer) ana.getParent(); ana = (ClassAnalyzer) ana.getParent();
else else
throw new jode.AssertError throw new InternalError
("Unknown parent: "+ana+": "+ana.getParent()); ("Unknown parent: "+ana+": "+ana.getParent());
} }
} }
@ -379,7 +384,7 @@ public final class InvokeOperator extends Operator
& Options.OPTION_INNER) != 0) & Options.OPTION_INNER) != 0)
ana = (ClassAnalyzer) ana.getParent(); ana = (ClassAnalyzer) ana.getParent();
else else
throw new jode.AssertError throw new InternalError
("Unknown parent: "+ana+": "+ana.getParent()); ("Unknown parent: "+ana+": "+ana.getParent());
} }
} }

@ -19,7 +19,6 @@
package jode.expr; package jode.expr;
import jode.type.Type; import jode.type.Type;
import jode.AssertError;
import jode.decompiler.TabbedPrintWriter; import jode.decompiler.TabbedPrintWriter;
public abstract class NoArgOperator extends Operator { public abstract class NoArgOperator extends Operator {

@ -71,7 +71,7 @@ public abstract class Operator extends Expression {
super(type); super(type);
this.operatorIndex = op; this.operatorIndex = op;
if (type == null) if (type == null)
throw new jode.AssertError("type == null"); throw new InternalError("type == null");
} }
public void initOperands(int opcount) { public void initOperands(int opcount) {
@ -118,7 +118,7 @@ public abstract class Operator extends Expression {
return this; return this;
} }
} }
throw new jode.AssertError("addOperand called, but no operand needed"); throw new InternalError("addOperand called, but no operand needed");
} }
public Operator getOperator() { public Operator getOperator() {

@ -49,7 +49,7 @@ public class StoreInstruction extends Operator
*/ */
public void makeNonVoid() { public void makeNonVoid() {
if (type != Type.tVoid) if (type != Type.tVoid)
throw new jode.AssertError("already non void"); throw new InternalError("already non void");
type = subExpressions[0].getType(); type = subExpressions[0].getType();
} }

@ -67,7 +67,7 @@ public class CaseBlock extends StructuredBlock {
public void checkConsistent() { public void checkConsistent() {
if (!(outer instanceof SwitchBlock)) if (!(outer instanceof SwitchBlock))
throw new jode.AssertError("Inconsistency"); throw new InternalError("Inconsistency");
super.checkConsistent(); super.checkConsistent();
} }

@ -37,7 +37,7 @@ public class ConditionalBlock extends InstructionContainer {
public void checkConsistent() { public void checkConsistent() {
super.checkConsistent(); super.checkConsistent();
if (!(trueBlock instanceof EmptyBlock)) if (!(trueBlock instanceof EmptyBlock))
throw new jode.AssertError("Inconsistency"); throw new InternalError("Inconsistency");
} }
/** /**
@ -84,7 +84,7 @@ public class ConditionalBlock extends InstructionContainer {
*/ */
public boolean replaceSubBlock(StructuredBlock oldBlock, public boolean replaceSubBlock(StructuredBlock oldBlock,
StructuredBlock newBlock) { StructuredBlock newBlock) {
throw new jode.AssertError("replaceSubBlock on ConditionalBlock"); throw new InternalError("replaceSubBlock on ConditionalBlock");
} }
/** /**

@ -19,7 +19,6 @@
package jode.flow; package jode.flow;
import jode.GlobalOptions; import jode.GlobalOptions;
import jode.AssertError;
import jode.decompiler.TabbedPrintWriter; import jode.decompiler.TabbedPrintWriter;
import jode.decompiler.MethodAnalyzer; import jode.decompiler.MethodAnalyzer;
import jode.decompiler.LocalInfo; import jode.decompiler.LocalInfo;
@ -427,7 +426,7 @@ public class FlowBlock {
} }
/* Now find the real outer block, that is ascend the /* Now find the real outer block, i.e. traverse the
* chain of SequentialBlocks. * chain of SequentialBlocks.
* *
* Note that only the last instr in a SequentialBlock chain * Note that only the last instr in a SequentialBlock chain
@ -512,9 +511,12 @@ public class FlowBlock {
lastModified = ifBlock; lastModified = ifBlock;
} }
ifBlock.moveJump(jump);
/* Consider all jumps again, since the ones that moved /* Consider all jumps again, since the ones that moved
* into the thenBlock may be obsolete now. * into the thenBlock may be obsolete now.
* XXX only jumps in then should be considered. * XXX only jumps in then should be considered.
* XXX I'm not sure if this is complete.
*/ */
if (remainingJumps == null) if (remainingJumps == null)
jumps = jump; jumps = jump;
@ -525,9 +527,6 @@ public class FlowBlock {
remainingJumps.next = jump; remainingJumps.next = jump;
remainingJumps = null; remainingJumps = null;
} }
/* consider this jump again */
// ifBlock.moveJump(jump);
// jumps = jump;
continue; continue;
} }
} }
@ -806,7 +805,7 @@ public class FlowBlock {
try { try {
if (block.outer != null || block.flowBlock != this) { if (block.outer != null || block.flowBlock != this) {
throw new AssertError("Inconsistency: outer:"+block.outer+" block.flow"+block.flowBlock +" this: "+this); throw new InternalError("Inconsistency: outer:"+block.outer+" block.flow"+block.flowBlock +" this: "+this);
} }
block.checkConsistent(); block.checkConsistent();
@ -816,7 +815,7 @@ public class FlowBlock {
/* The special start marker */ /* The special start marker */
continue; continue;
if (!pred.successors.containsKey(this)) if (!pred.successors.containsKey(this))
throw new AssertError("Inconsistency"); throw new InternalError("Inconsistency");
} }
StructuredBlock last = lastModified; StructuredBlock last = lastModified;
@ -824,28 +823,28 @@ public class FlowBlock {
|| last.outer instanceof TryBlock) || last.outer instanceof TryBlock)
last = last.outer; last = last.outer;
if (last.outer != null) if (last.outer != null)
throw new AssertError("Inconsistency"); throw new InternalError("Inconsistency");
Iterator iter = successors.entrySet().iterator(); Iterator iter = successors.entrySet().iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next(); Map.Entry entry = (Map.Entry) iter.next();
FlowBlock dest = (FlowBlock) entry.getKey(); FlowBlock dest = (FlowBlock) entry.getKey();
if (dest.predecessors.contains(this) == (dest == END_OF_METHOD)) if (dest.predecessors.contains(this) == (dest == END_OF_METHOD))
throw new AssertError("Inconsistency"); throw new InternalError("Inconsistency");
Jump jumps = ((SuccessorInfo) entry.getValue()).jumps; Jump jumps = ((SuccessorInfo) entry.getValue()).jumps;
if (jumps == null) if (jumps == null)
throw new AssertError("Inconsistency"); throw new InternalError("Inconsistency");
for (; jumps != null; jumps = jumps.next) { for (; jumps != null; jumps = jumps.next) {
if (jumps.destination != dest) if (jumps.destination != dest)
throw new AssertError("Inconsistency"); throw new InternalError("Inconsistency");
if (jumps.prev == null if (jumps.prev == null
|| jumps.prev.flowBlock != this || jumps.prev.flowBlock != this
|| jumps.prev.jump != jumps) || jumps.prev.jump != jumps)
throw new AssertError("Inconsistency"); throw new InternalError("Inconsistency");
prev_loop: prev_loop:
for (StructuredBlock prev = jumps.prev; prev != block; for (StructuredBlock prev = jumps.prev; prev != block;
@ -858,11 +857,11 @@ public class FlowBlock {
if (blocks[i] == prev) if (blocks[i] == prev)
continue prev_loop; continue prev_loop;
throw new AssertError("Inconsistency"); throw new InternalError("Inconsistency");
} }
} }
} }
} catch (AssertError err) { } catch (InternalError err) {
GlobalOptions.err.println("Inconsistency in: "+this); GlobalOptions.err.println("Inconsistency in: "+this);
throw err; throw err;
} }
@ -1267,7 +1266,8 @@ public class FlowBlock {
/* Now remove the jump of lastModified if it points to this. /* Now remove the jump of lastModified if it points to this.
*/ */
if (lastModified.jump.destination == this) if (lastModified.jump != null
&& lastModified.jump.destination == this)
lastModified.removeJump(); lastModified.removeJump();
} }
@ -1634,7 +1634,7 @@ public class FlowBlock {
*/ */
public void mapStackToLocal(VariableStack initialStack) { public void mapStackToLocal(VariableStack initialStack) {
if (initialStack == null) if (initialStack == null)
throw new jode.AssertError("initial stack is null"); throw new InternalError("initial stack is null");
stackMap = initialStack; stackMap = initialStack;
block.mapStackToLocal(initialStack); block.mapStackToLocal(initialStack);
Iterator iter = successors.values().iterator(); Iterator iter = successors.values().iterator();

@ -57,7 +57,7 @@ public class SequentialBlock extends StructuredBlock {
if (subBlocks[0].jump != null if (subBlocks[0].jump != null
|| subBlocks[0] instanceof SequentialBlock || subBlocks[0] instanceof SequentialBlock
|| jump != null) || jump != null)
throw new jode.AssertError("Inconsistency"); throw new InternalError("Inconsistency");
} }
/** /**

@ -165,7 +165,7 @@ public final class SlotSet extends AbstractSet implements Cloneable {
} }
return other; return other;
} catch (CloneNotSupportedException ex) { } catch (CloneNotSupportedException ex) {
throw new jode.AssertError("Clone?"); throw new InternalError("Clone?");
} }
} }

@ -18,7 +18,6 @@
*/ */
package jode.flow; package jode.flow;
import jode.AssertError;
import jode.GlobalOptions; import jode.GlobalOptions;
import jode.decompiler.TabbedPrintWriter; import jode.decompiler.TabbedPrintWriter;
import jode.decompiler.LocalInfo; import jode.decompiler.LocalInfo;
@ -277,7 +276,7 @@ public abstract class StructuredBlock {
*/ */
public void moveJump(Jump jump) { public void moveJump(Jump jump) {
if (this.jump != null) if (this.jump != null)
throw new AssertError("overriding with moveJump()"); throw new InternalError("overriding with moveJump()");
this.jump = jump; this.jump = jump;
if (jump != null) { if (jump != null) {
jump.prev.jump = null; jump.prev.jump = null;
@ -292,7 +291,7 @@ public abstract class StructuredBlock {
*/ */
public void copyJump(Jump jump) { public void copyJump(Jump jump) {
if (this.jump != null) if (this.jump != null)
throw new AssertError("overriding with moveJump()"); throw new InternalError("overriding with moveJump()");
if (jump != null) { if (jump != null) {
this.jump = new Jump(jump); this.jump = new Jump(jump);
this.jump.prev = this; this.jump.prev = this;
@ -546,7 +545,7 @@ public abstract class StructuredBlock {
for (int i=0; i<subs.length; i++) { for (int i=0; i<subs.length; i++) {
if (subs[i].outer != this || if (subs[i].outer != this ||
subs[i].flowBlock != flowBlock) { subs[i].flowBlock != flowBlock) {
throw new AssertError("Inconsistency"); throw new InternalError("Inconsistency");
} }
subs[i].checkConsistent(); subs[i].checkConsistent();
} }
@ -554,7 +553,7 @@ public abstract class StructuredBlock {
Jump jumps = (Jump) flowBlock.getJumps(jump.destination); Jump jumps = (Jump) flowBlock.getJumps(jump.destination);
for (; jumps != jump; jumps = jumps.next) { for (; jumps != jump; jumps = jumps.next) {
if (jumps == null) if (jumps == null)
throw new AssertError("Inconsistency"); throw new InternalError("Inconsistency");
} }
} }
} }

@ -18,7 +18,6 @@
*/ */
package jode.flow; package jode.flow;
import jode.AssertError;
import jode.GlobalOptions; import jode.GlobalOptions;
import jode.type.Type; import jode.type.Type;
import jode.decompiler.LocalInfo; import jode.decompiler.LocalInfo;
@ -827,7 +826,7 @@ public class TransformExceptionHandlers {
int end = exc.end.getBlockNr(); int end = exc.end.getBlockNr();
int handler = exc.handler.getBlockNr(); int handler = exc.handler.getBlockNr();
if (start > end || handler <= end) if (start > end || handler <= end)
throw new AssertError throw new InternalError
("ExceptionHandler order failed: not " ("ExceptionHandler order failed: not "
+ start + " < " + end + " <= " + handler); + start + " < " + end + " <= " + handler);
if (last != null if (last != null
@ -840,7 +839,7 @@ public class TransformExceptionHandlers {
*/ */
if (end >= last.start.getBlockNr() if (end >= last.start.getBlockNr()
&& end < last.end.getBlockNr()) && end < last.end.getBlockNr())
throw new AssertError throw new InternalError
("Exception handlers ranges are intersecting: [" ("Exception handlers ranges are intersecting: ["
+ last.start.getBlockNr()+", " + last.start.getBlockNr()+", "
+ last.end.getBlockNr()+"] and [" + last.end.getBlockNr()+"] and ["
@ -894,7 +893,7 @@ public class TransformExceptionHandlers {
("Warning: Can't completely analyze try."); ("Warning: Can't completely analyze try.");
TryBlock tryBlock = new TryBlock(tryFlow); TryBlock tryBlock = new TryBlock(tryFlow);
} else if (!(tryFlow.block instanceof TryBlock)) } else if (!(tryFlow.block instanceof TryBlock))
throw new AssertError("no TryBlock"); throw new InternalError("no TryBlock");
FlowBlock catchFlow = exc.handler; FlowBlock catchFlow = exc.handler;
boolean isMultiUsed = catchFlow.predecessors.size() != 0; boolean isMultiUsed = catchFlow.predecessors.size() != 0;

@ -181,7 +181,7 @@ public final class VariableSet extends AbstractSet implements Cloneable {
} }
return other; return other;
} catch (CloneNotSupportedException ex) { } catch (CloneNotSupportedException ex) {
throw new jode.AssertError("Clone?"); throw new InternalError("Clone?");
} }
} }

@ -161,7 +161,7 @@ public class VariableStack {
newStack[stackMap.length-1] = stackMap[stackMap.length-2]; newStack[stackMap.length-1] = stackMap[stackMap.length-2];
return new VariableStack(newStack); return new VariableStack(newStack);
} else } else
throw new jode.AssertError("Unknown SpecialBlock"); throw new InternalError("Unknown SpecialBlock");
} }
public String toString() { public String toString() {

@ -18,7 +18,6 @@
*/ */
package jode.jvm; package jode.jvm;
import jode.AssertError;
import jode.GlobalOptions; import jode.GlobalOptions;
import jode.bytecode.BasicBlocks; import jode.bytecode.BasicBlocks;
import jode.bytecode.Block; import jode.bytecode.Block;
@ -500,7 +499,7 @@ public class CodeVerifier implements Opcodes {
result.jsrInfo = new JsrUsedInfo(jsrInfo); result.jsrInfo = new JsrUsedInfo(jsrInfo);
return result; return result;
} catch(CloneNotSupportedException ex) { } catch(CloneNotSupportedException ex) {
throw new AssertError("Clone not supported?"); throw new InternalError("Clone not supported?");
} }
} }
@ -1216,7 +1215,7 @@ public class CodeVerifier implements Opcodes {
break; break;
} }
default: default:
throw new AssertError("Invalid opcode "+opcode); throw new InternalError("Invalid opcode "+opcode);
} }
} }

@ -18,7 +18,6 @@
*/ */
package jode.jvm; package jode.jvm;
import jode.AssertError;
import jode.GlobalOptions; import jode.GlobalOptions;
import jode.bytecode.BasicBlocks; import jode.bytecode.BasicBlocks;
import jode.bytecode.Block; import jode.bytecode.Block;
@ -747,7 +746,7 @@ public class Interpreter implements Opcodes {
break; break;
} }
default: default:
throw new AssertError("Invalid opcode "+opcode); throw new InternalError("Invalid opcode "+opcode);
} }
} catch (InvocationTargetException ex) { } catch (InvocationTargetException ex) {
iter = null; iter = null;

@ -18,7 +18,6 @@
*/ */
package jode.jvm; package jode.jvm;
import jode.AssertError;
import jode.bytecode.Reference; import jode.bytecode.Reference;
import jode.bytecode.TypeSignature; import jode.bytecode.TypeSignature;

@ -269,6 +269,9 @@ public class SyntheticAnalyzer implements Opcodes {
if ((refField.getModifiers() & modifierMask) != 0) if ((refField.getModifiers() & modifierMask) != 0)
return false; return false;
if (dupSeen) { if (dupSeen) {
if (!iter.hasNext())
return false;
instr = (Instruction) iter.next();
if (instr.getOpcode() < opc_ireturn if (instr.getOpcode() < opc_ireturn
|| instr.getOpcode() > opc_areturn) || instr.getOpcode() > opc_areturn)
return false; return false;

@ -18,7 +18,6 @@
*/ */
package jode.obfuscator; package jode.obfuscator;
import jode.AssertError;
import jode.GlobalOptions; import jode.GlobalOptions;
import jode.bytecode.*; import jode.bytecode.*;
@ -173,7 +172,7 @@ public class MethodIdentifier extends Identifier implements Opcodes {
boolean wasTransformed = false; boolean wasTransformed = false;
public void doTransformations() { public void doTransformations() {
if (wasTransformed) if (wasTransformed)
throw new jode.AssertError throw new InternalError
("doTransformation called on transformed method"); ("doTransformation called on transformed method");
wasTransformed = true; wasTransformed = true;
info.setName(getAlias()); info.setName(getAlias());

@ -19,7 +19,6 @@
package jode.obfuscator.modules; package jode.obfuscator.modules;
import jode.AssertError;
import jode.GlobalOptions; import jode.GlobalOptions;
import jode.bytecode.*; import jode.bytecode.*;
import jode.jvm.InterpreterException; import jode.jvm.InterpreterException;
@ -459,10 +458,10 @@ public class ConstantAnalyzer implements Opcodes, CodeAnalyzer {
for (int i=0; i < locals.length; i++) for (int i=0; i < locals.length; i++)
mergeOneLocal(i, other.locals[i]); mergeOneLocal(i, other.locals[i]);
if (stack.length != other.stack.length) if (stack.length != other.stack.length)
throw new jode.AssertError("stack length differs"); throw new InternalError("stack length differs");
for (int i=0; i < stack.length; i++) { for (int i=0; i < stack.length; i++) {
if ((other.stack[i] == null) != (stack[i] == null)) if ((other.stack[i] == null) != (stack[i] == null))
throw new jode.AssertError("stack types differ"); throw new InternalError("stack types differ");
else if (stack[i] != null) else if (stack[i] != null)
stack[i].merge(other.stack[i]); stack[i].merge(other.stack[i]);
} }
@ -1183,7 +1182,7 @@ public class ConstantAnalyzer implements Opcodes, CodeAnalyzer {
% ((Double)value2.value).doubleValue()); % ((Double)value2.value).doubleValue());
break; break;
default: default:
throw new jode.AssertError("Can't happen."); throw new InternalError("Can't happen.");
} }
ConstantInfo constInfo = new ConstantInfo(CONSTANT, newValue); ConstantInfo constInfo = new ConstantInfo(CONSTANT, newValue);
constantInfos.put(instr, constInfo); constantInfos.put(instr, constInfo);
@ -1218,7 +1217,7 @@ public class ConstantAnalyzer implements Opcodes, CodeAnalyzer {
(- ((Double)value.value).doubleValue()); (- ((Double)value.value).doubleValue());
break; break;
default: default:
throw new jode.AssertError("Can't happen."); throw new InternalError("Can't happen.");
} }
ConstantInfo constInfo = new ConstantInfo(CONSTANT, newValue); ConstantInfo constInfo = new ConstantInfo(CONSTANT, newValue);
constantInfos.put(instr, constInfo); constantInfos.put(instr, constInfo);
@ -1271,7 +1270,7 @@ public class ConstantAnalyzer implements Opcodes, CodeAnalyzer {
>>> ((Integer)value2.value).intValue()); >>> ((Integer)value2.value).intValue());
break; break;
default: default:
throw new jode.AssertError("Can't happen."); throw new InternalError("Can't happen.");
} }
ConstantInfo constInfo = new ConstantInfo(CONSTANT, newValue); ConstantInfo constInfo = new ConstantInfo(CONSTANT, newValue);
constantInfos.put(instr, constInfo); constantInfos.put(instr, constInfo);
@ -1316,7 +1315,7 @@ public class ConstantAnalyzer implements Opcodes, CodeAnalyzer {
newVal = new Double(((Number)stack.value).doubleValue()); newVal = new Double(((Number)stack.value).doubleValue());
break; break;
default: default:
throw new jode.AssertError("Can't happen."); throw new InternalError("Can't happen.");
} }
ConstantInfo constInfo = new ConstantInfo(CONSTANT, newVal); ConstantInfo constInfo = new ConstantInfo(CONSTANT, newVal);
constantInfos.put(instr, constInfo); constantInfos.put(instr, constInfo);
@ -1749,7 +1748,7 @@ public class ConstantAnalyzer implements Opcodes, CodeAnalyzer {
+ opc_pop - 1)); + opc_pop - 1));
} }
default: default:
throw new AssertError("Unexpected opcode"); throw new InternalError("Unexpected opcode");
} }
if (replacement != null) if (replacement != null)
newCode.add(replacement); newCode.add(replacement);

@ -21,7 +21,6 @@ package jode.obfuscator.modules;
import java.util.*; import java.util.*;
import jode.bytecode.*; import jode.bytecode.*;
import jode.obfuscator.*; import jode.obfuscator.*;
import jode.AssertError;
import jode.GlobalOptions; import jode.GlobalOptions;
///#def COLLECTIONS java.util ///#def COLLECTIONS java.util
@ -302,7 +301,7 @@ public class LocalOptimizer implements Opcodes, CodeTransformer {
break; break;
default: default:
throw new AssertError throw new InternalError
("Illegal opcode for SlotInstruction"); ("Illegal opcode for SlotInstruction");
} }
} }
@ -512,14 +511,14 @@ public class LocalOptimizer implements Opcodes, CodeTransformer {
* it is possible to do something else * it is possible to do something else
* before putting the ret address into a * before putting the ret address into a
* local. */ * local. */
throw new AssertError("Non standard jsr"); throw new InternalError("Non standard jsr");
} }
InstrInfo retInfo = info.nextInfo.nextReads InstrInfo retInfo = info.nextInfo.nextReads
[info.instr.getLocalSlot()]; [info.instr.getLocalSlot()];
if (retInfo != null) { if (retInfo != null) {
if (retInfo.instr.getOpcode() != opc_ret) if (retInfo.instr.getOpcode() != opc_ret)
throw new AssertError throw new InternalError
("reading return address"); ("reading return address");
info.retInfo = retInfo; info.retInfo = retInfo;

@ -20,7 +20,6 @@
package jode.obfuscator.modules; package jode.obfuscator.modules;
import jode.bytecode.*; import jode.bytecode.*;
import jode.obfuscator.*; import jode.obfuscator.*;
import jode.AssertError;
import jode.GlobalOptions; import jode.GlobalOptions;
import java.util.BitSet; import java.util.BitSet;
@ -498,7 +497,7 @@ public class RemovePopAnalyzer implements CodeTransformer, Opcodes {
case opc_ldc2_w: case opc_ldc2_w:
case opc_lload: case opc_dload: case opc_lload: case opc_dload:
if (!push_all_popped) if (!push_all_popped)
throw new AssertError("pop half of a long"); throw new InternalError("pop half of a long");
poppedEntries[--stackDepth] = false; poppedEntries[--stackDepth] = false;
poppedEntries[--stackDepth] = false; poppedEntries[--stackDepth] = false;
continue; continue;
@ -543,7 +542,7 @@ public class RemovePopAnalyzer implements CodeTransformer, Opcodes {
case opc_multianewarray: case opc_multianewarray:
if (!push_all_popped) if (!push_all_popped)
throw new AssertError("pop half of a long"); throw new InternalError("pop half of a long");
if (poppush[0] < poppush[1]) { if (poppush[0] < poppush[1]) {
for (int j=0; j < poppush[0] - poppush[1]; j++) for (int j=0; j < poppush[0] - poppush[1]; j++)
poppedEntries[stackDepth++] = true; poppedEntries[stackDepth++] = true;
@ -558,7 +557,7 @@ public class RemovePopAnalyzer implements CodeTransformer, Opcodes {
case opc_invokeinterface: case opc_invokeinterface:
case opc_checkcast: case opc_checkcast:
if (!push_all_popped) if (!push_all_popped)
throw new AssertError("pop half of a long"); throw new InternalError("pop half of a long");
if (poppush[1] == 1) { if (poppush[1] == 1) {
poppedEntries[--stackDepth] = false; poppedEntries[--stackDepth] = false;
newInstructions newInstructions
@ -571,7 +570,7 @@ public class RemovePopAnalyzer implements CodeTransformer, Opcodes {
} }
newInstructions.addFirst(instr); newInstructions.addFirst(instr);
default: default:
throw new AssertError("Unexpected opcode!"); throw new InternalError("Unexpected opcode!");
} }
} else { } else {
// Add the instruction .. // Add the instruction ..

@ -247,7 +247,14 @@ public abstract class ClassType extends ReferenceType {
* @return the middle type, or null if it is not necessary. * @return the middle type, or null if it is not necessary.
*/ */
public Type getCastHelper(Type fromType) { public Type getCastHelper(Type fromType) {
if (fromType.getHint().isSubTypeOf(this)) if (isInterface() || fromType == tNull
|| (fromType instanceof RangeType
&& ((RangeType)fromType).getBottom() == tNull))
return null;
Type hint = fromType.getHint();
if (hint.isSubTypeOf(this)
|| (hint instanceof ClassType
&& ((ClassType) hint).isInterface()))
return null; return null;
return tObject; return tObject;
} }

@ -169,7 +169,7 @@ public class IntegerType extends Type {
case IT_I: case IT_I:
return "i"; return "i";
default: default:
throw new jode.AssertError("Local can't be of constant type!"); throw new InternalError("Local can't be of constant type!");
} }
} }

@ -56,7 +56,7 @@ public class MultiClassType extends ReferenceType {
/* We don't implement the set of types, that are castable to some /* We don't implement the set of types, that are castable to some
* of the given classes or interfaces. * of the given classes or interfaces.
*/ */
throw new jode.AssertError throw new InternalError
("getSubType called on set of classes and interfaces!"); ("getSubType called on set of classes and interfaces!");
} }

@ -18,7 +18,6 @@
*/ */
package jode.type; package jode.type;
import jode.AssertError;
import java.util.Stack; import java.util.Stack;
///#def COLLECTIONEXTRA java.lang ///#def COLLECTIONEXTRA java.lang
import java.lang.UnsupportedOperationException; import java.lang.UnsupportedOperationException;

@ -18,7 +18,6 @@
*/ */
package jode.type; package jode.type;
import jode.AssertError;
import jode.GlobalOptions; import jode.GlobalOptions;
import java.util.Hashtable; import java.util.Hashtable;
@ -80,7 +79,7 @@ public class RangeType extends Type {
ReferenceType topType) { ReferenceType topType) {
super(TC_RANGE); super(TC_RANGE);
if (bottomType == tNull) if (bottomType == tNull)
throw new jode.AssertError("bottom is NULL"); throw new InternalError("bottom is NULL");
this.bottomType = bottomType; this.bottomType = bottomType;
this.topType = topType; this.topType = topType;
} }
@ -177,7 +176,7 @@ public class RangeType extends Type {
} }
public String getDefaultName() { public String getDefaultName() {
throw new AssertError("getDefaultName() called on range"); throw new InternalError("getDefaultName() called on range");
} }
public int hashCode() { public int hashCode() {

@ -18,7 +18,6 @@
*/ */
package jode.type; package jode.type;
import jode.AssertError;
import jode.GlobalOptions; import jode.GlobalOptions;
import jode.bytecode.ClassPath; import jode.bytecode.ClassPath;
import jode.bytecode.ClassInfo; import jode.bytecode.ClassInfo;
@ -244,7 +243,7 @@ public class Type {
case '(': case '(':
return tMethod(cp, type); return tMethod(cp, type);
} }
throw new AssertError("Unknown type signature: "+type); throw new InternalError("Unknown type signature: "+type);
} }
/** /**
@ -600,7 +599,7 @@ public class Type {
case TC_DOUBLE: case TC_DOUBLE:
return Double.TYPE; return Double.TYPE;
default: default:
throw new AssertError("getTypeClass() called on illegal type"); throw new InternalError("getTypeClass() called on illegal type");
} }
} }

@ -64,7 +64,7 @@ public class SimpleSet extends AbstractSet implements Cloneable
other.elementObjects = (Object[]) elementObjects.clone(); other.elementObjects = (Object[]) elementObjects.clone();
return other; return other;
} catch (CloneNotSupportedException ex) { } catch (CloneNotSupportedException ex) {
throw new jode.AssertError("Clone?"); throw new InternalError("Clone?");
} }
} }

Loading…
Cancel
Save