Community
Participate
Working Groups
Build ID: M20071023-1652 Steps To Reproduce: More information: Methods Eclipse-SupplementExporter and Eclipse-SupplementBundle (I use these two) often propagate aspects configuration (aop.xml) to other bundles, that should not be weaved. It denies for example using pointcut within(*) because it will be propagated and used in other bundles, not exactly in the ones declared as Eclipse-Supplement. For example log check: https://bugs.eclipse.org/bugs/show_bug.cgi?id=217037
Can you provide some more details on this? Currently I am not able to find out which bundles are supplemented in the wrong way.
Wojciech, can you check if this observation is still true using the new supplementing mechanism?
I've found origin of this problem. We often use in our bundles' manifests line: DynamicImport-Package: * If there is such line in manifest, bundle see all aop.xml files in all bundles and is weaved by them. It'd be nice to ommit all dynamic imported packages and weave only bundles which have statically imported package/bundle with aop.xml (or which uses eclipse-supplement convention).
This seems to be a tricky problem. The aspect weaving implementation uses the standard classloader mechanisms to load the aop.xml files. Therefore dynamically imported packages are found as well. Do you really need to use "Dynamic-ImportPackage: *" ?
Created attachment 90192 [details] Patch which solves the problem Yes we need to use dynamic imports. But I solved problem, by changing OSGiWeavingContext class. It's partially a hack, but consider using it.
You are right. I thought about this problem a lot too complicated. Since aspect bundles are added to the bundle as a required bundle (supplementer-mechanism) its enough to check if the aop.xml files that are used to configure the weaver are coming from required bundles.
I need to check some other usage scenarios and try to solve this problem using your patch. Thanks a lot for your contribution!!!
btw, I noticed your BREE was set to: +Bundle-RequiredExecutionEnvironment: J2SE-1.3,J2SE-1.4,J2SE-1.5 This is wrong, it should just be J2SE-1.3, a BREE implies minimum execution env
Ah, okay. Will fix this. Thanks!!!
I found problem with my patch. If bundle contains aop.xml, it isn't used to weave own classes. But it's easy to repair. Just modify the following code: String bundleName = getBundleIdFromURL(xml); for (int i=0; i<requires.length; i++){ by adding right "if", just like that: String bundleName = getBundleIdFromURL(xml); if (bundle.getSymbolicName().equals(bundleName)){ modified.add(xml); continue; } for (int i=0; i<requires.length; i++){ It works much better.
Hi Wojciech, I tried your patch and your small addition to the patch and it looks good. I added the handling of fragments to it (needed for opt-in model). Will test some more stuff with it and release the code then. I am not sure if we need to add handling of imported (not dynamically imported) packages, but I will find out. Thanks again for your contribution!!!
Fixed - code releaed into HEAD. Applied the contributed path with additional fragment handling.