This patch replaces VMClass#getSimpleName() implementation with JamVM's version that supposedly comes from GCJ. This fixes a compatibility problem found by Malva.
Signed-off-by: Pekka Enberg <penb...@kernel.org> --- vm/reference/java/lang/VMClass.java | 29 +++++++++++++++-------------- 1 files changed, 15 insertions(+), 14 deletions(-) diff --git a/vm/reference/java/lang/VMClass.java b/vm/reference/java/lang/VMClass.java index a0091c0..d80eecd 100644 --- a/vm/reference/java/lang/VMClass.java +++ b/vm/reference/java/lang/VMClass.java @@ -303,20 +303,21 @@ final class VMClass return getComponentType(klass).getSimpleName() + "[]"; } String fullName = getName(klass); - int pos = fullName.lastIndexOf("$"); - if (pos == -1) - pos = 0; - else - { - ++pos; - while (Character.isDigit(fullName.charAt(pos))) - ++pos; - } - int packagePos = fullName.lastIndexOf(".", pos); - if (packagePos == -1) - return fullName.substring(pos); - else - return fullName.substring(packagePos + 1); + Class enclosingClass = getEnclosingClass(klass); + if (enclosingClass == null) + // It's a top level class. + return fullName.substring(fullName.lastIndexOf(".") + 1); + + fullName = fullName.substring(enclosingClass.getName().length()); + + // We've carved off the enclosing class name; now we must have '$' + // followed optionally by digits, followed by the class name. + int pos = 1; + while (Character.isDigit(fullName.charAt(pos))) + ++pos; + fullName = fullName.substring(pos); + + return fullName; } /** -- 1.7.0.4