re PR libgcj/35020 (Class.getSimpleName() differs from Sun Java)

2008-05-22  Andrew Haley  <aph@redhat.com>

	PR libgcj/35020
	* java/lang/Class.java (getSimpleName): Replace incorrect use of
	String.lastIndexOf(String, int) with String.substring.
	* testsuite/libjava.lang/PR35020.java: New file.
	* testsuite/libjava.lang/PR35020.out: New file.

From-SVN: r135801
This commit is contained in:
Andrew Haley 2008-05-23 13:04:18 +00:00 committed by Andrew Haley
parent 833248d2d0
commit cf38a465ec
7 changed files with 39 additions and 2 deletions
libjava/java/lang

View file

@ -1090,10 +1090,12 @@ public final class Class<T>
++pos;
while (Character.isDigit(fullName.charAt(pos)))
++pos;
fullName = fullName.substring(pos);
}
int packagePos = fullName.lastIndexOf(".", pos);
int packagePos = fullName.lastIndexOf(".");
if (packagePos == -1)
return fullName.substring(pos);
return fullName;
else
return fullName.substring(packagePos + 1);
}