Evgenij Reznik
Evgenij Reznik

Reputation: 18594

AspectJ: VerifyError

I'm experimenting with Aspect-Oriented Programming. I've installed the AspectJ-Plugin in Eclipse and followed all the steps mentioned in this tutorial.
All connections between the created aspects work, but when I try to run the project, I receive the following exception:

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)

When I empty the class World.aj and run the project, everything works and I receive the expected "Hello" in the console.


Here are the classes I created during the tutorial:

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!"); 
    } 

}

Upvotes: 4

Views: 2766

Answers (3)

Tjunkie
Tjunkie

Reputation: 497

I don't have the points to comment on @KC answer, which worked for me,

so leaving this as an additional answer

     -XX:-UseSplitVerifier

did work for me

I have an AspectJ project that was running fine in eclipse 3.7 then all of a sudden started getting that error adding the -XX:-UseSplitVerifier to the launcher configuration solved it.

Upvotes: 2

Gonzalo
Gonzalo

Reputation: 1334

I also followed the tutorial, and encountered the same error. And here is how I solved it.

I found out that that the execution environment JRE selected by default with my eclipse, JavaSE-1.7, had an issue with AspectJ. So what you have to do, is change the execution environment JRE, choose for example JavaSE-1.6.

After, you can follow the tutorial, and obtain the desired output! :)

Hope this helps!

Upvotes: 1

K.C.
K.C.

Reputation: 2112

the problem doesn't seem related to AOP.

I think this is the same eclipse bug described here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=362591

Ayushman Jain 2011-11-02 02:47:32 said: If you're stuck, please use the VM argument -XX:-UseSplitVerifier to run the program. I confirm that there is no verify error with this option.

May you can also try to download the latest version of eclipse.

Upvotes: 4

Related Questions