You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

NotNullAspect.java 364B

123456789101112131415
  1. package patterntesting.check.runtime;
  2. public aspect NotNullAspect {
  3. pointcut ctorWithNotNullArg() :
  4. execution(*..*.new(*)) && @args(NotNull);
  5. before() : ctorWithNotNullArg() {
  6. Object[] args = thisJoinPoint.getArgs();
  7. if (args[0] == null) {
  8. throw new AssertionError("@NotNull constraint violated");
  9. }
  10. }
  11. }