mirror of
https://github.com/eclipse-aspectj/aspectj.git
synced 2024-08-15 14:13:28 +02:00
16 lines
364 B
Java
16 lines
364 B
Java
package patterntesting.check.runtime;
|
|
|
|
public aspect NotNullAspect {
|
|
|
|
pointcut ctorWithNotNullArg() :
|
|
execution(*..*.new(*)) && @args(NotNull);
|
|
|
|
before() : ctorWithNotNullArg() {
|
|
Object[] args = thisJoinPoint.getArgs();
|
|
if (args[0] == null) {
|
|
throw new AssertionError("@NotNull constraint violated");
|
|
}
|
|
}
|
|
|
|
}
|