--- /dev/null
+aspect A {
+
+ public static final boolean enabled = true;
+
+ before(): execution(* AlwaysWeave.*(..)) && if(enabled) {}
+
+}
+
+public class AlwaysWeave {
+ public void foo() {}
+}
--- /dev/null
+aspect A {
+
+
+ before(): execution(* AlwaysWeave2.*(..)) && if(true) {}
+
+}
+
+public class AlwaysWeave2 {
+ public void foo() {}
+}
--- /dev/null
+aspect A {
+
+ public static final boolean enabled = false;
+
+ before(): execution(* NeverWeave.*(..)) && if(enabled) {}
+
+}
+
+public class NeverWeave {
+ public void foo() {}
+}
--- /dev/null
+aspect A {
+
+ before(): execution(* NeverWeave2.*(..)) && if(false) {}
+
+}
+
+public class NeverWeave2 {
+ public void foo() {}
+}
public class Ajc164Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
+ public void testOptimizingIf_pr266165_1() {
+ runTest("optimizing if for constant reference - 1");
+ }
+
+ public void testOptimizingIf_pr266165_2() {
+ runTest("optimizing if for constant reference - 2");
+ }
+
+ public void testOptimizingIf_pr266165_3() {
+ runTest("optimizing if for constant reference - 3");
+ }
+
+ public void testOptimizingIf_pr266165_4() {
+ runTest("optimizing if for constant reference - 4");
+ }
+
// public void testAnnoInherited_pr265695() {
// runTest("anno inherited");
// }
<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>
<suite>
+
+ <ajc-test dir="bugs164/pr266165" title="optimizing if for constant reference - 1">
+ <compile files="NeverWeave.java" options="-1.5 -Xlint:ignore -showWeaveInfo"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs164/pr266165" title="optimizing if for constant reference - 2">
+ <compile files="AlwaysWeave.java" options="-1.5 -showWeaveInfo">
+ <message kind="weave" text="Join point"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs164/pr266165" title="optimizing if for constant reference - 3">
+ <compile files="NeverWeave2.java" options="-1.5 -Xlint:ignore -showWeaveInfo"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs164/pr266165" title="optimizing if for constant reference - 4">
+ <compile files="AlwaysWeave2.java" options="-1.5 -showWeaveInfo">
+ <message kind="weave" text="Join point"/>
+ </compile>
+ </ajc-test>
<ajc-test dir="bugs164/pr265695" title="anno inherited">
<compile files="Asp.aj" options="-showWeaveInfo -1.5">