Skip to main content

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

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.<init>(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!

Back to the top