Bug 41359 - percflow aspects compiled from jars share one instance for all entry points
Summary: percflow aspects compiled from jars share one instance for all entry points
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.1.1   Edit
Hardware: PC Windows 2000
: P2 major (vote)
Target Milestone: 1.1.1   Edit
Assignee: Jim Hugunin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-09 11:19 EDT by Chris Bozic CLA
Modified: 2003-08-28 17:38 EDT (History)
1 user (show)

See Also:


Attachments
test project with build.xml (2.21 KB, application/octet-stream)
2003-08-26 17:07 EDT, Chris Bozic CLA
no flags Details
decompiled normally compiled code (4.15 KB, text/plain)
2003-08-28 13:19 EDT, Chris Bozic CLA
no flags Details
decompiled jar compiled code (3.29 KB, text/plain)
2003-08-28 13:20 EDT, Chris Bozic CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Bozic CLA 2003-08-09 11:19:18 EDT
When a percflow aspect is woven into source code from a jar using the aspectPath
compiler option, it produces only one instance of the aspect for each entrypoint
defined in the source code.
Comment 1 Jim Hugunin CLA 2003-08-25 13:22:25 EDT
This bug needs a self-contained example in order to be verified and fixed.  Here
are two examples of bug reports for similar bugs that contained good examples:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=39462
https://bugs.eclipse.org/bugs/show_bug.cgi?id=41123

It would be very valuable to us if you could provide a similar example for this
bug.  Thanks for your help.
Comment 2 Chris Bozic CLA 2003-08-26 17:07:47 EDT
Created attachment 5863 [details]
test project with build.xml

Here's a test case that demonstrates the bug.  The default ant target tests the
aspect code first compiled along with the test and then tests a second time
with the aspect in a jar and the testcase compiled with the jar in the aspect
path.

To use the build.xml in this project, you'll need to create a lib folder in the
project containing aspectjrt.jar, aspecttools.jar, and junit.jar.  Also, in
order for the ant tasks to work, it will be a good idea to drop junit jar in
ANT_HOME/lib

The results of both tests can be found in html form under ./dist/junit_output
Comment 3 Chris Bozic CLA 2003-08-28 13:19:11 EDT
Created attachment 5898 [details]
decompiled normally compiled code

Shows attached (normally compiled) test code after being decompiled
Comment 4 Chris Bozic CLA 2003-08-28 13:20:25 EDT
Created attachment 5899 [details]
decompiled jar compiled code

Shows attached (compiled from jar) test code after being decompiled
Comment 5 Jim Hugunin CLA 2003-08-28 17:38:00 EDT
This is a great test case and easy to reproduce.  I've raised this to a P2 bug.
 The general problem is that any code that extends an abstract aspect from a
.jar file does not inherit the per-clause from the super-aspect, so all such
aspects behave like persingletons.  This is true for percflow, pertarget and
perthis.

The simple work-around is to explicitly include the per-clause in the concrete
aspects declaration, i.e.:
    aspect MyTestPerCFlowEntryPoint extends PerCFlowCompileFromJar     
             percflow(topOfFlow())  {

The bug is now fixed in the tree and should be in the 1.1.1 release.