--- /dev/null
+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
--- /dev/null
+
+import java.util.List;
+
+
+public class AlreadyImplementsA {
+
+
+ public ConcreteTImpl setInputs(List<ConcreteIImpl> inputs) {
+ return null;
+ }
+
+
+
+
+}
\ No newline at end of file
--- /dev/null
+
+
+public interface BaseI {
+
+
+
+}
\ No newline at end of file
--- /dev/null
+
+public interface BaseT {
+
+}
\ No newline at end of file
--- /dev/null
+
+
+public aspect BindInterfaceA {
+
+ declare parents: AlreadyImplementsA implements A<ConcreteTImpl,ConcreteIImpl>;
+
+
+}
--- /dev/null
+
+
+public class ConcreteIImpl implements BaseI {
+
+}
--- /dev/null
+
+
+public class ConcreteTImpl implements BaseT {
+
+
+}
--- /dev/null
+public class Runner {
+ public static void main(String[] argv) {
+ if (new AlreadyImplementsA() instanceof A) {
+ System.out.println("ok");
+ }
+ }
+}
// public Outer<String>.Inner m2() { ... }
}
+
//
// public void testMultiArgs_509235() {
// runTest("multiargs");
// runTest("multiargs - no ellipsis");
// }
+ // 1.8.13:
+
+ public void testAjcGenerics() {
+ runTest("generics");
+ }
+
// ---
public static Test suite() {
<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<ConcreteTImpl,ConcreteIImpl>' (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<ConcreteTImpl,ConcreteIImpl>' (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">
&& 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;
+ }
+ }
}
}
}