From cf9a42e2c35699ae328a9066665c7e8c55617e2f Mon Sep 17 00:00:00 2001 From: aclement Date: Wed, 25 Feb 2009 20:11:16 +0000 Subject: [PATCH] 266165: if(enabled) where enabled is constant boolean is optimized --- tests/bugs164/pr266165/AlwaysWeave.java | 11 ++++++++++ tests/bugs164/pr266165/AlwaysWeave2.java | 10 ++++++++++ tests/bugs164/pr266165/NeverWeave.java | 11 ++++++++++ tests/bugs164/pr266165/NeverWeave2.java | 9 +++++++++ .../systemtest/ajc164/Ajc164Tests.java | 16 +++++++++++++++ .../org/aspectj/systemtest/ajc164/ajc164.xml | 20 +++++++++++++++++++ 6 files changed, 77 insertions(+) create mode 100644 tests/bugs164/pr266165/AlwaysWeave.java create mode 100644 tests/bugs164/pr266165/AlwaysWeave2.java create mode 100644 tests/bugs164/pr266165/NeverWeave.java create mode 100644 tests/bugs164/pr266165/NeverWeave2.java diff --git a/tests/bugs164/pr266165/AlwaysWeave.java b/tests/bugs164/pr266165/AlwaysWeave.java new file mode 100644 index 000000000..2e8ba650a --- /dev/null +++ b/tests/bugs164/pr266165/AlwaysWeave.java @@ -0,0 +1,11 @@ +aspect A { + + public static final boolean enabled = true; + + before(): execution(* AlwaysWeave.*(..)) && if(enabled) {} + +} + +public class AlwaysWeave { + public void foo() {} +} diff --git a/tests/bugs164/pr266165/AlwaysWeave2.java b/tests/bugs164/pr266165/AlwaysWeave2.java new file mode 100644 index 000000000..3c158f59f --- /dev/null +++ b/tests/bugs164/pr266165/AlwaysWeave2.java @@ -0,0 +1,10 @@ +aspect A { + + + before(): execution(* AlwaysWeave2.*(..)) && if(true) {} + +} + +public class AlwaysWeave2 { + public void foo() {} +} diff --git a/tests/bugs164/pr266165/NeverWeave.java b/tests/bugs164/pr266165/NeverWeave.java new file mode 100644 index 000000000..85f5bbcd6 --- /dev/null +++ b/tests/bugs164/pr266165/NeverWeave.java @@ -0,0 +1,11 @@ +aspect A { + + public static final boolean enabled = false; + + before(): execution(* NeverWeave.*(..)) && if(enabled) {} + +} + +public class NeverWeave { + public void foo() {} +} diff --git a/tests/bugs164/pr266165/NeverWeave2.java b/tests/bugs164/pr266165/NeverWeave2.java new file mode 100644 index 000000000..4b77a1b29 --- /dev/null +++ b/tests/bugs164/pr266165/NeverWeave2.java @@ -0,0 +1,9 @@ +aspect A { + + before(): execution(* NeverWeave2.*(..)) && if(false) {} + +} + +public class NeverWeave2 { + public void foo() {} +} diff --git a/tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java b/tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java index 6e6542370..674700f6d 100644 --- a/tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java @@ -32,6 +32,22 @@ import org.aspectj.testing.XMLBasedAjcTestCase; 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"); // } diff --git a/tests/src/org/aspectj/systemtest/ajc164/ajc164.xml b/tests/src/org/aspectj/systemtest/ajc164/ajc164.xml index c2a62e69f..29bb149d8 100644 --- a/tests/src/org/aspectj/systemtest/ajc164/ajc164.xml +++ b/tests/src/org/aspectj/systemtest/ajc164/ajc164.xml @@ -1,6 +1,26 @@ + + + + + + + + + + + + + + + + + + + + -- 2.39.5