OSDN Git Service

2008-05-22 Andrew Haley <aph@redhat.com>
authoraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 23 May 2008 13:04:18 +0000 (13:04 +0000)
committeraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 23 May 2008 13:04:18 +0000 (13:04 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@135801 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/classpath/lib/java/lang/Class$1.class
libjava/classpath/lib/java/lang/Class.class
libjava/java/lang/Class.java
libjava/testsuite/libjava.lang/PR35020.jar [new file with mode: 0644]
libjava/testsuite/libjava.lang/PR35020.java [new file with mode: 0644]
libjava/testsuite/libjava.lang/PR35020.out [new file with mode: 0644]

index 52061d2..37f12e2 100644 (file)
@@ -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>
index 09e3e86..9c4806c 100644 (file)
Binary files a/libjava/classpath/lib/java/lang/Class$1.class and b/libjava/classpath/lib/java/lang/Class$1.class differ
index bdcfcfe..ce85455 100644 (file)
Binary files a/libjava/classpath/lib/java/lang/Class.class and b/libjava/classpath/lib/java/lang/Class.class differ
index d59e83e..868e370 100644 (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);
   }
diff --git a/libjava/testsuite/libjava.lang/PR35020.jar b/libjava/testsuite/libjava.lang/PR35020.jar
new file mode 100644 (file)
index 0000000..bedaed7
Binary files /dev/null and b/libjava/testsuite/libjava.lang/PR35020.jar differ
diff --git a/libjava/testsuite/libjava.lang/PR35020.java b/libjava/testsuite/libjava.lang/PR35020.java
new file mode 100644 (file)
index 0000000..1850da7
--- /dev/null
@@ -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 (file)
index 0000000..73eb0c9
--- /dev/null
@@ -0,0 +1,6 @@
+inner
+PR35020
+Class
+int[]
+Object[][][][][][][][]
+