Sunday, 11 August 2013

Create an Aspect with AJDT in former Java Project

Create an Aspect with AJDT in former Java Project

I decided to handle a problem in a Java project with AOP, so I installed
AJDT 2.2.3 in my Eclipse Kepler. Everything seemed to work fine, as I can
create a new AspectJ project and create aspects and everything works as it
should. Aspects are properly woven and execute as I expected. After that I
tried to integrate AspectJ in my already existing Java project. I
converted it by using Configure > Convert to AspectJ Project. Still
everything works fine, but when I come to the point of actually create an
aspect in this project using the create aspect wizard, I encounter the
folling error message: Creation of element failed. See error log for more
details. I can still finish the wizard, but the created aspect file looks
different to the aspect files created in my first attempts in a AspectJ
Project.

If I edit the created file, the same aspect that worked in the first try
in a original AspectJ Project don't seem to have any effect.
The log message (some lines in between omitted):
java.lang.reflect.InvocationTargetException
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:421)
at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:1028)
at
org.eclipse.jdt.internal.ui.wizards.NewElementWizard.performFinish(NewElementWizard.java:134)
...
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
Caused by: java.lang.NullPointerException
at
org.eclipse.ajdt.internal.ui.wizards.AJNewTypeWizardPage.ajc$interMethod$org_eclipse_ajdt_internal_ui_wizards_AJNewTypeWizardPage$org_eclipse_ajdt_internal_ui_wizards_NewTypeWizardPage$createAJType(AJNewTypeWizardPage.aj:267)
at
org.eclipse.ajdt.internal.ui.wizards.NewTypeWizardPage.ajc$interMethodDispatch2$org_eclipse_ajdt_internal_ui_wizards_AJNewTypeWizardPage$createAJType(NewTypeWizardPage.java:1)
at
org.eclipse.ajdt.internal.ui.wizards.AJNewTypeWizardPage.ajc$interMethodDispatch1$org_eclipse_ajdt_internal_ui_wizards_AJNewTypeWizardPage$org_eclipse_ajdt_internal_ui_wizards_NewTypeWizardPage$createAJType(AJNewTypeWizardPage.aj)
...
org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5331)
at
org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:106)
at
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Does anybody know what this error wants to tell me and what I can do to
use aspects in my project?

No comments:

Post a Comment