Quellcode durchsuchen

329111

tags/V1_6_11M1
aclement vor 13 Jahren
Ursprung
Commit
118f91d2a1

+ 5
- 0
asm/src/org/aspectj/asm/IProgramElement.java Datei anzeigen

@@ -389,6 +389,10 @@ public interface IProgramElement extends Serializable {
return name.startsWith("declare parents");
}

public boolean isDeclareSoft() {
return name.startsWith("declare soft");
}

// The 4 declarations below are necessary for serialization
private static int nextOrdinal = 0;
private final int ordinal = nextOrdinal++;
@@ -400,6 +404,7 @@ public interface IProgramElement extends Serializable {
public boolean isPackageDeclaration() {
return this == PACKAGE_DECLARATION;
}

}

public void setAnnotationStyleDeclaration(boolean b);

+ 52
- 51
asm/src/org/aspectj/asm/internal/JDTLikeHandleProvider.java Datei anzeigen

@@ -187,26 +187,13 @@ public class JDTLikeHandleProvider implements IElementHandleProvider {
return CharOperation.concat(countDelim, new Integer(count).toString().toCharArray());
}
} else if (ipe.getKind().isDeclareAnnotation()) {
// look at peer declares
int count = 1;
for (IProgramElement object : ipe.getParent().getChildren()) {
if (object.equals(ipe)) {
break;
}
if (object.getKind() == ipe.getKind()) {
if (object.getKind().toString().equals(ipe.getKind().toString())) {
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;
}
}
}
}
int count = computeCountBasedOnPeers(ipe);
if (count > 1) {
return CharOperation.concat(countDelim, new Integer(count).toString().toCharArray());
}
} else if (ipe.getKind().isDeclareSoft()) {
// look at peer declares
int count = computeCountBasedOnPeers(ipe);
if (count > 1) {
return CharOperation.concat(countDelim, new Integer(count).toString().toCharArray());
}
@@ -222,22 +209,7 @@ public class JDTLikeHandleProvider implements IElementHandleProvider {
String ipeSig = ipe.getBytecodeSignature();
// remove return type from the signature - it should not be included in the comparison
int idx = 0;
if (ipeSig != null && ((idx = ipeSig.indexOf(")")) != -1)) {
ipeSig = ipeSig.substring(0, idx);
}
if (ipeSig != null) {
if (ipeSig.indexOf("Lorg/aspectj/lang") != -1) {
if (ipeSig.endsWith("Lorg/aspectj/lang/JoinPoint$StaticPart;")) {
ipeSig = ipeSig.substring(0, ipeSig.lastIndexOf("Lorg/aspectj/lang/JoinPoint$StaticPart;"));
}
if (ipeSig.endsWith("Lorg/aspectj/lang/JoinPoint;")) {
ipeSig = ipeSig.substring(0, ipeSig.lastIndexOf("Lorg/aspectj/lang/JoinPoint;"));
}
if (ipeSig.endsWith("Lorg/aspectj/lang/JoinPoint$StaticPart;")) {
ipeSig = ipeSig.substring(0, ipeSig.lastIndexOf("Lorg/aspectj/lang/JoinPoint$StaticPart;"));
}
}
}
ipeSig = shortenIpeSig(ipeSig);
for (IProgramElement object : kids) {
if (object.equals(ipe)) {
break;
@@ -289,22 +261,7 @@ public class JDTLikeHandleProvider implements IElementHandleProvider {
String ipeSig = ipe.getBytecodeSignature();
// remove return type from the signature - it should not be included in the comparison
int idx = 0;
if (ipeSig != null && ((idx = ipeSig.indexOf(")")) != -1)) {
ipeSig = ipeSig.substring(0, idx);
}
if (ipeSig != null) {
if (ipeSig.indexOf("Lorg/aspectj/lang") != -1) {
if (ipeSig.endsWith("Lorg/aspectj/lang/JoinPoint$StaticPart;")) {
ipeSig = ipeSig.substring(0, ipeSig.lastIndexOf("Lorg/aspectj/lang/JoinPoint$StaticPart;"));
}
if (ipeSig.endsWith("Lorg/aspectj/lang/JoinPoint;")) {
ipeSig = ipeSig.substring(0, ipeSig.lastIndexOf("Lorg/aspectj/lang/JoinPoint;"));
}
if (ipeSig.endsWith("Lorg/aspectj/lang/JoinPoint$StaticPart;")) {
ipeSig = ipeSig.substring(0, ipeSig.lastIndexOf("Lorg/aspectj/lang/JoinPoint$StaticPart;"));
}
}
}
ipeSig = shortenIpeSig(ipeSig);
for (IProgramElement object : kids) {
if (object.equals(ipe)) {
break;
@@ -407,6 +364,50 @@ public class JDTLikeHandleProvider implements IElementHandleProvider {
return empty;
}

private String shortenIpeSig(String ipeSig) {
int idx;
if (ipeSig != null && ((idx = ipeSig.indexOf(")")) != -1)) {
ipeSig = ipeSig.substring(0, idx);
}
if (ipeSig != null) {
if (ipeSig.indexOf("Lorg/aspectj/lang") != -1) {
if (ipeSig.endsWith("Lorg/aspectj/lang/JoinPoint$StaticPart;")) {
ipeSig = ipeSig.substring(0, ipeSig.lastIndexOf("Lorg/aspectj/lang/JoinPoint$StaticPart;"));
}
if (ipeSig.endsWith("Lorg/aspectj/lang/JoinPoint;")) {
ipeSig = ipeSig.substring(0, ipeSig.lastIndexOf("Lorg/aspectj/lang/JoinPoint;"));
}
if (ipeSig.endsWith("Lorg/aspectj/lang/JoinPoint$StaticPart;")) {
ipeSig = ipeSig.substring(0, ipeSig.lastIndexOf("Lorg/aspectj/lang/JoinPoint$StaticPart;"));
}
}
}
return ipeSig;
}

private int computeCountBasedOnPeers(IProgramElement ipe) {
int count = 1;
for (IProgramElement object : ipe.getParent().getChildren()) {
if (object.equals(ipe)) {
break;
}
if (object.getKind() == ipe.getKind()) {
if (object.getKind().toString().equals(ipe.getKind().toString())) {
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;
}
}
}
}
}
return count;
}

/**
* Only returns the count if it's not equal to 1
*/

Laden…
Abbrechen
Speichern