*** 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() {
/* The topType will be printed */
if (topType.isClassType() || bottomType == tUnknown)
if (topType.isClassType() || !bottomType.isValidType())
topType.useType();
else
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() {
if (topType.isClassType() || bottomType == tUnknown)
if (topType.isClassType() || !bottomType.isValidType())
return topType.getTypeSignature();
else
return bottomType.getTypeSignature();
@ -99,14 +108,14 @@ public class RangeType extends Type {
{
if (jode.Decompiler.isTypeDebugging)
return "<" + bottomType + "-" + topType + ">";
if (topType.isClassType() || bottomType == tUnknown)
if (topType.isClassType() || !bottomType.isValidType())
return topType.toString();
else
return bottomType.toString();
}
public String getDefaultName() {
if (topType.isClassType() || bottomType == tUnknown)
if (topType.isClassType() || !bottomType.isValidType())
return topType.getDefaultName();
else
return bottomType.getDefaultName();

@ -48,7 +48,10 @@ import java.util.Hashtable;
*
* Note that tUnknown is no valid type, so we can replace
* <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
* 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_BOOLBYTE = 105;
public static final int TC_BOOLINT = 106;
public static final int TC_UCLASS = 107;
protected static JodeEnvironment env;
@ -143,6 +145,7 @@ public class Type {
return tClass(type.substring(1, index));
}
throw new AssertError("Unknown type signature: "+type);
}
public static final Type tClass(String clazzname) {
@ -416,6 +419,25 @@ public class Type {
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
*/

Loading…
Cancel
Save