From b00b9012ff91b2559de635ad9d14d871b5c093c1 Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 9 Apr 1999 07:59:19 +0000 Subject: [PATCH] getTypeClass git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@523 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/type/ClassInterfacesType.java | 9 +++++++++ jode/jode/type/IntegerType.java | 16 ++++++++++++++++ jode/jode/type/RangeType.java | 7 +++++++ 3 files changed, 32 insertions(+) diff --git a/jode/jode/type/ClassInterfacesType.java b/jode/jode/type/ClassInterfacesType.java index 28c76de..76561fa 100644 --- a/jode/jode/type/ClassInterfacesType.java +++ b/jode/jode/type/ClassInterfacesType.java @@ -397,6 +397,15 @@ public class ClassInterfacesType extends ReferenceType { return "Ljava/lang/Object;"; } + public Class getTypeClass() throws ClassNotFoundException { + if (clazz != null) + return Class.forName(clazz.getName()); + else if (ifaces.length > 0) + return Class.forName(ifaces[0].getName()); + else + return Class.forName("java.lang.Object"); + } + public String toString() { if (this == tObject) diff --git a/jode/jode/type/IntegerType.java b/jode/jode/type/IntegerType.java index bd38e2f..ecc4367 100644 --- a/jode/jode/type/IntegerType.java +++ b/jode/jode/type/IntegerType.java @@ -163,6 +163,22 @@ public class IntegerType extends Type { } } + public Class getTypeClass() { + switch (((IntegerType)getHint()).possTypes) { + case IT_Z: + return Boolean.TYPE; + case IT_C: + return Character.TYPE; + case IT_B: + return Byte.TYPE; + case IT_S: + return Short.TYPE; + case IT_I: + default: + return Integer.TYPE; + } + } + public String toString() { switch (possTypes) { case IT_Z: diff --git a/jode/jode/type/RangeType.java b/jode/jode/type/RangeType.java index 7e21573..1ff85a9 100644 --- a/jode/jode/type/RangeType.java +++ b/jode/jode/type/RangeType.java @@ -122,6 +122,13 @@ public class RangeType extends Type { return bottomType.getTypeSignature(); } + public Class getTypeClass() throws ClassNotFoundException { + if (topType.isClassType() || !bottomType.isValidType()) + return topType.getTypeClass(); + else + return bottomType.getTypeClass(); + } + public String toString() { if (topType == tNull)