Community
Participate
Working Groups
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@california.com> 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@eclipse.org 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 f act 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.
Fixed many many abstractmethod problems since this was raised - just tried to recreate this but it works for me. presuming fixed.
That's a bug in the compiler, then?