aboutsummaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authorAlexander Kriegisch <Alexander@Kriegisch.name>2023-06-25 12:22:34 +0200
committerAlexander Kriegisch <Alexander@Kriegisch.name>2023-06-26 13:48:27 +0700
commit00998fd4b23ad0d3e0cd292127297e0fb249c36f (patch)
treede661e764aaf7731b2af77df1aa2a00240200c50 /weaver
parentc0a48634088f7f894ab998dfcc5b7ccf7df88b42 (diff)
downloadaspectj-00998fd4b23ad0d3e0cd292127297e0fb249c36f.tar.gz
aspectj-00998fd4b23ad0d3e0cd292127297e0fb249c36f.zip
BcelTypeMunger.getRealMemberForITDFromAspect code cosmetics
Relates to #246. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java57
1 files changed, 24 insertions, 33 deletions
diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java
index 64e9ce42f..1d33f417e 100644
--- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java
@@ -1593,7 +1593,7 @@ public class BcelTypeMunger extends ConcreteTypeMunger {
System.err.println("Member we are looking for: " + lookingFor);
}
- ResolvedMember aspectMethods[] = aspectType.getDeclaredMethods();
+ ResolvedMember[] aspectMethods = aspectType.getDeclaredMethods();
UnresolvedType[] lookingForParams = lookingFor.getParameterTypes();
ResolvedMember realMember = null;
@@ -1602,47 +1602,38 @@ public class BcelTypeMunger extends ConcreteTypeMunger {
if (member.getName().equals(lookingFor.getName())) {
UnresolvedType[] memberParams = member.getGenericParameterTypes();
if (memberParams.length == lookingForParams.length) {
- if (debug) {
+ if (debug)
System.err.println("Reviewing potential candidates: " + member);
- }
boolean matchOK = true;
- // Check that all method/ctor params all match, although only the erasure
- for (int j = 0; j < memberParams.length && matchOK; j++) {
- ResolvedType pMember = memberParams[j].resolve(world);
- ResolvedType pLookingFor = lookingForParams[j].resolve(world);
- if (pMember.isTypeVariableReference()) {
- pMember = ((TypeVariableReference) pMember).getTypeVariable().getFirstBound().resolve(world);
- }
- if (pMember.isParameterizedType() || pMember.isGenericType()) {
- pMember = pMember.getRawType().resolve(aspectType.getWorld());
- }
-
- if (pLookingFor.isTypeVariableReference()) {
- pLookingFor = ((TypeVariableReference) pLookingFor).getTypeVariable().getFirstBound()
- .resolve(world);
- }
- if (pLookingFor.isParameterizedType() || pLookingFor.isGenericType()) {
- pLookingFor = pLookingFor.getRawType().resolve(world);
- }
+ // Check that all method/ctor params all match, although only the erasure
+ for (int j = 0; j < memberParams.length && matchOK; j++) {
+ ResolvedType pMember = memberParams[j].resolve(world);
+ ResolvedType pLookingFor = lookingForParams[j].resolve(world);
+
+ if (pMember.isTypeVariableReference())
+ pMember = ((TypeVariableReference) pMember).getTypeVariable().getFirstBound().resolve(world);
+ if (pMember.isParameterizedType() || pMember.isGenericType())
+ pMember = pMember.getRawType().resolve(aspectType.getWorld());
+
+ if (pLookingFor.isTypeVariableReference())
+ pLookingFor = ((TypeVariableReference) pLookingFor).getTypeVariable().getFirstBound().resolve(world);
+ if (pLookingFor.isParameterizedType() || pLookingFor.isGenericType())
+ pLookingFor = pLookingFor.getRawType().resolve(world);
+
+ if (debug)
+ System.err.println("Comparing parameter " + j + " member=" + pMember + " lookingFor=" + pLookingFor);
+ if (!pMember.equals(pLookingFor))
+ matchOK = false;
+ }
- if (debug) {
- System.err.println("Comparing parameter " + j + " member=" + pMember + " lookingFor="
- + pLookingFor);
- }
- if (!pMember.equals(pLookingFor)) {
- matchOK = false;
- }
- }
- if (matchOK) {
+ if (matchOK)
realMember = member;
- }
}
}
}
- if (debug && realMember == null) {
+ if (debug && realMember == null)
System.err.println("Didn't find a match");
- }
return realMember;
}