From ea4ff8adad2347557c25d6e10e114132b7491870 Mon Sep 17 00:00:00 2001 From: aclement Date: Fri, 29 Sep 2006 12:20:31 +0000 Subject: [PATCH] test and fix for 158624: generic types and arrays --- tests/bugs153/pr158624/ValueChange.java | 27 +++++++++++++++++++ .../systemtest/ajc153/Ajc153Tests.java | 1 + .../org/aspectj/systemtest/ajc153/ajc153.xml | 4 +++ .../aspectj/weaver/ResolvedMemberImpl.java | 6 +++-- 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 tests/bugs153/pr158624/ValueChange.java diff --git a/tests/bugs153/pr158624/ValueChange.java b/tests/bugs153/pr158624/ValueChange.java new file mode 100644 index 000000000..3c1e4cafe --- /dev/null +++ b/tests/bugs153/pr158624/ValueChange.java @@ -0,0 +1,27 @@ +abstract class ValueChange { + public ValueChange(Q initValue) { } +} + +abstract class SyncValueGroup extends ValueChange { + public SyncValueGroup(T initValue) { + super(initValue); + } + public final synchronized void link(SyncValueGroup ... list) { } +} + +class SyncValueTest { + class SyncInteger extends SyncValueGroup { + 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 diff --git a/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java b/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java index 9e3da6829..ab1c5524b 100644 --- a/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java @@ -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"); } diff --git a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml index f65a256a3..6c5b05e6e 100644 --- a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml +++ b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml @@ -5,6 +5,10 @@ + + + + diff --git a/weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java b/weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java index f5bd991c7..d1bff9816 100644 --- a/weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java +++ b/weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java @@ -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(); -- 2.39.5