org.aspectj/tests/bugs/perCflowAndJar/PerCFlowCompileFromJar.java
jhugunin 5a07dcee3a fix and test for Bugzilla Bug 41359
percflow aspects compiled from jars share one instance for all entry points
2003-08-28 21:44:55 +00:00

21 lines
534 B
Java

public abstract aspect PerCFlowCompileFromJar percflow( topOfFlow() ){
private boolean thisAspectInstanceIsDead = false;
protected abstract pointcut entryPoint();
protected pointcut topOfFlow(): entryPoint() && !cflowbelow( entryPoint() );
after() : topOfFlow() {
this.killThisAspectInstance();
}
protected void killThisAspectInstance(){
if (thisAspectInstanceIsDead)
throw new IllegalStateException("This aspect instance has been used and can't be used again.");
else
thisAspectInstanceIsDead = true;
}
}