Bug 281452 - [aspects] aspect weaving fails when aspects registered via 'aspects' attribute of exported package
Summary: [aspects] aspect weaving fails when aspects registered via 'aspects' attribut...
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Runtime (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: equinox.incubator-inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks: 281342
  Show dependency tree
 
Reported: 2009-06-25 02:55 EDT by Erdal Karaca CLA
Modified: 2019-03-13 13:11 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erdal Karaca CLA 2009-06-25 02:55:37 EDT
This error raises:
java.lang.NoSuchMethodError: com.example.aspects.MyAspect.aspectOf()Lcom/example/aspects/MyAspect;

The weaver does not complain about this aspect not being valid.

When registering this aspect using the aop.xml, this errror will not occur.
Comment 1 Erdal Karaca CLA 2009-06-25 03:21:26 EDT
Just found out that doing the following will resolve this issue:

if (exportedAspects.size() > 0
                    || exportedConcreteAspects.size() > 0
                    || (allAspectsDefinition != null && allAspectsDefinition
                            .getWeaverOptions().length() > 0)) {
                final Definition exportedAspectsDefinition = new Definition();
                exportedAspectsDefinition.getAspectClassNames().addAll(
                        exportedAspects);
                exportedAspectsDefinition.getConcreteAspects().addAll(
                        exportedConcreteAspects);

                if (allAspectsDefinition != null
                        && allAspectsDefinition.getWeaverOptions().trim()
                                .length() > 0) {
                    exportedAspectsDefinition
                            .appendWeaverOptions(allAspectsDefinition
                                    .getWeaverOptions());
                }

                this.aspectDefinitionsExported.put(bundle,
                        exportedAspectsDefinition);
                        
                // add exportedAspectsDefinition to aspectDefinitions as well (bug?)
                this.aspectDefinitions.put(bundle, exportedAspectsDefinition);
            }
            
I am not sure, but maybe the weaving service is mixing up aspectDefinitions and exportedAspectsDefinition...
Comment 2 Martin Lippert CLA 2009-07-05 09:08:06 EDT
This is an issue when the aspect is not compiled with AJDT (or another aspect compiler). This is typically the case if you use @Aspect-style aspect programming and not compiling using AJDT.

I am not sure how this is related to the solution you mention, but I will try to find out... :-)
Comment 3 Erdal Karaca CLA 2009-07-07 03:16:29 EDT
Yes, I am using annotation style aspects.

But it is strange that adding exportedAspectsDefinition to aspectDefinitions resolves this.
Comment 4 Missing name CLA 2010-07-09 06:26:46 EDT
I also experience this bug whenever I compile @aspect annotated aspects with javac instead of ajc. This only happens with AspectJ 1.6.7 or newer!
Comment 5 Eclipse Genie CLA 2019-03-13 12:31:09 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 6 Thomas Watson CLA 2019-03-13 13:11:49 EDT
The aspect weaving component has moved.  I'm not sure if this bug is relevant anymore but moving to aspectj to close.