From 5408e78f7cb49bc156085bcc7638afe437576dd2 Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 3 May 1999 10:50:27 +0000 Subject: [PATCH] internal representation changed git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@730 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/bytecode/Reference.java | 38 +++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/jode/jode/bytecode/Reference.java b/jode/jode/bytecode/Reference.java index fe19156..981b1f5 100644 --- a/jode/jode/bytecode/Reference.java +++ b/jode/jode/bytecode/Reference.java @@ -29,18 +29,15 @@ import java.util.*; */ public class Reference { /** - * The class info. + * The reference string. This is the class name, the member name and + * the member type, all separated by a space. */ - private final String className; + private final String sig; /** - * The member name. Don't make this a MethodInfo, since the clazz - * may not be readable. + * The position of the first and second space in the reference + * string. */ - private final String memberName; - /** - * The member type. - */ - private final String memberType; + private final int firstSpace, secondSpace; ///#ifdef JDK12 /// private static final Map references = new HashMap(); @@ -58,35 +55,38 @@ public class Reference { Reference reference = (Reference) references.get(sig); ///#endif if (reference == null) { - reference = new Reference(className, name, type); + sig = sig.intern(); + int firstSpace = className.length(); + int secondSpace = firstSpace + name.length() + 1; + reference = new Reference(sig, firstSpace, secondSpace); ///#ifdef JDK12 /// references.put(sig, new WeakReference(reference)); ///#else - references.put(reference, reference); + references.put(sig, reference); ///#endif } return reference; } - private Reference(String className, String name, String type) { - this.className = className.intern(); - this.memberName = name.intern(); - this.memberType = type.intern(); + private Reference(String sig, int first, int second) { + this.sig = sig; + this.firstSpace = first; + this.secondSpace = second; } public String getClazz() { - return className; + return sig.substring(0, firstSpace); } public String getName() { - return memberName; + return sig.substring(firstSpace + 1, secondSpace); } public String getType() { - return memberType; + return sig.substring(secondSpace + 1); } public String toString() { - return className + " " + memberName + " " + memberType; + return sig; } }