我正在尝试面向方面的编程。我已经安装了AspectJ 插件 http://eclipse.org/aspectj/index.php在 Eclipse 中并遵循本中提到的所有步骤tutorial http://sites.google.com/site/javatouch/aspectjtutorial.
创建的方面之间的所有连接都有效,但是当我尝试运行该项目时,我收到以下异常:
HelloException in thread "main" java.lang.VerifyError: Expecting a stackmap frame at branch target 6 in method helloworld.World.<clinit>()V at offset 0
at helloworld.Hello.sayHello(Hello.java:11)
at helloworld.Hello.main(Hello.java:6)
当我清空班级时World.aj并运行该项目,一切正常,我在控制台中收到预期的“Hello”。
以下是我在教程中创建的类:
你好.java
package helloworld;
public class Hello {
public static void main(String[] args) {
sayHello();
}
public static void sayHello() {
System.out.print("Hello");
}
}
World.aj
package helloworld;
public aspect World {
pointcut greeting() : execution(* Hello.sayHello(..));
after() returning() : greeting() {
System.out.println(" World!");
}
}
这个问题似乎与AOP无关。
我认为这与此处描述的 eclipse bug 相同:https://bugs.eclipse.org/bugs/show_bug.cgi?id=362591 https://bugs.eclipse.org/bugs/show_bug.cgi?id=362591
阿尤斯曼·贾恩 2011-11-02 02:47:32 说:
如果您遇到困难,请使用 VM 参数 -XX:-UseSplitVerifier 来运行
程序。我确认此选项没有验证错误。
你也可以尝试下载最新版本的eclipse。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)