小编M.M*_*ark的帖子

针对静态方法的“target()”切入点的 AspectJ 警告“Xlint:adviceDidNotMatch”

我是 AspectJ 的新手,仍在学习如何编写代码。我正在尝试为 nextYear() 方法创建切入点和建议,但我不断收到“警告:(39, 0) ajc:ChristkindAspect 中定义的建议尚未应用 [Xlint:adviceDidNotMatch]”。我知道这可能是因为没有直接创建对象,并且我不能使用 target(christkind enter code here),但我找不到解决方案。有人可以帮忙吗?先感谢您!

pointcut nextYear(Christkind christkind, Population population):
  call(* *Christkind.nextYear(Population))&& args(population) && 
  target(christkind);


before(Christkind christkind,Population population): nextYear(christkind,population) {
    System.out.println("New Year");
    populationSize(population);
    numbOfWIshes(population);
    //wishStrength(population); }
Run Code Online (Sandbox Code Playgroud)

在主要方法中,我有:

Christkind.nextYear(population);
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

java aspectj

5
推荐指数
1
解决办法
1460
查看次数

标签 统计

aspectj ×1

java ×1