]> source.dussan.org Git - aspectj.git/commitdiff
fix for 133298
authoraclement <aclement>
Tue, 28 Mar 2006 07:32:42 +0000 (07:32 +0000)
committeraclement <aclement>
Tue, 28 Mar 2006 07:32:42 +0000 (07:32 +0000)
tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java

index 67b7496776b6de848a800332227bb98dcdf299b0..0615461146bdab70f27d25e7ee94991f5f266132 100644 (file)
@@ -28,8 +28,8 @@ public class Ajc151Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
   public void testAnnotationsAndItds_pr98901() { runTest("annotations and itds");}
   public void testAnnotationsAndItds_pr98901_2() { runTest("annotations and itds - 2");}
   public void testCircularGenerics_pr133307() { runTest("circular generics");}
-  //  public void testDeca() { runTest("doubly annotating a method with declare");}    
-  //  public void testDeca2() { runTest("doubly annotating a method with declare - 2");}       
+  public void testDeca() { runTest("doubly annotating a method with declare");}        
+  public void testDeca2() { runTest("doubly annotating a method with declare - 2");}   
   public void testCrashingWithASM_pr132926_1() { runTest("crashing on annotation type resolving with asm - 1");}
   public void testCrashingWithASM_pr132926_2() { runTest("crashing on annotation type resolving with asm - 2");}
   public void testCrashingWithASM_pr132926_3() { runTest("crashing on annotation type resolving with asm - 3");}
index 27278739cba737c6d9d496346c4c44e0086ad058..c6f317d83a456a2da67d7bfffea264768e9721dd 100644 (file)
@@ -768,7 +768,7 @@ class BcelClassWeaver implements IClassWeaver {
                // Single first pass
                List worthRetrying = new ArrayList();
                boolean modificationOccured = false;
-               
+               List /*AnnotationGen*/ annotationsToAdd = null;
                for (Iterator iter = decaMs.iterator(); iter.hasNext();) {
                        DeclareAnnotation decaM = (DeclareAnnotation) iter.next();
                        
@@ -779,15 +779,12 @@ class BcelClassWeaver implements IClassWeaver {
                                        unusedDecams.remove(decaM);
                                        continue; // skip this one...
                                }
-                               
+
+                               if (annotationsToAdd==null) annotationsToAdd = new ArrayList();
                                Annotation a = decaM.getAnnotationX().getBcelAnnotation();
                                AnnotationGen ag = new AnnotationGen(a,clazz.getConstantPoolGen(),true);
-                               Method oldMethod = mg.getMethod();
-                               MethodGen myGen = new MethodGen(oldMethod,clazz.getClassName(),clazz.getConstantPoolGen(),false);// dont use tags, they won't get repaired like for woven methods.
-                               myGen.addAnnotation(ag);
-                               Method newMethod = myGen.getMethod();
+                               annotationsToAdd.add(ag);
                                mg.addAnnotation(decaM.getAnnotationX());
-                               members.set(memberCounter,new LazyMethodGen(newMethod,clazz));
                                
                                AsmRelationshipProvider.getDefault().addDeclareAnnotationRelationship(decaM.getSourceLocation(),clazz.getName(),mg.getMethod());
                                reportMethodCtorWeavingMessage(clazz, mg.getMemberView(), decaM,mg.getDeclarationLineNumber());
@@ -815,6 +812,12 @@ class BcelClassWeaver implements IClassWeaver {
                                                unusedDecams.remove(decaM);
                                                continue; // skip this one...
                                        }
+                                       
+                                       if (annotationsToAdd==null) annotationsToAdd = new ArrayList();
+                                       Annotation a = decaM.getAnnotationX().getBcelAnnotation();
+                                       AnnotationGen ag = new AnnotationGen(a,clazz.getConstantPoolGen(),true);
+                                       annotationsToAdd.add(ag);
+                                       
                                        mg.addAnnotation(decaM.getAnnotationX());
                                        AsmRelationshipProvider.getDefault().addDeclareAnnotationRelationship(decaM.getSourceLocation(),clazz.getName(),mg.getMethod());
                                        isChanged = true;
@@ -826,6 +829,17 @@ class BcelClassWeaver implements IClassWeaver {
                        }
                        worthRetrying.removeAll(forRemoval);
                }
+               if (annotationsToAdd!=null) {
+                       Method oldMethod = mg.getMethod();
+                               MethodGen myGen = new MethodGen(oldMethod,clazz.getClassName(),clazz.getConstantPoolGen(),false);// dont use tags, they won't get repaired like for woven methods.
+                       for (Iterator iter = annotationsToAdd.iterator(); iter.hasNext();) {
+                                               AnnotationGen a = (AnnotationGen) iter.next();
+                                               myGen.addAnnotation(a);                                         
+                                       }
+                       Method newMethod = myGen.getMethod();
+                       members.set(memberCounter,new LazyMethodGen(newMethod,clazz));
+               }
+               
             }
           }
                  checkUnusedDeclareAtTypes(unusedDecams, false);