diff options
author | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2012-02-19 12:41:47 +0000 |
---|---|---|
committer | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2012-02-19 12:41:47 +0000 |
commit | e50d7c0862acc66ca1d6b26ec126eb3ed5295d7d (patch) | |
tree | a469d5da08dc4ad80401739f827974606ac8621b /src/main | |
parent | 205b65d96c5fb9d0086eb98d31e21e927d79cf27 (diff) | |
download | javassist-e50d7c0862acc66ca1d6b26ec126eb3ed5295d7d.tar.gz javassist-e50d7c0862acc66ca1d6b26ec126eb3ed5295d7d.zip |
fixed JASSIST-152
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@615 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/javassist/bytecode/stackmap/TypeData.java | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/src/main/javassist/bytecode/stackmap/TypeData.java b/src/main/javassist/bytecode/stackmap/TypeData.java index 65ab226e..cef23211 100644 --- a/src/main/javassist/bytecode/stackmap/TypeData.java +++ b/src/main/javassist/bytecode/stackmap/TypeData.java @@ -284,7 +284,7 @@ public abstract class TypeData { } } - /* See also NullType.getExpected(). + /* See also {NullType,ArrayElement}.getExpected(). */ public String getExpected() throws BadBytecode { ArrayList equiv = equivalences; @@ -410,19 +410,38 @@ public abstract class TypeData { } public String getName() throws BadBytecode { - String name = array.getName(); + return getName2(array.getName()); + } + + private String getName2(String name) throws BadBytecode { if (name.length() > 1 && name.charAt(0) == '[') { char c = name.charAt(1); if (c == 'L') - return name.substring(2, name.length() - 1).replace('/', '.'); + return name.substring(2, name.length() - 1).replace('/', '.'); else if (c == '[') return name.substring(1); } - - throw new BadBytecode("bad array type for AALOAD: " + + if (array.isNullType()) + return "java.lang.Object"; + else + throw new BadBytecode("bad array type for AALOAD: " + name); } + public String getExpected() throws BadBytecode { + ArrayList equiv = equivalences; + if (equiv.size() == 1) + return getName2(array.getExpected()); // not getName(); + else { + String en = expectedName; + if (en == null) + return "java.lang.Object"; + else + return en; + } + } + public static String getArrayType(String elementType) { if (elementType.charAt(0) == '[') return "[" + elementType; |