summaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2008-05-23 09:19:59 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2008-05-23 09:19:59 +0000
commit14fe89dbbbdfb8dd1b0211c508bf67bee8ff7eca (patch)
tree90d249c04b656468b1035211af60b276e9a62992 /libjava
parentef6304520b84aaf884d6ef65ca01226adf273b51 (diff)
downloadgcc-14fe89dbbbdfb8dd1b0211c508bf67bee8ff7eca.tar.gz
2008-05-22 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r135793 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@135794 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog5
-rw-r--r--libjava/classpath/lib/java/lang/Class$1.classbin677 -> 677 bytes
-rw-r--r--libjava/classpath/lib/java/lang/Class.classbin15647 -> 15581 bytes
-rw-r--r--libjava/java/lang/Class.java29
4 files changed, 22 insertions, 12 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index e8cd46e8947..52061d2c1ed 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,8 @@
+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>
PR libgcj/36252
diff --git a/libjava/classpath/lib/java/lang/Class$1.class b/libjava/classpath/lib/java/lang/Class$1.class
index 51ef8849385..09e3e86f995 100644
--- a/libjava/classpath/lib/java/lang/Class$1.class
+++ b/libjava/classpath/lib/java/lang/Class$1.class
Binary files differ
diff --git a/libjava/classpath/lib/java/lang/Class.class b/libjava/classpath/lib/java/lang/Class.class
index ffe072f5337..bdcfcfe83bd 100644
--- a/libjava/classpath/lib/java/lang/Class.class
+++ b/libjava/classpath/lib/java/lang/Class.class
Binary files differ
diff --git a/libjava/java/lang/Class.java b/libjava/java/lang/Class.java
index 691f983b0b5..d59e83ea4ec 100644
--- a/libjava/java/lang/Class.java
+++ b/libjava/java/lang/Class.java
@@ -1075,22 +1075,27 @@ public final class Class<T>
*/
public String getSimpleName()
{
- StringBuffer sb = new StringBuffer();
- Class klass = this;
- int arrayCount = 0;
- while (klass.isArray())
+ if (isAnonymousClass())
+ return "";
+ if (isArray())
{
- klass = klass.getComponentType();
- ++arrayCount;
+ return getComponentType().getSimpleName() + "[]";
}
- if (! klass.isAnonymousClass())
+ String fullName = getName();
+ int pos = fullName.lastIndexOf("$");
+ if (pos == -1)
+ pos = 0;
+ else
{
- String fullName = klass.getName();
- sb.append(fullName, fullName.lastIndexOf(".") + 1, fullName.length());
+ ++pos;
+ while (Character.isDigit(fullName.charAt(pos)))
+ ++pos;
}
- while (arrayCount-- > 0)
- sb.append("[]");
- return sb.toString();
+ int packagePos = fullName.lastIndexOf(".", pos);
+ if (packagePos == -1)
+ return fullName.substring(pos);
+ else
+ return fullName.substring(packagePos + 1);
}
/**