Community
Participate
Working Groups
I have an library with an aspect that includes advice, which I compile into an outjar. In my client project I extend it, and make a concrete pointcut that results in the library aspect affecting parts of my system. There is a bug and an enhancement request here: 1) A bug: when you look at the structure view for affected classes, there is a problem if you try to navigate from calls to advice (in AJDT, it results in an NPE). Here is the stack trace in AJDT: java.lang.NullPointerException at org.aspectj.asm.internal.ProgramElement.toLinkLabelString (ProgramElement.java:403) at org.eclipse.ajdt.internal.core.AJDTStructureViewNode.getLabel (AJDTStructureViewNode.java:171) at org.eclipse.ajdt.internal.core.AJDTStructureViewNodeAdapter.getLabel (AJDTStructureViewNodeAdapter.java:89) at org.eclipse.ui.model.WorkbenchLabelProvider.getText (WorkbenchLabelProvider.java:142) at org.eclipse.jface.viewers.TreeViewer.doUpdateItem(TreeViewer.java:95) at org.eclipse.jface.viewers.AbstractTreeViewer$UpdateItemSafeRunnable.run (AbstractTreeViewer.java:87) at org.eclipse.core.internal.runtime.InternalPlatform.run (InternalPlatform.java:1006) at org.eclipse.core.runtime.Platform.run(Platform.java:413) at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem (AbstractTreeViewer.java:406) at org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.run (StructuredViewer.java:119) at org.eclipse.core.internal.runtime.InternalPlatform.run (InternalPlatform.java:1006) at org.eclipse.core.runtime.Platform.run(Platform.java:413) at org.eclipse.jface.viewers.StructuredViewer.updateItem (StructuredViewer.java:1271) at org.eclipse.jface.viewers.AbstractTreeViewer.createTreeItem (AbstractTreeViewer.java:320) at org.eclipse.jface.viewers.AbstractTreeViewer$1.run (AbstractTreeViewer.java:303) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.jface.viewers.AbstractTreeViewer.createChildren (AbstractTreeViewer.java:289) at org.eclipse.jface.viewers.AbstractTreeViewer.handleTreeExpand (AbstractTreeViewer.java:697) at org.eclipse.jface.viewers.AbstractTreeViewer$4.treeExpanded (AbstractTreeViewer.java:709) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:175) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:81) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:840) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:865) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:849) at org.eclipse.swt.widgets.Tree.wmNotifyChild(Tree.java:1909) at org.eclipse.swt.widgets.Control.WM_NOTIFY(Control.java:3815) at org.eclipse.swt.widgets.Composite.WM_NOTIFY(Composite.java:642) at org.eclipse.swt.widgets.Control.windowProc(Control.java:2816) at org.eclipse.swt.widgets.Display.windowProc(Display.java:2361) at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method) at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:1236) at org.eclipse.swt.widgets.Tree.callWindowProc(Tree.java:156) at org.eclipse.swt.widgets.Tree.WM_LBUTTONDOWN(Tree.java:1517) at org.eclipse.swt.widgets.Control.windowProc(Control.java:2799) at org.eclipse.swt.widgets.Display.windowProc(Display.java:2361) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1303) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1543) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1402) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1385) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:858) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) 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.core.launcher.Main.basicRun(Main.java:291) at org.eclipse.core.launcher.Main.run(Main.java:747) at org.eclipse.core.launcher.Main.main(Main.java:583) 2) The enhancement request: the concrete aspect that applies the advice should also show what is affected in the project. Of course, it would also be nice to see how a given concrete library aspect in the aspect path affects your project too.
The bad news is that the NPE shows in the typical uninformative Eclipse dialog. The good news is that once the user click's "OK" there are no problems other than the lack of a label for that node. The problem stems from the fact that I never implemented the case of structure model elements living inside JARs. I've fixed this, added a corresponding test project to AJDT, and added some UI support to make it clear when something is being advised by an aspect in an injar. Since navigating to the sourceline of the aspect in the injar is not possible the label is grayed-out. Also note that I finally added hyperlink style coloring to the link nodes in the outline (by adding an AspectJLabelProvider). So it's all working in CVS. But the label for injar could be improved (e.g. give the path to the injar, and the full signature of the advice). That's doable but might require us to change the IProgramElement String handle format, since elements in bytecode aren't naturally identified by sourcelines-- so at the moment we can only look up the sourcefile containing the aspect.