Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] java.lang.AbstractMethodError in aspects

I am sorry, I do not think I followed up on this mail; but this issue is reproducible in the instance when an interface method signature is protected and the implementing class signature is public. In Java there is no problem. But when these two methods, i.e. interface signature and implementation class method are refactored in AspectJ I keep getting an java.lang.AbstractMethodError.
 
Thanks.

Wes Isberg <wes@xxxxxxxxxxxxxx> wrote:
Method signatures in interfaces are implicitly public abstract,
so "public" should be required for Session.setAutoCommit(boolean).

I'm inclined to think a reproducible AbstractMethodError is a bug,
so please submit it if you can reproduce.

Thanks!
Wes

------------Original Message------------
From: Irum Godil
To: aspectj-users@xxxxxxxxxxx
Date: Thu, Mar-24-2005 8:41 PM
Subject: Re: [aspectj-users] java.lang.AbstractMethodError in aspects
Actually, in following up with the query below, I noticed that the method in SessionInterface does not have a "public" identifier in front of it, where as the one in Session does. So, I removed the public identifier from the Session method's signature; and the problem is gone.

What is surprising is that the same signatures in Java do not give any problem. In fact if I comment out the method from the Session class, I get an error that the class must implement the inherited method.

Perhaps, it is a deficiency in AspectJ; and since I just copied and pasted the inter-type declarations, I did not notice the differences in the 2 signatures.

Thanks.

Irum Godil wrote:
Hi,

I have the following scenario:

An interface:

public interface SessionInterface {
void setAutoCommit(boolean autoCommit) throws HsqlException;

//other methods}

a class implementing the interface:

public class Session implements SessionInterface {

public void setAutoCommit(boolean autocommit) { ...}
}

Now, i would like to move this method declaration from the interface and the implementing class into an aspect. I do the following:

privileged aspect SessionAspect {

abstract void SessionInterface.setAutoCommit(boolean autoCommit) throws HsqlException;

public void Session.setAutoCommit(boolean autocommit) {
//method body
}

}
When I run the application, I keep getting error:

java.lang.AbstractMethodError: org.hsqldb.Session.ajc$interMethodDispatch2$aspects_atomicity_weave$setAutoCommit(Z)Vat aspects.atomicity.weave.SessionAspect.ajc$interMethodDispatch1$aspects_atomicity_weave_SessionAspect$org_hsqldb_SessionInterface$setAutoCommit(SessionAspect.aj)at aspects.atomicity.weave.JDBCConnectionAspect.ajc$after$aspects_atomicity_weave_JDBCConnectionAspect$1$f311d861(JDBCConnectionAspect.aj:112)
at org.hsqldb.jdbc.jdbcConnection.setAutoCommit(jdbcConnection.java:916)
at org.hsqldb.sample.IrumTest.(IrumTest.java:40)
at org.hsqldb.sample.IrumTest.main(IrumTest.java:130)
Exception in thread "main"
I had seen a similar problem in another application and as a workaround done the following instead of declaring an abstract method into the aspect. This had worked before, but in this scenario even this does not work.
void SessionInterface.setAutoCommit(boolean autoCommit) throws HsqlException
{
System.out.println("IRUM@");
if (this instanceof Session) {
System.out.println("IRUM2@");
Session s = (Session)this;
s.setAutoCommit(autoCommit);
}
else {
System.out.println("x");
}
}
I still keep getting the same error as above and also, none of the print statements are hit. I am not sure what am I doing wrong.

I will appreciate any help.
Thanks.
Sincerely,
Irum Godil.



Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!


Do you Yahoo!?
Make Yahoo! your home page

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users


Thanks,
Sincerely,
Irum Godil.

 

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


Back to the top