Hi, Ths issues was resolved in the bugzilla. I asked about that because I needed this code. This is working now.
public interface StateTransition { StateTransition activate(); StateTransition deActivate(); } public enum AStateTransition implements StateTransition{ ACTIVATE(new Activation()), DEACTIVATE(new DeActivation()); private final StateTransition stateTransition; private AStateTransition(StateTransition stateTransition) { this.stateTransition = stateTransition; } @Overridepublic StateTransition activate() { return stateTransition.activate(); } @Overridepublic StateTransition deActivate() { return stateTransition.deActivate(); } } public class Activation implements StateTransition { public StateTransition activate() { return AStateTransition.ACTIVATE; } @Overridepublic StateTransition deActivate() { return AStateTransition.DEACTIVATE; } } public class DeActivation implements StateTransition { public StateTransition deActivate() { return AStateTransition.DEACTIVATE; } @Overridepublic StateTransition activate() { return AStateTransition.ACTIVATE; } } @Aspect() public class StateChangeAspect { //Could be more generic so that all implemented methods //are covered @Pointcut("execution(* AStateTransition.activate()) && target(stateTransition) && if()") public static boolean stateChangePointcut( AStateTransition stateTransition ){ return AStateTransition.ACTIVATE == stateTransition; } @Before("stateChangePointcut(stateTransition)") public void test1( AStateTransition stateTransition ) { System.out.println( " aspect " ); } @Before("stateChangePointcut(stateTransition)") public void test1(JoinPoint joinPoint, AStateTransition stateTransition) { System.out.println(joinPoint + " -> " + stateTransition); } } Thanks, Mohan On Wed, Oct 21, 2020 at 9:10 PM Andy Clement <andrew.clem...@gmail.com> wrote: > Hey, > > It is quite an old issue. I thought I'd done something around enum > matching but I can't find it - I think maybe it was just in the context of > enums used in annotation values. Re-reading the issue now I don't see > exactly what it is asking for "Enum code requires Enum value JoinPoints." > - if it is enum specific joinpoints, I am super nervous about adding new > joinpoints because suddenly they will start affecting all existing code > that was using wildcards. If you just want to guard on joinpoints related > to enum related operations there are type category patterns in > https://www.eclipse.org/aspectj/doc/released/README-169.html > > Is it asking for static matching (vs runtime/dynamic matching) in join > points related to enums, that feels like it could be done without new join > points, just needs some improvements in the matching algorithm to recognize > enums in use. > > cheers, > Andy > > On Wed, 21 Oct 2020 at 07:12, Mohan Radhakrishnan < > radhakrishnan.mo...@gmail.com> wrote: > >> Hi, >> https://bugs.eclipse.org/bugs/show_bug.cgi?id=248681#c2 >> >> This was a very old request I raised. I think the comment there means >> this is already implemented. >> >> But AJDT doesn't apply the pointcut. Was this implemented ? >> >> Thanks, >> Mohan >> _______________________________________________ >> aspectj-users mailing list >> aspectj-users@eclipse.org >> To unsubscribe from this list, visit >> https://www.eclipse.org/mailman/listinfo/aspectj-users >> > _______________________________________________ > aspectj-users mailing list > aspectj-users@eclipse.org > To unsubscribe from this list, visit > https://www.eclipse.org/mailman/listinfo/aspectj-users >
_______________________________________________ aspectj-users mailing list aspectj-users@eclipse.org To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/aspectj-users