]> source.dussan.org Git - aspectj.git/commitdiff
223226: test and fix for NPE and duplicate signature
authoraclement <aclement>
Wed, 11 Jun 2008 20:54:25 +0000 (20:54 +0000)
committeraclement <aclement>
Wed, 11 Jun 2008 20:54:25 +0000 (20:54 +0000)
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java

index 2bd4db5ca6a153938fbe9d9ced1a7726001e5f36..a4f49a7d6716cbda24e66432fcb5f8cfa518b156 100644 (file)
@@ -714,10 +714,12 @@ class BcelClassWeaver implements IClassWeaver {
                        UnresolvedType[] bm = BcelWorld.fromBcel(bridgeToCandidate.getArgumentTypes());
                        ResolvedMember overriddenMethod = checkForOverride(theSuperclass,name,psig,rsig,bridgeToCandidate.getAccessFlags(),pkgName,bm);
                        if (overriddenMethod!=null) { 
-                               boolean alreadyHaveABridgeMethod = methodsSet.contains(overriddenMethod.getName()+overriddenMethod.getSignature());
+                               String key = new StringBuffer().append(overriddenMethod.getName()).append(overriddenMethod.getSignature()).toString();
+                               boolean alreadyHaveABridgeMethod = methodsSet.contains(key);
                                if (!alreadyHaveABridgeMethod) {
                                        if (world.forDEBUG_bridgingCode) System.err.println("Bridging:bridging to '"+overriddenMethod+"'");
                                        createBridgeMethod(world, bridgeToCandidate, clazz, overriddenMethod);
+                                       methodsSet.add(key);
                                        didSomething = true;
                                        continue; // look at the next method
                                }
@@ -730,9 +732,11 @@ class BcelClassWeaver implements IClassWeaver {
                                ResolvedType interfaceType = world.resolve(interfaces[j]);
                                overriddenMethod = checkForOverride(interfaceType,name,psig,rsig,bridgeToCandidate.getAccessFlags(),clazz.getPackageName(),bm);
                                if (overriddenMethod!=null) { 
-                                       boolean alreadyHaveABridgeMethod = methodsSet.contains(overriddenMethod.getName()+overriddenMethod.getSignature());
+                                       String key = new StringBuffer().append(overriddenMethod.getName()).append(overriddenMethod.getSignature()).toString();
+                                       boolean alreadyHaveABridgeMethod = methodsSet.contains(key);
                                        if (!alreadyHaveABridgeMethod) {
                                                createBridgeMethod(world, bridgeToCandidate, clazz, overriddenMethod);
+                                               methodsSet.add(key);
                                                didSomething=true;
                                                if (world.forDEBUG_bridgingCode) System.err.println("Bridging:bridging to "+overriddenMethod);
                                                continue; // look at the next method