import org.aspectj.lang.annotation.*; | |||||
import org.aspectj.lang.*; | |||||
@Aspect | |||||
class MyAspect { | |||||
@After("staticinitialization(*)") | |||||
public void x(JoinPoint.StaticPart thisJoinPointStaticPart) { | |||||
System.out.println("after initialization "+thisJoinPointStaticPart); | |||||
} | |||||
} | |||||
public aspect AnnStyle { | |||||
static { | |||||
} | |||||
public static void main(String []argv) { | |||||
System.out.println("InstanceExists?"+Aspects.hasAspect(MyAspect.class)); | |||||
} | |||||
} |
import org.aspectj.lang.*; | |||||
aspect MyAspect { | |||||
after(): staticinitialization(*) { | |||||
System.out.println("after initialization "+thisJoinPointStaticPart); | |||||
} | |||||
} | |||||
public aspect CodeStyle { | |||||
static { | |||||
} | |||||
public static void main(String []argv) { | |||||
System.out.println("InstanceExists?"+Aspects.hasAspect(MyAspect.class)); | |||||
} | |||||
} |
// public void testArgnamesAndJavac_pr148381() { runTest("argNames and javac");} | // public void testArgnamesAndJavac_pr148381() { runTest("argNames and javac");} | ||||
// public void testCFlowXMLAspectLTW_pr149096() { runTest("cflow xml concrete aspect"); } | // public void testCFlowXMLAspectLTW_pr149096() { runTest("cflow xml concrete aspect"); } | ||||
// public void testAmbiguousBinding_pr121805() { runTest("ambiguous binding");} | // public void testAmbiguousBinding_pr121805() { runTest("ambiguous binding");} | ||||
public void testIncorrectDeprecatedAnnotationProcessing_pr154332() { runTest("incorrect deprecated annotation processing");} | |||||
public void testIncorrectStaticinitializationWeaving_pr149560_1() { runTest("incorrect staticinitialization weaving - codestyle");} | |||||
public void testIncorrectStaticinitializationWeaving_pr149560_2() { runTest("incorrect staticinitialization weaving - annstyle");} | |||||
public void testIncorrectDeprecatedAnnotationProcessing_pr154332() { runTest("incorrect deprecated annotation processing");} | |||||
public void testPipeliningProblemWithAnnotationsDecp_pr153380_1() { runTest("pipelining decps");} | public void testPipeliningProblemWithAnnotationsDecp_pr153380_1() { runTest("pipelining decps");} | ||||
public void testUnwantedPointcutWarning_pr148219() { runTest("unwanted warning for pointcut");} | public void testUnwantedPointcutWarning_pr148219() { runTest("unwanted warning for pointcut");} | ||||
public void testDecpAndCflowadderMungerClash_pr152631() { runTest("decp and cflowadder munger clash");} | public void testDecpAndCflowadderMungerClash_pr152631() { runTest("decp and cflowadder munger clash");} |
</run> | </run> | ||||
</ajc-test> | </ajc-test> | ||||
<ajc-test dir="bugs153/pr149560" title="incorrect staticinitialization weaving - codestyle"> | |||||
<compile files="CodeStyle.java" options="-1.5 -showWeaveInfo"> | |||||
<message kind="weave" text="Join point 'staticinitialization(void MyAspect.<clinit>())' in Type 'MyAspect' (CodeStyle.java:3) advised by after advice from 'MyAspect' (CodeStyle.java:4)"/> | |||||
<message kind="weave" test="Join point 'staticinitialization(void CodeStyle.<clini>())' in Type 'CodeStyle' (CodeStyle.java:9) advised by after advice from 'MyAspect' (CodeStyle.java:4)"/> | |||||
</compile> | |||||
<run class="CodeStyle"> | |||||
<stdout> | |||||
<line text="after initialization staticinitialization(MyAspect.<clinit>)"/> | |||||
<line text="after initialization staticinitialization(CodeStyle.<clinit>)"/> | |||||
<line text="InstanceExists?true"/> | |||||
</stdout> | |||||
</run> | |||||
</ajc-test> | |||||
<ajc-test dir="bugs153/pr149560" title="incorrect staticinitialization weaving - annstyle"> | |||||
<compile files="AnnStyle.java" options="-1.5 -showWeaveInfo"> | |||||
<message kind="weave" text="Join point 'staticinitialization(void MyAspect.<clinit>())' in Type 'MyAspect' (AnnStyle.java:5) advised by after advice from 'MyAspect' (AnnStyle.java:7)"/> | |||||
<message kind="weave" test="Join point 'staticinitialization(void AnnStyle.<clini>())' in Type 'AnnStyle' (AnnStyle.java:12) advised by after advice from 'MyAspect' (AnnStyle.java:7)"/> | |||||
</compile> | |||||
<run class="AnnStyle"> | |||||
<stdout> | |||||
<line text="after initialization staticinitialization(MyAspect.<clinit>)"/> | |||||
<line text="after initialization staticinitialization(AnnStyle.<clinit>)"/> | |||||
<line text="InstanceExists?true"/> | |||||
</stdout> | |||||
</run> | |||||
</ajc-test> | |||||
</suite> | </suite> |
assertTrue("Should be zero but reports "+EclipseFactory.debug_mungerCount,EclipseFactory.debug_mungerCount==0); | assertTrue("Should be zero but reports "+EclipseFactory.debug_mungerCount,EclipseFactory.debug_mungerCount==0); | ||||
alter("PR141956","inc1"); | alter("PR141956","inc1"); | ||||
build("PR141956"); | build("PR141956"); | ||||
assertTrue("Should be only one but reports "+EclipseFactory.debug_mungerCount,EclipseFactory.debug_mungerCount==1); | |||||
assertTrue("Should be two but reports "+EclipseFactory.debug_mungerCount,EclipseFactory.debug_mungerCount==2); | |||||
alter("PR141956","inc1"); | alter("PR141956","inc1"); | ||||
build("PR141956"); | build("PR141956"); | ||||
assertTrue("Should be only one but reports "+EclipseFactory.debug_mungerCount,EclipseFactory.debug_mungerCount==1); | |||||
assertTrue("Should be two but reports "+EclipseFactory.debug_mungerCount,EclipseFactory.debug_mungerCount==2); | |||||
alter("PR141956","inc1"); | alter("PR141956","inc1"); | ||||
build("PR141956"); | build("PR141956"); | ||||
assertTrue("Should be only one but reports "+EclipseFactory.debug_mungerCount,EclipseFactory.debug_mungerCount==1); | |||||
assertTrue("Should be two but reports "+EclipseFactory.debug_mungerCount,EclipseFactory.debug_mungerCount==2); | |||||
alter("PR141956","inc1"); | alter("PR141956","inc1"); | ||||
build("PR141956"); | build("PR141956"); | ||||
assertTrue("Should be only one but reports "+EclipseFactory.debug_mungerCount,EclipseFactory.debug_mungerCount==1); | |||||
assertTrue("Should be two but reports "+EclipseFactory.debug_mungerCount,EclipseFactory.debug_mungerCount==2); | |||||
} | } | ||||
clinit.getBody().append(il); | clinit.getBody().append(il); | ||||
clinit.addExceptionHandler( | clinit.addExceptionHandler( | ||||
tryStart, handler, handler, new ObjectType("java.lang.Throwable"), false | |||||
tryStart, handler.getPrev(), handler, new ObjectType("java.lang.Throwable"), false | |||||
); | ); | ||||
} | } | ||||
if (inAspect.isAnnotationStyleAspect() && !inAspect.isAbstract()) { | if (inAspect.isAnnotationStyleAspect() && !inAspect.isAbstract()) { | ||||
//TODO will those change be ok if we add a serializable aspect ? | //TODO will those change be ok if we add a serializable aspect ? | ||||
// dig: "can't be Serializable/Cloneable unless -XserializableAspects" | // dig: "can't be Serializable/Cloneable unless -XserializableAspects" | ||||
inAspect.crosscuttingMembers.addLateTypeMunger( | |||||
inAspect.getWorld().makePerClauseAspect(inAspect, getKind()) | |||||
); | |||||
if (getKind()==SINGLETON) { // pr149560 | |||||
inAspect.crosscuttingMembers.addTypeMunger( | |||||
inAspect.getWorld().makePerClauseAspect(inAspect, getKind()) | |||||
); | |||||
} else { | |||||
inAspect.crosscuttingMembers.addLateTypeMunger( | |||||
inAspect.getWorld().makePerClauseAspect(inAspect, getKind()) | |||||
); | |||||
} | |||||
} | } | ||||
//ATAJ inline around advice support | //ATAJ inline around advice support |