summaryrefslogtreecommitdiffstats
path: root/tests/bugs163/pr257833/NotNullAspect.java
blob: f5e8654d70f934c4bc7fcc24ddf8f279252af554 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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");
        }
    }

}