java.lang.AbstractMethodError when invoking introduced method [message #52853] |
Fri, 03 June 2005 14:12  |
Eclipse User |
|
|
|
The code I'm developing is a library, so I need my clients to be able to use it without any special aspectj/ajdt requirements (other than the runtime jar). So I have two projects:
drools-core - which is has the aspectj nature
drools-core-aspectjtest - which is a regular java project
the test project does not depend directly on the other, since it then does see the weaved classes. Rather, it includes the core project output directory (which should be good simulation for including a jar). Now, introduced methods can be used from regular java classes.
However, when I run my tests, I'm getting AbstractMethodError when I attempt to invoke an introduced method. In the core project, ajdt clearly indicates that the methods have been introduced on the concrete class that I am calling.
Any ideas how I can debug what is actually happening?
thanks
-barry
|
|
|
|
|
|
|
Re: java.lang.AbstractMethodError when invoking introduced method [message #52979 is a reply to message #52957] |
Fri, 03 June 2005 14:53  |
Eclipse User |
|
|
|
> My guess for what is happening is that you have the output folder of the
> library project on your classpath for compilation, but that when you
> run the tests this output folder is *not* on the runtime classpath.
> Instead, at runtime you are picking up another (unwoven) version of the
> library classes from somewhere else on your classpath.
>
> Could this be the case?
I don't see how. There is only one output directory(*). But... Here's what I just did:
- Added the aspectj nature to the test project
- Test runs fine!
- Remove aspectj nature from the test project
- Compile errors because aspectjrt.jar is missing (I was using AspectOf)
- Added the aspectjrt.jar
- Test runs fine!
So, clearly some class fud was going on. I pretty regularly have to recompile the whole project and/or restart eclipse when using ajdt. Is there any class caching going on somewhere?
But for now, its working. I try to be observant as to what triggers my compilation fud.
thanks!!
(*) This brings up another issue. I would like to direct the production code to one output directory, and the test to another. This is possible with the java nature, but not the aspectj nature. Need this be the case? I must say, that I don't find any benefit to the way ajdt changes the way files are included/excluded from the build.
-barry
|
|
|
Re: java.lang.AbstractMethodError when invoking introduced method [message #588577 is a reply to message #52853] |
Fri, 03 June 2005 14:21  |
Eclipse User |
|
|
|
Here are few more details.
The aspect contains:
private WorkingMemoryEventSupport WorkingMemory.eventSupport;
public void WorkingMemory.addListener(WorkingMemoryEventListener listener) {
eventSupport.addEventListener(listener);
}
public void WorkingMemory.removeListener(WorkingMemoryEventListener listener) {
eventSupport.removeEventListener(listener);
}
The concrete class that I'm using in my test is:
public ForTestWorkingMemory implements WorkingMemory ...
The weave message for ForTestWorkingMemory is:
Severity Description Resource In Folder Location Creation Time
0 Type 'org.drools.event.ForTestWorkingMemory' (ForTestWorkingMemory.java) has intertyped method from 'org.drools.event.WorkingMemoryChangeNotification' (WorkingMemoryChangeNotification.aj:'void org.drools.WorkingMemory.addListener(org.drools.event.Workin gMemoryEventListener)') drools-core June 3, 2005 11:03:32 AM
-barry
|
|
|
|
|
Re: java.lang.AbstractMethodError when invoking introduced method [message #588604 is a reply to message #52853] |
Fri, 03 June 2005 14:46  |
Eclipse User |
|
|
|
Barry Kaplan wrote:
> However, when I run my tests, I'm getting AbstractMethodError when I
> attempt to invoke an introduced method. In the core project, ajdt
> clearly indicates that the methods have been introduced on the concrete
> class that I am calling.
> Any ideas how I can debug what is actually happening?
>
> thanks
>
> -barry
The fact that your tests compile happily indicates that in the woven
class files, the method is there as expected. Likewise the fact that you
say everything works when you create a project dependency (which places
the output folders of the library project into both the compile time
*and* runtime classpaths of the dependent project) indicate that things
are pretty healthy.
The javadoc for AbstractMethodError says "this error can only occur at
runtime if the definition of some class has incompatibly changed since
the currently executing method was last compiled".
My guess for what is happening is that you have the output folder of the
library project on your classpath for compilation, but that when you
run the tests this output folder is *not* on the runtime classpath.
Instead, at runtime you are picking up another (unwoven) version of the
library classes from somewhere else on your classpath.
Could this be the case?
|
|
|
Re: java.lang.AbstractMethodError when invoking introduced method [message #588608 is a reply to message #52957] |
Fri, 03 June 2005 14:53  |
Eclipse User |
|
|
|
> My guess for what is happening is that you have the output folder of the
> library project on your classpath for compilation, but that when you
> run the tests this output folder is *not* on the runtime classpath.
> Instead, at runtime you are picking up another (unwoven) version of the
> library classes from somewhere else on your classpath.
>
> Could this be the case?
I don't see how. There is only one output directory(*). But... Here's what I just did:
- Added the aspectj nature to the test project
- Test runs fine!
- Remove aspectj nature from the test project
- Compile errors because aspectjrt.jar is missing (I was using AspectOf)
- Added the aspectjrt.jar
- Test runs fine!
So, clearly some class fud was going on. I pretty regularly have to recompile the whole project and/or restart eclipse when using ajdt. Is there any class caching going on somewhere?
But for now, its working. I try to be observant as to what triggers my compilation fud.
thanks!!
(*) This brings up another issue. I would like to direct the production code to one output directory, and the test to another. This is possible with the java nature, but not the aspectj nature. Need this be the case? I must say, that I don't find any benefit to the way ajdt changes the way files are included/excluded from the build.
-barry
|
|
|
Powered by
FUDForum. Page generated in 0.12032 seconds