]> source.dussan.org Git - aspectj.git/commitdiff
test and fix for 158624: generic types and arrays
authoraclement <aclement>
Fri, 29 Sep 2006 12:20:31 +0000 (12:20 +0000)
committeraclement <aclement>
Fri, 29 Sep 2006 12:20:31 +0000 (12:20 +0000)
tests/bugs153/pr158624/ValueChange.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java
tests/src/org/aspectj/systemtest/ajc153/ajc153.xml
weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java

diff --git a/tests/bugs153/pr158624/ValueChange.java b/tests/bugs153/pr158624/ValueChange.java
new file mode 100644 (file)
index 0000000..3c1e4ca
--- /dev/null
@@ -0,0 +1,27 @@
+abstract class ValueChange<Q> {
+    public ValueChange(Q initValue) { }
+}
+
+abstract class SyncValueGroup<T> extends ValueChange<T> {
+       public SyncValueGroup(T initValue) {
+        super(initValue);
+    }
+    public final synchronized void link(SyncValueGroup<T> ... list) {    }
+}
+
+class SyncValueTest {
+    class SyncInteger extends SyncValueGroup<Integer> {
+        public SyncInteger(int val) {
+            super(new Integer(val));
+        }
+    }
+    private SyncInteger a = new SyncInteger(1);
+    public void testSyncValueGroup() {
+        a.link(a);
+    }
+}
+
+aspect X {
+  before(): call(* *(..)) {}
+}
\ No newline at end of file
index 9e3da682953ea9cf012dcf2a10c86f8184ed39c1..ab1c5524bba3e3ef52eb4327540a52eb85c85f16 100644 (file)
@@ -31,6 +31,7 @@ public class Ajc153Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
   // public void testAmbiguousBinding_pr121805() { runTest("ambiguous binding");}
 //  public void testNoIllegalStateExceptionWithGenericInnerAspect_pr156058() { runTest("no IllegalStateException with generic inner aspect"); }
 //  public void testNegatedAnnotationMatchingProblem_pr153464() { runTest("negated annotation matching problem");}
+  public void testGenericArrays_pr158624() { runTest("generics and arrays"); }
   public void testMissingLineNumbersInStacktraceBefore_pr145442() { runTest("missing line numbers in stacktrace before");}
   public void testMissingLineNumbersInStacktraceBefore_pr145442_Binary() { runTest("missing line numbers in stacktrace before - binary");}
   public void testAnnotationStylePointcutNPE_pr158412() { runTest("annotation style pointcut npe"); }
index f65a256a309442bda11367fe3a6f64d90e6c11bc..6c5b05e6e38677cc36f78ea648fb23979f348ff3 100644 (file)
@@ -5,6 +5,10 @@
        <ajc-test dir="bugs153/pr148908" title="ensure getSourceSignature correct with static field">
       <compile files="BadInterface.java" options="-emacssym"/>
     </ajc-test> 
+    
+       <ajc-test dir="bugs153/pr158624" title="generics and arrays">
+      <compile files="ValueChange.java" options="-1.5"/>
+    </ajc-test> 
 
     <ajc-test dir="bugs153/pr153845" title="IllegalStateException at GenericSignatureParser.java">
       <compile files="GenericType.java,Aspect.java,Aspect2.java,Interface.java" options="-1.5" outjar="blob.jar"/>
index f5bd991c7bdf0246e2c613ce17b99804cd5c891b..d1bff981621239189a4cc67d638c66d9f2d8657c 100644 (file)
@@ -638,10 +638,11 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno
                }
                
                UnresolvedType parameterizedReturnType = parameterize(getGenericReturnType(),typeMap,isParameterized);
-               UnresolvedType[] parameterizedParameterTypes = new UnresolvedType[getGenericParameterTypes().length];
+               UnresolvedType[] parameterizedParameterTypes = new UnresolvedType[getGenericParameterTypes().length];           
+               UnresolvedType[] genericParameterTypes = getGenericParameterTypes(); 
                for (int i = 0; i < parameterizedParameterTypes.length; i++) {
                        parameterizedParameterTypes[i] = 
-                               parameterize(getGenericParameterTypes()[i], typeMap,isParameterized);
+                               parameterize(genericParameterTypes[i], typeMap,isParameterized);
                }
                ResolvedMemberImpl ret = new ResolvedMemberImpl(
                                        getKind(),
@@ -677,6 +678,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno
                        return (UnresolvedType) typeVariableMap.get(variableName);
                } else if (aType.isParameterizedType()) {
                        if (inParameterizedType) {
+                               if (aType instanceof UnresolvedType) aType= aType.resolve(((ResolvedType)getDeclaringType()).getWorld());
                                return aType.parameterize(typeVariableMap);
                        } else {
                                return aType.getRawType();