aboutsummaryrefslogtreecommitdiffstats
path: root/asm
diff options
context:
space:
mode:
authoraclement <aclement>2008-09-17 17:15:37 +0000
committeraclement <aclement>2008-09-17 17:15:37 +0000
commit577a8fc01fa9d69b8afa8aaf09e0d511b8cb7338 (patch)
tree23fae8010c273e33eb8792bc17619ca22c293d8a /asm
parent3da59f2a4d5f426b2b34335076d8a2c06d74914e (diff)
downloadaspectj-577a8fc01fa9d69b8afa8aaf09e0d511b8cb7338.tar.gz
aspectj-577a8fc01fa9d69b8afa8aaf09e0d511b8cb7338.zip
more jdt like handle fixes
Diffstat (limited to 'asm')
-rw-r--r--asm/src/org/aspectj/asm/internal/JDTLikeHandleProvider.java36
1 files changed, 27 insertions, 9 deletions
diff --git a/asm/src/org/aspectj/asm/internal/JDTLikeHandleProvider.java b/asm/src/org/aspectj/asm/internal/JDTLikeHandleProvider.java
index 26a64df60..ddd10ddf9 100644
--- a/asm/src/org/aspectj/asm/internal/JDTLikeHandleProvider.java
+++ b/asm/src/org/aspectj/asm/internal/JDTLikeHandleProvider.java
@@ -143,16 +143,34 @@ public class JDTLikeHandleProvider implements IElementHandleProvider {
index + 1, byteCodeName.length));
}
} else if (ipe.getKind().equals(IProgramElement.Kind.ADVICE)) {
- int lastDollar = CharOperation.lastIndexOf('$', byteCodeName);
- if (lastDollar != -1) {
- char[] upToDollar = CharOperation.subarray(byteCodeName, 0,
- lastDollar);
- int secondToLastDollar = CharOperation.lastIndexOf('$',
- upToDollar);
- if (secondToLastDollar != -1) {
- return convertCount(CharOperation.subarray(upToDollar,
- secondToLastDollar + 1, upToDollar.length));
+ // depends on previous children
+ int count = 1;
+ List kids = ipe.getParent().getChildren();
+ String ipeSig = ipe.getBytecodeSignature();
+ for (Iterator iterator = kids.iterator(); iterator.hasNext();) {
+ IProgramElement object = (IProgramElement) iterator.next();
+ if (object.equals(ipe)) {
+ break;
}
+ if (object.getKind()==ipe.getKind()) {
+ if (object.getName().equals(ipe.getName())) {
+ String sig1 = object.getBytecodeSignature();
+ if (sig1==null && ipeSig==null || sig1.equals(ipeSig)) {
+ String existingHandle = object.getHandleIdentifier();
+ int suffixPosition = existingHandle.indexOf('!');
+ if (suffixPosition!=-1) {
+ count = new Integer(existingHandle.substring(suffixPosition+1)).intValue()+1;
+ } else {
+ if (count==1) {
+ count = 2;
+ }
+ }
+ }
+ }
+ }
+ }
+ if (count>1) {
+ return CharOperation.concat(countDelim, new Integer(count).toString().toCharArray());
}
} else if (ipe.getKind().equals(IProgramElement.Kind.INITIALIZER)) {
return String.valueOf(++initializerCounter).toCharArray();