aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/bugs1813/generics/A.java8
-rw-r--r--tests/bugs1813/generics/AlreadyImplementsA.java15
-rw-r--r--tests/bugs1813/generics/BaseI.java7
-rw-r--r--tests/bugs1813/generics/BaseT.java4
-rw-r--r--tests/bugs1813/generics/BindInterfaceA.aj8
-rw-r--r--tests/bugs1813/generics/ConcreteIImpl.java5
-rw-r--r--tests/bugs1813/generics/ConcreteTImpl.java6
-rw-r--r--tests/bugs1813/generics/Runner.java7
-rw-r--r--tests/src/org/aspectj/systemtest/ajc1811/Ajc1811Tests.java7
-rw-r--r--tests/src/org/aspectj/systemtest/ajc1811/ajc1811.xml17
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java15
11 files changed, 98 insertions, 1 deletions
diff --git a/tests/bugs1813/generics/A.java b/tests/bugs1813/generics/A.java
new file mode 100644
index 000000000..85ec82ea2
--- /dev/null
+++ b/tests/bugs1813/generics/A.java
@@ -0,0 +1,8 @@
+import java.util.List;
+
+
+public interface A<T extends BaseT, I extends BaseI> {
+
+ public T setInputs(List<I> inputs);
+
+} \ No newline at end of file
diff --git a/tests/bugs1813/generics/AlreadyImplementsA.java b/tests/bugs1813/generics/AlreadyImplementsA.java
new file mode 100644
index 000000000..56f650d03
--- /dev/null
+++ b/tests/bugs1813/generics/AlreadyImplementsA.java
@@ -0,0 +1,15 @@
+
+import java.util.List;
+
+
+public class AlreadyImplementsA {
+
+
+ public ConcreteTImpl setInputs(List<ConcreteIImpl> inputs) {
+ return null;
+ }
+
+
+
+
+} \ No newline at end of file
diff --git a/tests/bugs1813/generics/BaseI.java b/tests/bugs1813/generics/BaseI.java
new file mode 100644
index 000000000..31f975853
--- /dev/null
+++ b/tests/bugs1813/generics/BaseI.java
@@ -0,0 +1,7 @@
+
+
+public interface BaseI {
+
+
+
+} \ No newline at end of file
diff --git a/tests/bugs1813/generics/BaseT.java b/tests/bugs1813/generics/BaseT.java
new file mode 100644
index 000000000..72046e956
--- /dev/null
+++ b/tests/bugs1813/generics/BaseT.java
@@ -0,0 +1,4 @@
+
+public interface BaseT {
+
+} \ No newline at end of file
diff --git a/tests/bugs1813/generics/BindInterfaceA.aj b/tests/bugs1813/generics/BindInterfaceA.aj
new file mode 100644
index 000000000..2d3e56965
--- /dev/null
+++ b/tests/bugs1813/generics/BindInterfaceA.aj
@@ -0,0 +1,8 @@
+
+
+public aspect BindInterfaceA {
+
+ declare parents: AlreadyImplementsA implements A<ConcreteTImpl,ConcreteIImpl>;
+
+
+}
diff --git a/tests/bugs1813/generics/ConcreteIImpl.java b/tests/bugs1813/generics/ConcreteIImpl.java
new file mode 100644
index 000000000..3cbdac163
--- /dev/null
+++ b/tests/bugs1813/generics/ConcreteIImpl.java
@@ -0,0 +1,5 @@
+
+
+public class ConcreteIImpl implements BaseI {
+
+}
diff --git a/tests/bugs1813/generics/ConcreteTImpl.java b/tests/bugs1813/generics/ConcreteTImpl.java
new file mode 100644
index 000000000..aba55be3a
--- /dev/null
+++ b/tests/bugs1813/generics/ConcreteTImpl.java
@@ -0,0 +1,6 @@
+
+
+public class ConcreteTImpl implements BaseT {
+
+
+}
diff --git a/tests/bugs1813/generics/Runner.java b/tests/bugs1813/generics/Runner.java
new file mode 100644
index 000000000..6d4468b0f
--- /dev/null
+++ b/tests/bugs1813/generics/Runner.java
@@ -0,0 +1,7 @@
+public class Runner {
+ public static void main(String[] argv) {
+ if (new AlreadyImplementsA() instanceof A) {
+ System.out.println("ok");
+ }
+ }
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc1811/Ajc1811Tests.java b/tests/src/org/aspectj/systemtest/ajc1811/Ajc1811Tests.java
index 4e6013507..80729f894 100644
--- a/tests/src/org/aspectj/systemtest/ajc1811/Ajc1811Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc1811/Ajc1811Tests.java
@@ -63,6 +63,7 @@ public class Ajc1811Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
// public Outer<String>.Inner m2() { ... }
}
+
//
// public void testMultiArgs_509235() {
// runTest("multiargs");
@@ -72,6 +73,12 @@ public class Ajc1811Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
// runTest("multiargs - no ellipsis");
// }
+ // 1.8.13:
+
+ public void testAjcGenerics() {
+ runTest("generics");
+ }
+
// ---
public static Test suite() {
diff --git a/tests/src/org/aspectj/systemtest/ajc1811/ajc1811.xml b/tests/src/org/aspectj/systemtest/ajc1811/ajc1811.xml
index f4e321e5c..fe59c3595 100644
--- a/tests/src/org/aspectj/systemtest/ajc1811/ajc1811.xml
+++ b/tests/src/org/aspectj/systemtest/ajc1811/ajc1811.xml
@@ -6,6 +6,23 @@
<compile options="-1.8" files="Code.java"/>
</ajc-test>
+ <ajc-test dir="bugs1813/generics" title="generics">
+ <!-- this order works reliably -->
+ <compile options="-1.8 -showWeaveInfo" files="A.java AlreadyImplementsA.java BaseI.java BaseT.java BindInterfaceA.aj ConcreteIImpl.java ConcreteTImpl.java Runner.java">
+ <message kind="weave" text="Extending interface set for type 'AlreadyImplementsA' (AlreadyImplementsA.java) to include 'A&lt;ConcreteTImpl,ConcreteIImpl&gt;' (BindInterfaceA.aj)"/>
+ </compile>
+
+ <!-- this order was failing -->
+ <compile options="-1.8 -showWeaveInfo" files="AlreadyImplementsA.java BaseI.java BaseT.java BindInterfaceA.aj ConcreteIImpl.java ConcreteTImpl.java A.java Runner.java ">
+ <message kind="weave" text="Extending interface set for type 'AlreadyImplementsA' (AlreadyImplementsA.java) to include 'A&lt;ConcreteTImpl,ConcreteIImpl&gt;' (BindInterfaceA.aj)"/>
+ </compile>
+ <run class="Runner">
+ <stdout>
+ <line text="ok"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
<ajc-test dir="bugs1811/509235" title="multiargs">
<compile options="-1.8" files="Code.java"/>
<run class="Code">
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java b/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java
index 9768cb9e4..c82c352ae 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java
@@ -352,8 +352,21 @@ public class BcelTypeMunger extends ConcreteTypeMunger {
&& targetMethod.getBackingGenericMember().getParameterSignature().equals(newParentMethodSig)) {
discoveredImpl = targetMethod;
} else if (newParentMethod.hasBackingGenericMember()) {
- if (newParentMethod.getBackingGenericMember().getParameterSignature().equals(targetMethodSignature)) {
+ if (newParentMethod.getBackingGenericMember().getParameterSignature().equals(targetMethodSignature)) { // newParentMethod.getBackingGenericMember().getParameterSignature gives: (Pjava/util/List<TI;>;) targetMethodSignature= (Ljava/util/List;)
discoveredImpl = targetMethod;
+ } else if (targetMethod instanceof BcelMethod) {
+ // BcelMethod does not have backing generic member set (need to investigate why). For now, special case here:
+ UnresolvedType[] targetMethodGenericParameterTypes = targetMethod.getGenericParameterTypes();
+ if (targetMethodGenericParameterTypes !=null) {
+ StringBuilder b = new StringBuilder("(");
+ for (UnresolvedType p: targetMethodGenericParameterTypes) {
+ b.append(p.getSignature());
+ }
+ b.append(')');
+ if (b.toString().equals(newParentMethodSig)) {
+ discoveredImpl = targetMethod;
+ }
+ }
}
}
}