]> source.dussan.org Git - aspectj.git/commitdiff
BcelTypeMunger.getRealMemberForITDFromAspect code cosmetics
authorAlexander Kriegisch <Alexander@Kriegisch.name>
Sun, 25 Jun 2023 10:22:34 +0000 (12:22 +0200)
committerAlexander Kriegisch <Alexander@Kriegisch.name>
Mon, 26 Jun 2023 06:48:27 +0000 (13:48 +0700)
Relates to #246.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java

index 64e9ce42f47277651ec9e29b1dda1dd0c753affa..1d33f417e1aa5f9a859c62cb5b0938ddc5256f31 100644 (file)
@@ -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;
        }