mirror of
https://github.com/eclipse-aspectj/aspectj.git
synced 2024-08-14 02:10:40 +02:00
22 lines
609 B
Java
22 lines
609 B
Java
public class NullPointerOnGetsSimple {
|
|
public static void main(String[] args) {
|
|
PrintService ps = new PrintService();
|
|
ps.string = "after";
|
|
org.aspectj.testing.Tester.checkEqual("after", ps.string);
|
|
}
|
|
}
|
|
|
|
class PrintService {
|
|
String string = "before";
|
|
}
|
|
|
|
aspect Aspect {
|
|
pointcut needPrinter(PrintService ps): get(String PrintService.string) && target(ps) &&
|
|
!within(Aspect);
|
|
String around(PrintService ps): needPrinter(ps) {
|
|
System.out.println("around");
|
|
org.aspectj.testing.Tester.checkEqual("after", ps.string);
|
|
return ps.string;
|
|
}
|
|
}
|