I am using AJDT 2.2.4 which is build on AspectJ 1.81.
Consider this simple aspect:
@Aspect
public class SampleAspect {
@Before("@annotation(logMe)")
public void beforeAdvice(JoinPoint joinPoint, LogMe logMe) {
System.out.println("Before the method");
}
}
It print some text before LogMe annotation which is :
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface LogMe {}
Now, I apply this annotation to some method as:
public class DummyClass {
@LogMe
public void doSomething() {
SampleUtil sampleUtil = new SampleUtil();
//pass null for simplicity !
sampleUtil.sampleMethod(null);
System.out.println("Do Something");
}
}
The SampleUtil is
public class SampleUtil {
public void sampleMethod(
Map<String, Object>[] mapArray){
}
}
I get this warning:
can not resolve this member:
void foo.SampleUtil.sampleMethod(java.util.Map[]) [Xlint:unresolvableMember]
If I change the sampleMethod parameter to something else like Map<String, Object> aMap the error will go.
Why do I get this warning ?!
That warning means that it can't find
foo.SampleUtilon the inpath. The inpath is similar to the classpath, and is used to determine what the aspects weave against.I am guessing that
foo.SampleUtilis in another project and this means that you need to explicitly add the project to your inpath.Since you are using AJDT inside of Eclipse, you can go to the aspect project's properties page and select the AspectJ build path tab. Choose Inpath and add the other project.