Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AspectJ » Problem with "Eclipse-SupplementBundle: *"
Problem with "Eclipse-SupplementBundle: *" [message #641897] Mon, 29 November 2010 08:14
Csaba Koncz is currently offline Csaba KonczFriend
Messages: 49
Registered: July 2009
Member
Hi all,

I am rather new to AspectJ and Equinox Weaving. Despite this I set off to build an Eclipse view that would present the current SWT Controls hierarchy. As the SWT Composite, unlike the AWT Container, does not fire componentAdded events, I came up with an aspect that would intercept all Control creation and let the CompositeListeners be notified about such events.
(CompositeListener is my own interface, as no such thing exists in SWT)

I am using the annotation-based development style, so my aspect that decorates SWT Composite with the CompositeListener support and intercepts Control constructor calls looks like this:

@Aspect
public class CompositeAspect
{
@DeclareParents(value ="org.eclipse.swt.widgets.Composite",
defaultImpl = CompositeExtImpl.class)
ICompositeExt compositeExt;

@AfterReturning(pointcut = "call(org.eclipse.swt.widgets.Control+.new(..))",
returning = "control")
public void afterCallControlConstructor(Control control)
{
Composite parent = c.getParent();
if (parent instanceof ICompositeExt)
{
//aspect was applied, the composite parent has listener support
ICompositeExt compositeExt = (ICompositeExt) parent;
compositeExt.fireControlAdded(control);
}
}
}

This is fine and almost works. When developing this aspect, in the bundle manifest I specified
Eclipse-SupplementBundle: org.eclipse.swt,org.eclipse.jface,org.eclipse.ui,org.eclipse .ui.*

which is enough for enhancing the Composite and catching some of the control creation. However, as controls can be created anywhere by user code, in any bundle, I need to change the directive to
Eclipse-SupplementBundle: *

If I do this, the Eclipse lauch fails with the famous NoSuchMethodError: aspectOf

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.ui.internal.WorkbenchPlugin.getSplashShell(Workb enchPlugin.java:1289)
at org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:95)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Caused by: java.lang.NoSuchMethodError: com.ck.swtcontrols.aspects.CompositeAspect.aspectOf()Lcom/ck /swtcontrols/aspects/CompositeAspect;
at org.eclipse.swt.widgets.Shell.internal_new(Shell.java:418)
... 19 more
Root exception:
java.lang.NoSuchMethodError: com.ck.swtcontrols.aspects.CompositeAspect.aspectOf()Lcom/ck /swtcontrols/aspects/CompositeAspect;
at org.eclipse.swt.widgets.Shell.internal_new(Shell.java:418)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.ui.internal.WorkbenchPlugin.getSplashShell(Workb enchPlugin.java:1289)
at org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:95)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)

How can I fix this (apart from adding the missing method by hand, as suggested on http://dev.eclipse.org/mhonarc/lists/aspectj-users/msg11829. html)?
Thank you in advance,
Csaba Koncz
Previous Topic:New to AspectJ
Next Topic:How to capture a caller in an aspect
Goto Forum:
  


Current Time: Fri Apr 26 20:17:43 GMT 2024

Powered by FUDForum. Page generated in 0.03316 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top