AspectJ Support
I have created an aspect that currently injects some fields into an interface at compile time. The interface is implemented by a class and when i call the field and add a value to it everything works as expected. However IntelliJ shows the field as an error in the editor and also its not showing up in the list of available fields by the auto complete.discovery functions.
Is this a limitation of the IDE or have I missed some type of config?
Aspect Code:
@Component
public aspect EventAspect {
public interface EventMetaData {}
declare parents : (@com.eventdatainjection.aspectevent.annotation.Event *) implements EventMetaData;
public UUID EventMetaData.aggregateId;
public UUID EventMetaData.eventId;
public UUID EventMetaData.getAggregateId() {return aggregateId;}
public UUID EventMetaData.getEventId() {return eventId;}
public void EventMetaData.setAggregateId(UUID id) {aggregateId = id;}
public void EventMetaData.setEventId(UUID id) {eventId = id;}
}
@SpringBootApplication
@EnableAspectJAutoProxy
public class AspectEventApplication {
public static void main(String[] args) {
AccountCreated ac = new AccountCreated();
- ac.setAggregateId(UUID.randomUUID()); // This shows up as red in the IDE
System.out.println("Aggregate ID = " + ac.getAggregateId());
AnotherEvent ev = new AnotherEvent();
- ev.setEventId(UUID.randomUUID()); // This shows up as red in the IDE
System.out.println("Event ID = " + ev.getEventId());
}
}
Please sign in to leave a comment.
Here is the generated class file