diff options
author | Andrew Haley <aph@redhat.com> | 2008-05-23 13:04:18 +0000 |
---|---|---|
committer | Andrew Haley <aph@gcc.gnu.org> | 2008-05-23 13:04:18 +0000 |
commit | cf38a465eca401054b78e6182f0dced39418554b (patch) | |
tree | de028939d2784b099a5232cd9d023170c9fe58d1 /libjava | |
parent | 833248d2d006c5da4f654b5683ee88819a179e71 (diff) | |
download | gcc-cf38a465eca401054b78e6182f0dced39418554b.tar.gz |
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
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 8 | ||||
-rw-r--r-- | libjava/classpath/lib/java/lang/Class$1.class | bin | 677 -> 677 bytes | |||
-rw-r--r-- | libjava/classpath/lib/java/lang/Class.class | bin | 15581 -> 15551 bytes | |||
-rw-r--r-- | libjava/java/lang/Class.java | 6 | ||||
-rw-r--r-- | libjava/testsuite/libjava.lang/PR35020.jar | bin | 0 -> 1856 bytes | |||
-rw-r--r-- | libjava/testsuite/libjava.lang/PR35020.java | 21 | ||||
-rw-r--r-- | libjava/testsuite/libjava.lang/PR35020.out | 6 |
7 files changed, 39 insertions, 2 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 52061d2c1ed..37f12e2c892 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,6 +1,14 @@ 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 * java/lang/Class.java (getSimpleName): Import from GNU Classpath. 2008-05-20 David Daney <ddaney@avtrex.com> diff --git a/libjava/classpath/lib/java/lang/Class$1.class b/libjava/classpath/lib/java/lang/Class$1.class Binary files differindex 09e3e86f995..9c4806c0233 100644 --- a/libjava/classpath/lib/java/lang/Class$1.class +++ b/libjava/classpath/lib/java/lang/Class$1.class diff --git a/libjava/classpath/lib/java/lang/Class.class b/libjava/classpath/lib/java/lang/Class.class Binary files differindex bdcfcfe83bd..ce854558e54 100644 --- a/libjava/classpath/lib/java/lang/Class.class +++ b/libjava/classpath/lib/java/lang/Class.class diff --git a/libjava/java/lang/Class.java b/libjava/java/lang/Class.java index d59e83ea4ec..868e370b819 100644 --- a/libjava/java/lang/Class.java +++ b/libjava/java/lang/Class.java @@ -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); } diff --git a/libjava/testsuite/libjava.lang/PR35020.jar b/libjava/testsuite/libjava.lang/PR35020.jar Binary files differnew file mode 100644 index 00000000000..bedaed7ecdb --- /dev/null +++ b/libjava/testsuite/libjava.lang/PR35020.jar diff --git a/libjava/testsuite/libjava.lang/PR35020.java b/libjava/testsuite/libjava.lang/PR35020.java new file mode 100644 index 00000000000..1850da79683 --- /dev/null +++ b/libjava/testsuite/libjava.lang/PR35020.java @@ -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()); + } +} + diff --git a/libjava/testsuite/libjava.lang/PR35020.out b/libjava/testsuite/libjava.lang/PR35020.out new file mode 100644 index 00000000000..73eb0c917fc --- /dev/null +++ b/libjava/testsuite/libjava.lang/PR35020.out @@ -0,0 +1,6 @@ +inner +PR35020 +Class +int[] +Object[][][][][][][][] + |