On 22:52 Wed 08 Dec , Pekka Enberg wrote: > 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 > >
I've fixed the Classpath version using the gcj version as above. -- Andrew :) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) Support Free Java! Contribute to GNU Classpath and IcedTea http://www.gnu.org/software/classpath http://icedtea.classpath.org PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint = F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8