eclipse - Aspectj for anotations with classes not working -
below code not complied correctly aspectj
import org.springframework.context.annotation.conditioncontext; import org.springframework.context.annotation.conditional; import org.springframework.context.annotation.configuration; import org.springframework.context.annotation.configurationcondition; import org.springframework.context.annotation.importresource; import org.springframework.core.type.annotatedtypemetadata; @configuration @conditional(conditionalconfiguration.condition) @importresource("/com/example/context-fragment.xml") public class conditionalconfiguration { static class condition implements configurationcondition { @override public configurationphase getconfigurationphase() { return configurationphase.parse_configuration; } @override public boolean matches(conditioncontext context, annotatedtypemetadata metadata) { // load context-fragment.xml if system property defined return system.getproperty("com.example.context-fragment") != null; } } }
i using eclipse aspectj tool. , error shown @conditional
annotation.
the @conditional
:
@retention(retentionpolicy.runtime) @target({elementtype.type, elementtype.method}) public @interface conditional { /** * {@link condition}s must {@linkplain condition#matches match} * in order component registered. */ class<? extends condition>[] value(); }
the error is:
org.aspectj.weaver.bcexception @ org.aspectj.ajdt.internal.core.builder.ajstate.recordclassfile(ajstate.java:1519) @ org.aspectj.ajdt.internal.core.builder.ajstate.noteresult(ajstate.java:1325) @ org.aspectj.ajdt.internal.core.builder.ajbuildmanager$3.acceptresult(ajbuildmanager.java:1061) @ org.aspectj.ajdt.internal.compiler.ajpipeliningcompileradapter.afterprocessing(ajpipeliningcompileradapter.java:426) @ org.aspectj.ajdt.intern ... .0_21-64\jre\lib\ext\sunmscapi.jar;e:\jdk1.7.0_21-64\jre\lib\ext\zipfs.jar;d:\eclipse\\plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar;
any idea how can make work, or @ least way can set eclipse aspectj tool ignore file.
i able reproduce problem. code wrong, not aspectj. change annotation value this:
@conditional(conditionalconfiguration.condition.class)
you forgot use .class
suffix. fix own code, compiler not complain anymore. ;-)
update: because bug should not kill aspectj compiler anyway, created bug ticket it, fact remains own code bogus.
Comments
Post a Comment