*** empty log message ***

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@258 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 788a6f40da
commit 7080788ef4
  1. 17
      jode/jode/type/RangeType.java
  2. 26
      jode/jode/type/Type.java

@ -82,14 +82,23 @@ public class RangeType extends Type {
*/ */
public void useType() { public void useType() {
/* The topType will be printed */ /* The topType will be printed */
if (topType.isClassType() || bottomType == tUnknown) if (topType.isClassType() || !bottomType.isValidType())
topType.useType(); topType.useType();
else else
bottomType.useType(); bottomType.useType();
} }
/**
* Checks if we need to cast to a middle type, before we can cast from
* fromType to this type.
* @return the middle type, or null if it is not necessary.
*/
public Type getCastHelper(Type fromType) {
return topType.getCastHelper(fromType);
}
public String getTypeSignature() { public String getTypeSignature() {
if (topType.isClassType() || bottomType == tUnknown) if (topType.isClassType() || !bottomType.isValidType())
return topType.getTypeSignature(); return topType.getTypeSignature();
else else
return bottomType.getTypeSignature(); return bottomType.getTypeSignature();
@ -99,14 +108,14 @@ public class RangeType extends Type {
{ {
if (jode.Decompiler.isTypeDebugging) if (jode.Decompiler.isTypeDebugging)
return "<" + bottomType + "-" + topType + ">"; return "<" + bottomType + "-" + topType + ">";
if (topType.isClassType() || bottomType == tUnknown) if (topType.isClassType() || !bottomType.isValidType())
return topType.toString(); return topType.toString();
else else
return bottomType.toString(); return bottomType.toString();
} }
public String getDefaultName() { public String getDefaultName() {
if (topType.isClassType() || bottomType == tUnknown) if (topType.isClassType() || !bottomType.isValidType())
return topType.getDefaultName(); return topType.getDefaultName();
else else
return bottomType.getDefaultName(); return bottomType.getDefaultName();

@ -48,7 +48,10 @@ import java.util.Hashtable;
* *
* Note that tUnknown is no valid type, so we can replace * Note that tUnknown is no valid type, so we can replace
* <tUnknown, byte> with <int, byte> * <tUnknown, byte> with <int, byte>
* <tUnknown, tArray> with <tObject, tArray> * <tUnknown, tArray> with <tObject, tArray>, <br>
*
* Arrays extend Object and implement java.lang.Cloneable and
* java.io.Serializable, as defined in jls.
* *
* The main operation on a type range is the intersection. To do this * The main operation on a type range is the intersection. To do this
* on class ranges we need three more operations: specialization, * on class ranges we need three more operations: specialization,
@ -85,7 +88,6 @@ public class Type {
public static final int TC_RANGE = 103; public static final int TC_RANGE = 103;
public static final int TC_BOOLBYTE = 105; public static final int TC_BOOLBYTE = 105;
public static final int TC_BOOLINT = 106; public static final int TC_BOOLINT = 106;
public static final int TC_UCLASS = 107;
protected static JodeEnvironment env; protected static JodeEnvironment env;
@ -143,6 +145,7 @@ public class Type {
return tClass(type.substring(1, index)); return tClass(type.substring(1, index));
} }
throw new AssertError("Unknown type signature: "+type); throw new AssertError("Unknown type signature: "+type);
} }
public static final Type tClass(String clazzname) { public static final Type tClass(String clazzname) {
@ -416,6 +419,25 @@ public class Type {
return result; return result;
} }
/**
* Checks if we need to cast to a middle type, before we can cast from
* fromType to this type.
* @return the middle type, or null if it is not necessary.
*/
public Type getCastHelper(Type fromType) {
return null;
}
/**
* Checks if this type represents a valid type instead of a list
* of minimum types.
*/
public boolean isValidType() {
return typecode <= TC_DOUBLE
|| typecode == TC_BOOLBYTE
|| typecode == TC_BOOLINT;
}
/** /**
* Checks if this type represents a class or an array of a class * Checks if this type represents a class or an array of a class
*/ */

Loading…
Cancel
Save