Browse Source

@testcase PR#75129 NPE on thisJoinPoint mistake

tags/V1_2_1
wisberg 19 years ago
parent
commit
3ea5889905
2 changed files with 38 additions and 0 deletions
  1. 9
    0
      tests/ajcTestsFailing.xml
  2. 29
    0
      tests/bugs/TjpMistake.java

+ 9
- 0
tests/ajcTestsFailing.xml View File

@@ -152,5 +152,14 @@
files="Test_AroundVarBug.java,AroundVarBug.java"/>
<run class="Test_AroundVarBug"/>
</ajc-test>

<ajc-test
dir="bugs"
pr="75129"
title="NPE on thisJoinPoint mistake">
<compile files="TjpMistake.java">
<message kind="error" line="22"/>
</compile>
</ajc-test>
</suite>

+ 29
- 0
tests/bugs/TjpMistake.java View File

@@ -0,0 +1,29 @@
/** @testcase PR#75129 NPE on thisJoinPoint mistake */
public class TjpMistake {
public static void main(String[] a) {
new C().go();
new D().go();
new E().go();
}
}
interface I { void go();}
class C {}
class D {
public void go() { System.out.println("D.go() in " + this); }
}
class E extends D {
}
aspect A {
declare parents: (C || D) implements I;
public void I.go() { System.out.println("I.go() in " + this); }
before() : execution(* I.*(..)) {
System.out.println(
// mistake caused compiler crash rather than error
thisJoinPoint.getSignature.toLongString() // CE 22
// correct
//thisJoinPointStaticPart.getSignature().toLongString()
+ " "
+ thisJoinPoint.getSignature().getDeclaringType()
+ " "
+ this); }
}

Loading…
Cancel
Save