[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Is it possible to define a scope of methods accepting at least one non primitive argument?
|
Thanks for the reply. Unfortunately, something is wrong with your example. I
am trying to implement it, but it does not work.
Given the following declarations:
==============================================
package com.shunra.poc;
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target({ ElementType.PARAMETER })
public @interface NotNull {
}
==============================================
package com.shunra.poc;
public aspect NotNullAspect {
pointcut first(Object o): execution(* *((@NotNull *),..)) && args(o,..);
// line 4
pointcut second(Object o): execution(* *(*,(@NotNull *),..)) &&
args(*,o,..); // line 5
pointcut third(Object o): execution(* *(*,*,(@NotNull *),..)) &&
args(*,*,o,..); // line 6
before(Object o): first(o) {
checkNotNull(o);
}
private void checkNotNull(Object o) {
// TODO Auto-generated method stub
}
}
==============================================
I get the following warnings for the lines 4,5 and 6 respectively:
==============================================
does not match because annotation @com.shunra.poc.NotNull has
@Target{ElementType.PARAMETER} [Xlint:unmatchedTargetKind] NotNullAspect.aj
/Server/src/com/shunra/poc line 4 Java Problem
does not match because annotation @com.shunra.poc.NotNull has
@Target{ElementType.PARAMETER} [Xlint:unmatchedTargetKind] NotNullAspect.aj
/Server/src/com/shunra/poc line 5 Java Problem
does not match because annotation @com.shunra.poc.NotNull has
@Target{ElementType.PARAMETER} [Xlint:unmatchedTargetKind] NotNullAspect.aj
/Server/src/com/shunra/poc line 6 Java Problem
==============================================
What is wrong?
Thanks.
--
View this message in context: http://aspectj.2085585.n4.nabble.com/Is-it-possible-to-define-a-scope-of-methods-accepting-at-least-one-non-primitive-argument-tp4195341p4201202.html
Sent from the AspectJ - users mailing list archive at Nabble.com.