+++ /dev/null
-public class GenericType<V extends Integer> {
-
- public GenericType(V value) {}
-
- public void foo() {}
-//
-// public void bar() {}
-
- protected V getValue() {
- return null;
- }
-
- public static void main(String[] args) {
- new GenericType<Integer>(null).foo();
- }
-
-}
-
-aspect SomeAspect {
- before(GenericType t): call(* GenericType.foo()) && target(t) {
- // Direct call to non-generic method works
-// t.bar();
- // Indirect call to non-generic method works
-// t.callNormalMethod();
- // Direct call to generic method works
-// t.getValue();
- // Indirect call to generic method produces a NoSuchMethodError
- t.callGenericMethod();
- }
-
-// private void GenericType.callNormalMethod() {
-// bar();
-// }
-
- private void GenericType.callGenericMethod() {
- getValue();
- }
-}
\ No newline at end of file
+++ /dev/null
-public class GenericType2<V extends Integer> {
-
- public GenericType2(V value) {}
-
- public void foo() {}
-//
-// public void bar() {}
-
- protected void getValue(V aV) {
- }
-
- public static void main(String[] args) {
- new GenericType2<Integer>(null).foo();
- }
-
-}
-
-aspect SomeAspect {
- before(GenericType2 t): call(* GenericType2.foo()) && target(t) {
- // Direct call to non-generic method works
-// t.bar();
- // Indirect call to non-generic method works
-// t.callNormalMethod();
- // Direct call to generic method works
-// t.getValue();
- // Indirect call to generic method produces a NoSuchMethodError
- t.callGenericMethod();
- }
-
-// private void GenericType.callNormalMethod() {
-// bar();
-// }
-
- private void GenericType2.callGenericMethod() {
- getValue(new Integer(45));
- }
-}
\ No newline at end of file
--- /dev/null
+public class GenericType<V extends Integer> {
+
+ public GenericType(V value) {}
+
+ public void foo() {}
+//
+// public void bar() {}
+
+ protected V getValue() {
+ return null;
+ }
+
+ public static void main(String[] args) {
+ new GenericType<Integer>(null).foo();
+ }
+
+}
+
+aspect SomeAspect {
+ before(GenericType t): call(* GenericType.foo()) && target(t) {
+ // Direct call to non-generic method works
+// t.bar();
+ // Indirect call to non-generic method works
+// t.callNormalMethod();
+ // Direct call to generic method works
+// t.getValue();
+ // Indirect call to generic method produces a NoSuchMethodError
+ t.callGenericMethod();
+ }
+
+// private void GenericType.callNormalMethod() {
+// bar();
+// }
+
+ private void GenericType.callGenericMethod() {
+ getValue();
+ }
+}
\ No newline at end of file
--- /dev/null
+public class GenericType2<V extends Integer> {
+
+ public GenericType2(V value) {}
+
+ public void foo() {}
+
+ protected void getValue(V aV) {
+ }
+
+ public static void main(String[] args) {
+ new GenericType2<Integer>(null).foo();
+ }
+
+}
+
+aspect SomeAspect {
+ before(GenericType2 t): call(* GenericType2.foo()) && target(t) {
+ // Indirect call to generic method produces a NoSuchMethodError
+ t.callGenericMethod();
+ }
+
+ private void GenericType2.callGenericMethod() {
+ getValue(new Integer(45));
+ }
+}
--- /dev/null
+interface Bar {}
+
+class B implements Bar {}
+
+public class GenericType2<V extends Bar> {
+
+ public GenericType2(V value) {}
+
+ protected void getValue(V aV) {
+ }
+ public void m() {
+ getValue(new B());
+}
+}
+
+aspect SomeAspect {
+ before(GenericType2 t): call(* GenericType2.foo()) && target(t) {
+ // Indirect call to generic method produces a NoSuchMethodError
+ t.callGenericMethod();
+ }
+
+ private void GenericType2.callGenericMethod() {
+// getValue(new Integer(45));
+ }
+}
// public void testSuperITDExplosion_pr134425() { runTest("super ITDs");}
// public void testMisbehavingDeclareAnnotation_pr135865() { runTest("misbehaving declare annotation");}
// public void testMisbehavingDeclareAnnotation_pr135865_2() { runTest("misbehaving declare annotation - 2");}
-// public void testItdCallingGenericMethod_pr145391() { runTest("itd calling generic method");}
-// public void testItdCallingGenericMethod_pr145391_2() { runTest("itd calling generic method - 2");}
// public void testClassCastForInvalidAnnotationValue_pr148537() { runTest("classcast annotation value");}
</run>
</ajc-test>
- <ajc-test dir="bugs152/pr145391" title="itd calling generic method">
- <compile files="GenericType.java" options="-1.5"/>
- <run class="GenericType"/>
- </ajc-test>
<ajc-test dir="bugs152/pr148536" title="NPE for unknown annotation">
<compile files="Bug.java" options="-1.5">
<run class="MyClass"/>
</ajc-test>
- <ajc-test dir="bugs152/pr145391" title="itd calling generic method - 2">
- <compile files="GenericType2.java" options="-1.5"/>
- <run class="GenericType2"/>
- </ajc-test>
-
<ajc-test dir="bugs152/pr126355" title="bizarre generic error with itds">
<compile files="Pair.java" options="-1.5"/>
<compile files="Test.java" options="-1.5"/>
public class Ajc162Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
// AspectJ1.6.2
+ public void testItdCallingGenericMethod_pr145391() { runTest("itd calling generic method");}
+ public void testItdCallingGenericMethod_pr145391_2() { runTest("itd calling generic method - 2");}
public void testPublicPointcut_pr239539() { runTest("public pointcut"); }
public void testGenericDecp_pr241047() { runTest("generic decp"); }
public void testGenericDecp_pr241047_2() { runTest("generic decp - 2"); }
<!-- AspectJ v1.6.2 Tests -->
<suite>
+ <ajc-test dir="bugs162/pr145391" title="itd calling generic method">
+ <compile files="GenericType.java" options="-1.5"/>
+ <run class="GenericType"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs162/pr145391" title="itd calling generic method - 2">
+ <compile files="GenericType2.java" options="-1.5">
+ <message kind="error" text="The method getValue(V) in the type GenericType2<V> is not applicable for the arguments"/>
+ </compile>
+ </ajc-test>
+
<ajc-test dir="bugs162/pr241047" title="generic decp">
<compile files="SomeAspect.java SomeBaseClass.java SomeSubClass.java SomeSubClass2.java SomeSubClass3.java SomeInterface.java SomeBaseClass2.java SomeBaseClass3.java" options=" -Xlint:ignore -1.5">
</compile>