java - AspectJ doesn't weave an interface when the aspect is outside the interface -
when implement interface via inner static aspect impl
public interface eventspacesupplement { string geteventspace(); eventspacesupplement seteventspace(string name); ... static aspect impl { private string eventspacesupplement.eventspace; public string eventspacesupplement.geteventspace() { return this.eventspace; } public eventspacesupplement seteventspace(string eventspacename) { this.baseseteventspace(eventspacename); return this; } public eventspacesupplement baseseteventspace(string eventspacename) { this.eventspace = eventspacename; this.eventmanager = eventmanager.geteventlistenerforme(this.geteventspace(), this); return this; } ... } }
it works fine. files woven properly. doesn't work i'm trying separate aspect , interface 2 files:
public aspect eventspacesupplimenta { private string eventspacesupplement.eventspace; public string eventspacesupplement.geteventspace() { return this.eventspace; } public eventspacesupplement seteventspace(string eventspacename) { this.baseseteventspace(eventspacename); return this; } public eventspacesupplement baseseteventspace(string eventspacename) { this.eventspace = eventspacename; this.eventmanager = eventmanager.geteventlistenerforme(this.geteventspace(), this); return this; } ... }
and
public interface eventspacesupplement { string geteventspace(); eventspacesupplement seteventspace(string name); }
the class doesn't woven:
public class testclass extends timplements eventspacesupplement { @override public eventspacesupplement seteventspace(string eventspacename) { this.baseseteventspace(eventspacename); ... return this; } }
idea looks fine in both cases, navigates through ctl+left click. class not woven , ajc complation error.
problem solved magical tambourine. adding java default implementation stubs. example:
public interface eventspacesupplement { default string geteventspace(){return null;} }
rebuild. eventspacesupplimenta caused compilaion override error. then remove default implementation back.
the code absolutely same. after manipulation aspects inexplicably began woven.
Comments
Post a Comment