Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-dev] help please

Hello anybody,

problem:
Attribute Annotation does not match, respectively aspect is not applied.
there are snippeds of code:

Annotation:
@Target({CONSTRUCTOR, METHOD, FIELD, PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
public @interface NotNull {
}
-----------------------------------------------------------------------------

Aspect implementation :
@Aspect
public class NotNullAspect {

  @Before("execution(* *.*(@NotNull *, ..))")
  public void runOnMethod(JoinPoint jp) throws NullPointerException {
     ....
  }
}
-----------------------------------------------------------------------------------

Test implementation:
public class annotationTestsCase extends TestCase {
  public class TestDefinition {
      void atributeTest(@NotNull final String x) {
      }
  }

  public void testAttributeMethod() throws Throwable {
      TestDefinition test = new TestDefinition();
      try {
          test.atributeTest(null);
          fail("Exception not occured!");
      } catch (NullPointerException ex) {
      }
  }
}


Thank you
for any advice,

regards
J.Burian


Back to the top