Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AspectJ » VerifyError When Running with JUnit
VerifyError When Running with JUnit [message #66160] Fri, 07 July 2006 17:33
Eclipse UserFriend
Originally posted by: conway.ken.gmail.com

Hello,

Newbie problem, I'm sure. . .

I'm using Eclipse 3.2 and AJDT 1.4.

I've created a very simple test scenario that utilizes @AspectJ. When
running the main method in the Simple class, the aspect behaves as expected
but, when running the SimpleTest Junit test, I get the following error:

java.lang.VerifyError: (class: SimpleTest, method:
setAString_aroundBody1$advice signature:
(LSimpleTest;LSimple;Ljava/lang/String;Lorg/aspectj/lang/Joi nPoint;LSimpleAspect;Lorg/aspectj/lang/ProceedingJoinPoint;L Simple;Ljava/lang/String;)V)
Incompatible argument to function
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getConstructor(Unknown Source)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoade r.createTest(JUnit3TestLoader.java:73)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoade r.getTest(JUnit3TestLoader.java:95)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoade r.loadTests(JUnit3TestLoader.java:59)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:445)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main( RemoteTestRunner.java:196)

I would really appreciate it if someone could help me out with what I'm
doing wrong? (btw, I'm experimenting with obtaining context when the advice
is executed and I'm hoping to gain access to both argument and target)

Thanks,
Ken

============================================================ ============
public class Simple{

private String aString;

public String getAString(){
return aString;
}

public void setAString(String string){
aString = string;
}

public static void main(String[] args){
String testString = "my test string";
Simple simple = new Simple();
simple.setAString(testString);
System.out.println("testString.equals(simple.getAString() is " +
testString.equals(simple.getAString()));
}

}

============================================================ ============

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;

@Aspect
public class SimpleAspect{

@Around("target(simple) && args(theString) && call(void *(String))")
public void aroundCallSetAString(ProceedingJoinPoint thisJoinPoint, Simple
simple, String theString) throws Throwable{
System.out.println("In aroundCallGetAString. theString: " + theString +
"");
thisJoinPoint.proceed(new Object[]{simple, theString});
System.out.println("In aroundCallGetAString after
thisJoinPoint.proceed.");
}
}

============================================================ ============
import junit.framework.Assert;
import junit.framework.TestCase;

public class SimpleTest extends TestCase{

public void testSimpleSet(){
String testString = "my test string";
Simple simple = new Simple();
simple.setAString(testString);
Assert.assertTrue("testString is not equal to simple.getAString().",
testString.equals(simple.getAString()));
}

}
Previous Topic:compiler error
Next Topic:VerifyError When Running with JUnit
Goto Forum:
  


Current Time: Fri Dec 27 01:38:15 GMT 2024

Powered by FUDForum. Page generated in 0.03184 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top