aboutsummaryrefslogtreecommitdiffstats
path: root/asm/src
diff options
context:
space:
mode:
authoraclement <aclement>2011-09-16 00:58:28 +0000
committeraclement <aclement>2011-09-16 00:58:28 +0000
commit7a17cff55ff7d19fcbce6246ae9ef036d639d8b7 (patch)
tree202cdfc09ba686941af064fec8430c7200ce9f1e /asm/src
parentfdca1771f01be020b9f8e1daec5726447d170d5e (diff)
downloadaspectj-7a17cff55ff7d19fcbce6246ae9ef036d639d8b7.tar.gz
aspectj-7a17cff55ff7d19fcbce6246ae9ef036d639d8b7.zip
351085
Diffstat (limited to 'asm/src')
-rw-r--r--asm/src/org/aspectj/asm/internal/ProgramElement.java39
1 files changed, 35 insertions, 4 deletions
diff --git a/asm/src/org/aspectj/asm/internal/ProgramElement.java b/asm/src/org/aspectj/asm/internal/ProgramElement.java
index b38a8286b..497b25028 100644
--- a/asm/src/org/aspectj/asm/internal/ProgramElement.java
+++ b/asm/src/org/aspectj/asm/internal/ProgramElement.java
@@ -493,11 +493,42 @@ public class ProgramElement implements IProgramElement {
if (getFullyQualifiedType) {
return returnType;
}
- int index = returnType.lastIndexOf(".");
- if (index != -1) {
- return returnType.substring(index + 1);
+ return trim(returnType);
+ }
+
+ /**
+ * Trim down fully qualified types to their short form (e.g. a.b.c.D<e.f.G> becomes D<G>)
+ */
+ public static String trim(String fqname) {
+ int i = fqname.indexOf("<");
+ if (i == -1) {
+ int lastdot = fqname.lastIndexOf('.');
+ if (lastdot == -1) {
+ return fqname;
+ } else {
+ return fqname.substring(lastdot + 1);
+ }
+ }
+ char[] charArray = fqname.toCharArray();
+ StringBuilder candidate = new StringBuilder(charArray.length);
+ StringBuilder complete = new StringBuilder(charArray.length);
+ for (char c : charArray) {
+ switch (c) {
+ case '.':
+ candidate.setLength(0);
+ break;
+ case '<':
+ case ',':
+ case '>':
+ complete.append(candidate).append(c);
+ candidate.setLength(0);
+ break;
+ default:
+ candidate.append(c);
+ }
}
- return returnType;
+ complete.append(candidate);
+ return complete.toString();
}
public String getName() {