diff options
author | Henning Heinold <heinold@inf.fu-berlin.de> | 2011-11-12 20:58:34 +0100 |
---|---|---|
committer | Henning Heinold <heinold@inf.fu-berlin.de> | 2011-11-26 23:41:44 +0100 |
commit | 57e069cde6617f00ca8834a82c6f360af43d5067 (patch) | |
tree | 48cbe15e96d217c45acfa64b0c13aad8c6424980 /recipes-core/classpath/classpath-0.98/SimpleName.diff | |
download | meta-java-57e069cde6617f00ca8834a82c6f360af43d5067.tar.gz |
meta-java: initial commit
* taken over mostly stuff from oe classic
* cleaned up recipes
* added license checksums
* bump icedtea6-native to 1.8.11
* use jamvm from git as native
Diffstat (limited to 'recipes-core/classpath/classpath-0.98/SimpleName.diff')
-rw-r--r-- | recipes-core/classpath/classpath-0.98/SimpleName.diff | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/recipes-core/classpath/classpath-0.98/SimpleName.diff b/recipes-core/classpath/classpath-0.98/SimpleName.diff new file mode 100644 index 0000000..ff2bec0 --- /dev/null +++ b/recipes-core/classpath/classpath-0.98/SimpleName.diff | |||
@@ -0,0 +1,66 @@ | |||
1 | Index: vm/reference/java/lang/VMClass.java | ||
2 | =================================================================== | ||
3 | RCS file: /sources/classpath/classpath/vm/reference/java/lang/VMClass.java,v | ||
4 | retrieving revision 1.20 | ||
5 | diff -u -r1.20 VMClass.java | ||
6 | --- vm/reference/java/lang/VMClass.java 18 Sep 2007 21:52:38 -0000 1.20 | ||
7 | +++ vm/reference/java/lang/VMClass.java 19 Apr 2008 15:19:00 -0000 | ||
8 | @@ -296,27 +296,43 @@ | ||
9 | */ | ||
10 | static String getSimpleName(Class klass) | ||
11 | { | ||
12 | + int arrayCount = 0; | ||
13 | + while (klass.isArray()) | ||
14 | + { | ||
15 | + klass = klass.getComponentType(); | ||
16 | + ++arrayCount; | ||
17 | + } | ||
18 | + // now klass is the component type | ||
19 | + | ||
20 | + String simpleComponentName = null; | ||
21 | if (isAnonymousClass(klass)) | ||
22 | - return ""; | ||
23 | - if (isArray(klass)) | ||
24 | { | ||
25 | - return getComponentType(klass).getSimpleName() + "[]"; | ||
26 | + simpleComponentName = ""; | ||
27 | } | ||
28 | - String fullName = getName(klass); | ||
29 | - int pos = fullName.lastIndexOf("$"); | ||
30 | - if (pos == -1) | ||
31 | - pos = 0; | ||
32 | else | ||
33 | { | ||
34 | - ++pos; | ||
35 | - while (Character.isDigit(fullName.charAt(pos))) | ||
36 | - ++pos; | ||
37 | + String fullName = getName(klass); | ||
38 | + int pos = fullName.lastIndexOf("$"); | ||
39 | + if (pos != -1) | ||
40 | + { //inner class or local class | ||
41 | + // skip digits of local classes | ||
42 | + while (Character.isDigit(fullName.charAt(pos+1))) | ||
43 | + pos++; | ||
44 | + } | ||
45 | + else | ||
46 | + { | ||
47 | + pos = fullName.lastIndexOf("."); | ||
48 | + } | ||
49 | + simpleComponentName = fullName.substring(pos+1); | ||
50 | } | ||
51 | - int packagePos = fullName.lastIndexOf(".", pos); | ||
52 | - if (packagePos == -1) | ||
53 | - return fullName.substring(pos); | ||
54 | - else | ||
55 | - return fullName.substring(packagePos + 1); | ||
56 | + | ||
57 | + if (arrayCount == 0) | ||
58 | + return simpleComponentName; | ||
59 | + | ||
60 | + StringBuffer sb = new StringBuffer(simpleComponentName); | ||
61 | + while (arrayCount-- > 0) | ||
62 | + sb.append("[]"); | ||
63 | + return sb.toString(); | ||
64 | } | ||
65 | |||
66 | /** | ||