mirror of
https://gcc.gnu.org/git/gcc.git
synced 2025-01-23 12:54:42 +08:00
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:
parent
833248d2d0
commit
cf38a465ec
@ -1,3 +1,11 @@
|
||||
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.
|
||||
|
||||
2008-05-22 Andrew Haley <aph@redhat.com>
|
||||
|
||||
PR libgcj/35020
|
||||
|
Binary file not shown.
Binary file not shown.
@ -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);
|
||||
}
|
||||
|
BIN
libjava/testsuite/libjava.lang/PR35020.jar
Normal file
BIN
libjava/testsuite/libjava.lang/PR35020.jar
Normal file
Binary file not shown.
21
libjava/testsuite/libjava.lang/PR35020.java
Normal file
21
libjava/testsuite/libjava.lang/PR35020.java
Normal file
@ -0,0 +1,21 @@
|
||||
public class PR35020
|
||||
{
|
||||
class inner
|
||||
{
|
||||
}
|
||||
public static void main(String[] args)
|
||||
{
|
||||
System.out.println(inner.class.getSimpleName());
|
||||
System.out.println(PR35020.class.getSimpleName());
|
||||
System.out.println(Class.class.getSimpleName());
|
||||
System.out.println((new int[7]).getClass().getSimpleName());
|
||||
System.out.println((new Object[1][1][1][1][1][1][1][1]).getClass().getSimpleName());
|
||||
System.out.println((new java.security.PrivilegedAction()
|
||||
{
|
||||
public Object run() {
|
||||
return null;
|
||||
}
|
||||
}).getClass().getSimpleName());
|
||||
}
|
||||
}
|
||||
|
6
libjava/testsuite/libjava.lang/PR35020.out
Normal file
6
libjava/testsuite/libjava.lang/PR35020.out
Normal file
@ -0,0 +1,6 @@
|
||||
inner
|
||||
PR35020
|
||||
Class
|
||||
int[]
|
||||
Object[][][][][][][][]
|
||||
|
Loading…
Reference in New Issue
Block a user