From fbdef36ed88280fb792347661ea017bd643e9ef1 Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 9 Feb 1999 01:50:07 +0000 Subject: [PATCH] getTypeSignature git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@240 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/type/ArrayType.java | 4 ++++ jode/jode/type/ClassInterfacesType.java | 9 +++++++++ jode/jode/type/MethodType.java | 4 ++++ jode/jode/type/RangeType.java | 7 +++++++ jode/jode/type/Type.java | 26 +++++++++++++++++++++++++ 5 files changed, 50 insertions(+) diff --git a/jode/jode/type/ArrayType.java b/jode/jode/type/ArrayType.java index 37eb4fd..d7357e1 100644 --- a/jode/jode/type/ArrayType.java +++ b/jode/jode/type/ArrayType.java @@ -112,6 +112,10 @@ public class ArrayType extends Type { elementType.useType(); } + public String getTypeSignature() { + return "["+elementType.getTypeSignature(); + } + public String toString() { return elementType.toString()+"[]"; } diff --git a/jode/jode/type/ClassInterfacesType.java b/jode/jode/type/ClassInterfacesType.java index 8cf3941..1fb01aa 100644 --- a/jode/jode/type/ClassInterfacesType.java +++ b/jode/jode/type/ClassInterfacesType.java @@ -385,6 +385,15 @@ public class ClassInterfacesType extends Type { } } + public String getTypeSignature() { + if (clazz != null) + return "L" + clazz.getName().replace('.','/') + ";"; + else if (ifaces.length > 0) + return "L" + ifaces[0].getName().replace('.','/') + ";"; + else + return "Ljava/lang/Object;"; + } + public String toString() { if (jode.Decompiler.isTypeDebugging) { diff --git a/jode/jode/type/MethodType.java b/jode/jode/type/MethodType.java index ee9dbd1..2e108cf 100644 --- a/jode/jode/type/MethodType.java +++ b/jode/jode/type/MethodType.java @@ -70,6 +70,10 @@ public class MethodType { return returnType; } + public String getTypeSignature() { + return signature; + } + public String toString() { return signature; } diff --git a/jode/jode/type/RangeType.java b/jode/jode/type/RangeType.java index 0c3f962..7be4b60 100644 --- a/jode/jode/type/RangeType.java +++ b/jode/jode/type/RangeType.java @@ -88,6 +88,13 @@ public class RangeType extends Type { bottomType.useType(); } + public String getTypeSignature() { + if (topType.isClassType() || bottomType == tUnknown) + return topType.getTypeSignature(); + else + return bottomType.getTypeSignature(); + } + public String toString() { if (jode.Decompiler.isTypeDebugging) diff --git a/jode/jode/type/Type.java b/jode/jode/type/Type.java index 56097e4..e815850 100644 --- a/jode/jode/type/Type.java +++ b/jode/jode/type/Type.java @@ -110,6 +110,7 @@ public class Type { public static final Type tUObject = tRange(tObject, tUnknown); public static final Type tString = tClass("java.lang.String"); public static final Type tStringBuffer = tClass("java.lang.StringBuffer"); + public static final Type tJavaLangClass = tClass("java.lang.Class"); public static final Type tType(String type) { if (type == null || type.length() == 0) @@ -465,6 +466,31 @@ public class Type { } } + public String getTypeSignature() { + switch (typecode) { + case TC_BOOLINT: + case TC_BOOLBYTE: + case TC_BOOLEAN: + return "Z"; + case TC_BYTE: + return "B"; + case TC_CHAR: + return "C"; + case TC_SHORT: + return "S"; + case TC_INT: + return "I"; + case TC_LONG: + return "J"; + case TC_FLOAT: + return "F"; + case TC_DOUBLE: + return "D"; + default: + return "?"; + } + } + public String toString() { switch (typecode) { case TC_BOOLINT: