From 81e13e16c5d88e496cc20a6ce3fe8e7e341ae175 Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 6 Mar 1999 21:31:11 +0000 Subject: [PATCH] new hintType, will be later used to guess the type git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@300 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/type/RangeType.java | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/jode/jode/type/RangeType.java b/jode/jode/type/RangeType.java index 7c94fcc..955667c 100644 --- a/jode/jode/type/RangeType.java +++ b/jode/jode/type/RangeType.java @@ -29,17 +29,29 @@ import java.util.Hashtable; * null. It is always garanteed that topType is an Array or an Object * and that bottomType is null or an Array or an Object.

* + * The hintType gives a hint which type it probably is. It is used to + * generate the type declaration. + * * @author Jochen Hoenicke * @date 98/08/06 */ public class RangeType extends Type { final Type bottomType; final Type topType; + final Type hintType; + + public RangeType(Type bottomType, Type topType, Type hintType) { + super(TC_RANGE); + this.bottomType = bottomType; + this.topType = topType; + this.hintType = hintType; + } public RangeType(Type bottomType, Type topType) { super(TC_RANGE); this.bottomType = bottomType; this.topType = topType; + this.hintType = bottomType.isValidType() ? bottomType : topType; } public Type getBottom() { @@ -50,6 +62,10 @@ public class RangeType extends Type { return topType; } + public Type getHint() { + return hintType.getHint(); + } + /** * Create the type corresponding to the range from bottomType to this. * @param bottomType the start point of the range @@ -107,18 +123,17 @@ public class RangeType extends Type { public String toString() { if (jode.Decompiler.isTypeDebugging) - return "<" + bottomType + "-" + topType + ">"; - if (topType.isClassType() || !bottomType.isValidType()) - return topType.toString(); - else - return bottomType.toString(); + return "<" + bottomType + "-" + hintType + "-" + topType + ">"; + return hintType.toString(); } public String getDefaultName() { - if (topType.isClassType() || !bottomType.isValidType()) - return topType.getDefaultName(); - else - return bottomType.getDefaultName(); + return hintType.getDefaultName(); + } + + public int hashCode() { + int hashcode = topType.hashCode(); + return (hashcode << 16 | hashcode >>> 16) ^ bottomType.hashCode(); } public boolean equals(Object o) {