[
https://jira.jboss.org/browse/JBAOP-731?page=com.atlassian.jira.plugin.sy...
]
Andrew Dinn commented on JBAOP-731:
-----------------------------------
I think you are right to be confused that javac complains that
POJO2 is not abstract and does not override abstract method _getAdvisor() in
org.jboss.aop.Advised
when javap shows that POJO1 implements Advisable and indeed contains a non-abstract
_getAdvisor() method. This seems to be very wrong. But it's not an AOP problem. This
is the compiler failign to eat what looks liek legitimate bytecode.
The reason javac is discounting this method is because it is tagged with the SYNTHETIC
attribute -- all AOP -generated methods are so tagged. I checked the javac source code in
OpenJDK and for some reason it explicitly discounts SYNTHETIC implementation methods when
attempting to verify that a non-abstract class implements all inherited abstract methods
(that includes interface methods which are implicitly taken to be abstract).
Now I don't know of anything in the JVM spec which states that a SYNTHETIC
implementation method is not a valid implementation of an abstract method. I believe this
is a bug in javac. What it looks like it is doing (and doing wrongly) is attempting to
discount so-called 'Miranda methods', i.e. pseudo-methods installed during
compilation as markers for an unimplemented abstract method. These are tagged with
attribute flags SYNTHETIC, ABSTRACT and IPROXY, a special flag used only by javac. I
believe the check which discounts an implementation method should look for flag IPROXY,
not flag SYNTHETIC. Thsi may be a hangover form earlier code as IPROXY appears to be a
recent introduction.
I will raise this as an issue with the OpenJDK team and see if we can agree that it is a
bug and push a fix through into OpenJDK and, from there, the Sun JVM. Until this is fixed
we cannot fix AOP. It is not possilble to remove the SYNTHETIC tag from AOP generated
methods as this will cause other problems (see
https://jira.jboss.org/browse/JBAOP-642 and
https://jira.jboss.org/browse/JBAOP-782).
problem with javac->aopc->javac sequence
----------------------------------------
Key: JBAOP-731
URL:
https://jira.jboss.org/browse/JBAOP-731
Project: JBoss AOP
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: 2.1.1.GA
Environment: JDK 1.6.0_13/32bit
Reporter: Konstantin Sobolev
Attachments: bug.tar.gz, POJO.j
I'm trying to switch from JBossAOP 1.5.6 to 2.1.1 and can't build my project,
looks like there are some problems with aop-compiled classes. Here's what happens:
first we build our interface classes, let's say there's *abstract* POJO1 among
them. Then we run AopC on them, and it modifies POJO1.class
Then we compile some more classes, and there's non-abstract POJO2 there, which
extends POJO1. At this time javac fails with this message:
POJO2 is not abstract and does not override abstract method _getAdvisor() in
org.jboss.aop.Advised
javap shows that POJO1 now implements Advisable and indeed contains _getAdvisor() method,
but this method is not abstract! I'm confused.
Running AopC after compiling all of the classes works fine. Making POJO1 non-abstract
also makes javac happy.
I'm attaching a testcase. Unpack it into
jboss-aop-2.1.1.GA/docs/aspect-framework/examples/bug and run ant there to reproduce the
problem.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira