我正在使用基于 AspectJ 1.81 构建的 AJDT 2.2.4。
考虑这个简单的方面:
@Aspect
public class SampleAspect {
@Before("@annotation(logMe)")
public void beforeAdvice(JoinPoint joinPoint, LogMe logMe) {
System.out.println("Before the method");
}
}
它在 LogMe 注释之前打印一些文本,即:
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface LogMe {}
现在,我将此注释应用于某些方法:
public class DummyClass {
@LogMe
public void doSomething() {
SampleUtil sampleUtil = new SampleUtil();
//pass null for simplicity !
sampleUtil.sampleMethod(null);
System.out.println("Do Something");
}
}
SampleUtil 是
public class SampleUtil {
public void sampleMethod(
Map<String, Object>[] mapArray){
}
}
我收到这个警告:
can not resolve this member:
void foo.SampleUtil.sampleMethod(java.util.Map[]) [Xlint:unresolvableMember]
如果我将sampleMethod
参数更改为其他类似Map<String, Object> aMap
的错误将会消失。
为什么我会收到此警告?!