aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2019-09-11 08:35:17 -0700
committerAndy Clement <aclement@pivotal.io>2019-09-11 08:35:17 -0700
commitaa4e441fca78dfc36f6a78c0f7b922718f352b04 (patch)
treedb2f8157586ac2a520719e70fb956223e643aeda /tests
parentd8821e28d6e4b59ab451dc166e96698646a6e750 (diff)
downloadaspectj-aa4e441fca78dfc36f6a78c0f7b922718f352b04.tar.gz
aspectj-aa4e441fca78dfc36f6a78c0f7b922718f352b04.zip
Moved tests around for avoiding weaving switch infrastructure method
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs195/switch/Azpect.java5
-rw-r--r--tests/bugs195/switch/HelloWorldEnumSwitch.java22
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc195/Ajc195Tests.java4
-rw-r--r--tests/src/test/resources/org/aspectj/systemtest/ajc195/ajc195.xml57
4 files changed, 88 insertions, 0 deletions
diff --git a/tests/bugs195/switch/Azpect.java b/tests/bugs195/switch/Azpect.java
new file mode 100644
index 000000000..4e5c62e4a
--- /dev/null
+++ b/tests/bugs195/switch/Azpect.java
@@ -0,0 +1,5 @@
+aspect Azpect {
+ before(): within(HelloWorldEnumSwitch) {
+ System.out.println(">"+thisJoinPointStaticPart.getSourceLocation().getLine());
+ }
+}
diff --git a/tests/bugs195/switch/HelloWorldEnumSwitch.java b/tests/bugs195/switch/HelloWorldEnumSwitch.java
new file mode 100644
index 000000000..59c2f58c1
--- /dev/null
+++ b/tests/bugs195/switch/HelloWorldEnumSwitch.java
@@ -0,0 +1,22 @@
+public class HelloWorldEnumSwitch {
+
+ public static void main(String[] args) {
+ switch(TestEnum.A) {
+ case A:
+ System.out.println("A");
+ break;
+ case B:
+ System.out.println("B");
+ }
+
+ }
+
+ public static enum TestEnum {
+ A,
+ B;
+
+ private TestEnum() {
+ }
+ }
+}
+
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc195/Ajc195Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc195/Ajc195Tests.java
index 7c6034a3e..71219a5d2 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc195/Ajc195Tests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc195/Ajc195Tests.java
@@ -16,6 +16,10 @@ import junit.framework.Test;
*/
public class Ajc195Tests extends XMLBasedAjcTestCase {
+ public void testAvoidWeavingSwitchInfrastructure() {
+ runTest("avoid weaving switch infrastructure");
+ }
+
public void testFinallyBlocksAndUnlinkingAndExceptions() {
runTest("around finally blocks and unlinking");
}
diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc195/ajc195.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc195/ajc195.xml
index 10d1a0156..c21529061 100644
--- a/tests/src/test/resources/org/aspectj/systemtest/ajc195/ajc195.xml
+++ b/tests/src/test/resources/org/aspectj/systemtest/ajc195/ajc195.xml
@@ -15,5 +15,62 @@
</stdout>
</run>
</ajc-test>
+
+ <ajc-test dir="bugs195/switch" vm="1.8" title="avoid weaving switch infrastructure">
+ <compile files="HelloWorldEnumSwitch.java Azpect.java" options="-showWeaveInfo -1.8 -XnoInline">
+ <message kind="weave" text="Join point 'constructor-execution(void HelloWorldEnumSwitch.&lt;init&gt;())' in Type 'HelloWorldEnumSwitch' (HelloWorldEnumSwitch.java:1) advised by before advice from 'Azpect' (Azpect.java:2)"/>
+ <message kind="weave" text="Join point 'field-get(HelloWorldEnumSwitch$TestEnum HelloWorldEnumSwitch$TestEnum.A)' in Type 'HelloWorldEnumSwitch' (HelloWorldEnumSwitch.java:4) advised by before advice from 'Azpect' (Azpect.java:2)"/>
+ <message kind="weave" text="Join point 'method-call(int HelloWorldEnumSwitch$TestEnum.ordinal())' in Type 'HelloWorldEnumSwitch' (HelloWorldEnumSwitch.java:4) advised by before advice from 'Azpect' (Azpect.java:2)"/>
+ <message kind="weave" text="Join point 'field-get(java.io.PrintStream java.lang.System.out)' in Type 'HelloWorldEnumSwitch' (HelloWorldEnumSwitch.java:6) advised by before advice from 'Azpect' (Azpect.java:2)"/>
+ <message kind="weave" text="Join point 'method-call(void java.io.PrintStream.println(java.lang.String))' in Type 'HelloWorldEnumSwitch' (HelloWorldEnumSwitch.java:6) advised by before advice from 'Azpect' (Azpect.java:2)"/>
+ <message kind="weave" text="Join point 'field-get(java.io.PrintStream java.lang.System.out)' in Type 'HelloWorldEnumSwitch' (HelloWorldEnumSwitch.java:9) advised by before advice from 'Azpect' (Azpect.java:2)"/>
+ <message kind="weave" text="Join point 'method-call(void java.io.PrintStream.println(java.lang.String))' in Type 'HelloWorldEnumSwitch' (HelloWorldEnumSwitch.java:9) advised by before advice from 'Azpect' (Azpect.java:2)"/>
+ <message kind="weave" text="Join point 'method-execution(void HelloWorldEnumSwitch.main(java.lang.String[]))' in Type 'HelloWorldEnumSwitch' (HelloWorldEnumSwitch.java:3) advised by before advice from 'Azpect' (Azpect.java:2)"/>
+ <message kind="weave" text="Join point 'staticinitialization(void HelloWorldEnumSwitch.&lt;clinit&gt;())' in Type 'HelloWorldEnumSwitch' (HelloWorldEnumSwitch.java:1) advised by before advice from 'Azpect' (Azpect.java:2)"/>
+ <message kind="weave" text="Join point 'initialization(void HelloWorldEnumSwitch.&lt;init&gt;())' in Type 'HelloWorldEnumSwitch' (HelloWorldEnumSwitch.java:1) advised by before advice from 'Azpect' (Azpect.java:2)"/>
+ <message kind="weave" text="Join point 'preinitialization(void HelloWorldEnumSwitch.&lt;init&gt;())' in Type 'HelloWorldEnumSwitch' (HelloWorldEnumSwitch.java:1) advised by before advice from 'Azpect' (Azpect.java:2)"/>
+ <message kind="weave" text="Join point 'constructor-call(void HelloWorldEnumSwitch$TestEnum.&lt;init&gt;(java.lang.String, int))' in Type 'HelloWorldEnumSwitch$TestEnum' (HelloWorldEnumSwitch.java:15) advised by before advice from 'Azpect' (Azpect.java:2)"/>
+ <message kind="weave" text="Join point 'field-set(HelloWorldEnumSwitch$TestEnum HelloWorldEnumSwitch$TestEnum.A)' in Type 'HelloWorldEnumSwitch$TestEnum' (HelloWorldEnumSwitch.java:15) advised by before advice from 'Azpect' (Azpect.java:2)"/>
+ <message kind="weave" text="Join point 'constructor-call(void HelloWorldEnumSwitch$TestEnum.&lt;init&gt;(java.lang.String, int))' in Type 'HelloWorldEnumSwitch$TestEnum' (HelloWorldEnumSwitch.java:16) advised by before advice from 'Azpect' (Azpect.java:2)"/>
+ <message kind="weave" text="Join point 'field-set(HelloWorldEnumSwitch$TestEnum HelloWorldEnumSwitch$TestEnum.B)' in Type 'HelloWorldEnumSwitch$TestEnum' (HelloWorldEnumSwitch.java:16) advised by before advice from 'Azpect' (Azpect.java:2)"/>
+ <message kind="weave" text="Join point 'field-get(HelloWorldEnumSwitch$TestEnum HelloWorldEnumSwitch$TestEnum.A)' in Type 'HelloWorldEnumSwitch$TestEnum' (HelloWorldEnumSwitch.java:14) advised by before advice from 'Azpect' (Azpect.java:2)"/>
+ <message kind="weave" text="Join point 'field-get(HelloWorldEnumSwitch$TestEnum HelloWorldEnumSwitch$TestEnum.B)' in Type 'HelloWorldEnumSwitch$TestEnum' (HelloWorldEnumSwitch.java:14) advised by before advice from 'Azpect' (Azpect.java:2)"/>
+ <message kind="weave" text="Join point 'staticinitialization(void HelloWorldEnumSwitch$TestEnum.&lt;clinit&gt;())' in Type 'HelloWorldEnumSwitch$TestEnum' (HelloWorldEnumSwitch.java:14) advised by before advice from 'Azpect' (Azpect.java:2)"/>
+ <message kind="weave" text="Join point 'constructor-execution(void HelloWorldEnumSwitch$TestEnum.&lt;init&gt;(java.lang.String, int))' in Type 'HelloWorldEnumSwitch$TestEnum' (HelloWorldEnumSwitch.java:18) advised by before advice from 'Azpect' (Azpect.java:2)"/>
+ <message kind="weave" text="Join point 'method-call(void java.lang.System.arraycopy(java.lang.Object, int, java.lang.Object, int, int))' in Type 'HelloWorldEnumSwitch$TestEnum' (HelloWorldEnumSwitch.java:1) advised by before advice from 'Azpect' (Azpect.java:2)"/>
+ <message kind="weave" text="Join point 'method-execution(HelloWorldEnumSwitch$TestEnum[] HelloWorldEnumSwitch$TestEnum.values())' in Type 'HelloWorldEnumSwitch$TestEnum' (HelloWorldEnumSwitch.java:1) advised by before advice from 'Azpect' (Azpect.java:2)"/>
+ <message kind="weave" text="Join point 'method-call(java.lang.Enum java.lang.Enum.valueOf(java.lang.Class, java.lang.String))' in Type 'HelloWorldEnumSwitch$TestEnum' (HelloWorldEnumSwitch.java:1) advised by before advice from 'Azpect' (Azpect.java:2)"/>
+ <message kind="weave" text="Join point 'method-execution(HelloWorldEnumSwitch$TestEnum HelloWorldEnumSwitch$TestEnum.valueOf(java.lang.String))' in Type 'HelloWorldEnumSwitch$TestEnum' (HelloWorldEnumSwitch.java:1) advised by before advice from 'Azpect' (Azpect.java:2)"/>
+ <message kind="weave" text="Join point 'initialization(void HelloWorldEnumSwitch$TestEnum.&lt;init&gt;(java.lang.String, int))' in Type 'HelloWorldEnumSwitch$TestEnum' (HelloWorldEnumSwitch.java:18) advised by before advice from 'Azpect' (Azpect.java:2)"/>
+ <message kind="weave" text="Join point 'preinitialization(void HelloWorldEnumSwitch$TestEnum.&lt;init&gt;(java.lang.String, int))' in Type 'HelloWorldEnumSwitch$TestEnum' (HelloWorldEnumSwitch.java:18) advised by before advice from 'Azpect' (Azpect.java:2)"/>
+ </compile>
+
+ <run class="HelloWorldEnumSwitch">
+ <stdout>
+ <line text=">0"/>
+ <line text=">3"/>
+ <line text=">15"/>
+ <line text=">15"/>
+ <line text=">18"/>
+ <line text=">18"/>
+ <line text=">18"/>
+ <line text=">15"/>
+ <line text=">16"/>
+ <line text=">18"/>
+ <line text=">18"/>
+ <line text=">18"/>
+ <line text=">16"/>
+ <line text=">14"/>
+ <line text=">14"/>
+ <line text=">1"/>
+ <line text=">1"/>
+ <line text=">4"/>
+ <line text=">4"/>
+ <line text=">6"/>
+ <line text=">6"/>
+ <line text="A"/>
+ </stdout>
+ </run>
+ </ajc-test>
</suite>