diff options
author | Andy Clement <aclement@gopivotal.com> | 2014-08-06 08:20:07 -0700 |
---|---|---|
committer | Andy Clement <aclement@gopivotal.com> | 2014-08-06 08:20:07 -0700 |
commit | b09622f37d7c6d10eb3331097e2c09d670db61fa (patch) | |
tree | 5fd65c3f0816f288f180c9f76645721fb63da9f9 /tests | |
parent | 25f3a34a0c1e2db9b34f00afdbfb2d15d89e6418 (diff) | |
download | aspectj-b09622f37d7c6d10eb3331097e2c09d670db61fa.tar.gz aspectj-b09622f37d7c6d10eb3331097e2c09d670db61fa.zip |
Fix 440983: RuntimeInvisTypeAnnotation unpacking
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bugs182/440983/Code.java | 26 | ||||
-rw-r--r-- | tests/bugs182/440983/X.java | 3 | ||||
-rw-r--r-- | tests/bugs182/440983/code.jar | bin | 0 -> 1229 bytes | |||
-rw-r--r-- | tests/src/org/aspectj/systemtest/AllTests18.java | 2 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc182/Ajc182Tests.java | 50 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc182/AllTestsAspectJ182.java | 27 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc182/tests.xml | 18 |
7 files changed, 126 insertions, 0 deletions
diff --git a/tests/bugs182/440983/Code.java b/tests/bugs182/440983/Code.java new file mode 100644 index 000000000..96411a378 --- /dev/null +++ b/tests/bugs182/440983/Code.java @@ -0,0 +1,26 @@ +import java.util.*; +import java.lang.annotation.*; + +@Target(ElementType.TYPE_USE) +@Retention(RetentionPolicy.CLASS) +@interface Anno {} + +public class Code { + public static void xxx(String []argv) { + List<@Anno String> ls = new ArrayList<String>(); + System.out.println(ls); + } + + public static void yyy(String []argv) { + } + + public static void main(String []argv) { + Code c = new Code(); + c.xxx(argv); + System.out.println("works"); + } +} + +//aspect X { +// before(): execution(* main(..)) {} +//} diff --git a/tests/bugs182/440983/X.java b/tests/bugs182/440983/X.java new file mode 100644 index 000000000..822bbfe13 --- /dev/null +++ b/tests/bugs182/440983/X.java @@ -0,0 +1,3 @@ +aspect X { + before(): execution(* xxx(..)) {} +} diff --git a/tests/bugs182/440983/code.jar b/tests/bugs182/440983/code.jar Binary files differnew file mode 100644 index 000000000..1ed5f21ab --- /dev/null +++ b/tests/bugs182/440983/code.jar diff --git a/tests/src/org/aspectj/systemtest/AllTests18.java b/tests/src/org/aspectj/systemtest/AllTests18.java index c382ea504..5001f9a37 100644 --- a/tests/src/org/aspectj/systemtest/AllTests18.java +++ b/tests/src/org/aspectj/systemtest/AllTests18.java @@ -15,12 +15,14 @@ import junit.framework.TestSuite; import org.aspectj.systemtest.ajc180.AllTestsAspectJ180; import org.aspectj.systemtest.ajc181.AllTestsAspectJ181; +import org.aspectj.systemtest.ajc182.AllTestsAspectJ182; public class AllTests18 { public static Test suite() { TestSuite suite = new TestSuite("AspectJ System Test Suite - 1.8"); // $JUnit-BEGIN$ + suite.addTest(AllTestsAspectJ182.suite()); suite.addTest(AllTestsAspectJ181.suite()); suite.addTest(AllTestsAspectJ180.suite()); suite.addTest(AllTests17.suite()); diff --git a/tests/src/org/aspectj/systemtest/ajc182/Ajc182Tests.java b/tests/src/org/aspectj/systemtest/ajc182/Ajc182Tests.java new file mode 100644 index 000000000..545def45d --- /dev/null +++ b/tests/src/org/aspectj/systemtest/ajc182/Ajc182Tests.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * Copyright (c) 2014 Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andy Clement - initial API and implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc182; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.apache.bcel.classfile.annotation.RuntimeInvisTypeAnnos; +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * @author Andy Clement + */ +public class Ajc182Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testInvisTypeAnnos_440983() throws ClassNotFoundException { + runTest("invis type annos"); + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "Code"); + Method m = getMethodStartsWith(jc, "xxx"); + RuntimeInvisTypeAnnos rita = (RuntimeInvisTypeAnnos)getAttributeStartsWith(m.getCode().getAttributes(),"RuntimeInvisibleTypeAnnotations"); + assertEquals("AnnotationGen:[Anno #0 {}]",rita.getTypeAnnotations()[0].getAnnotation().toString()); + } + + public void testInvisTypeAnnos_440983_2() throws ClassNotFoundException { + runTest("invis type annos 2"); + } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc182Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("tests.xml"); + } + +} diff --git a/tests/src/org/aspectj/systemtest/ajc182/AllTestsAspectJ182.java b/tests/src/org/aspectj/systemtest/ajc182/AllTestsAspectJ182.java new file mode 100644 index 000000000..4adbdfb76 --- /dev/null +++ b/tests/src/org/aspectj/systemtest/ajc182/AllTestsAspectJ182.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2014 Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andy Clement - initial API and implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc182; + +import junit.framework.Test; +import junit.framework.TestSuite; +import org.aspectj.systemtest.apt.AptTests; + +public class AllTestsAspectJ182 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.8.2 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc182Tests.suite()); + suite.addTest(AptTests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/org/aspectj/systemtest/ajc182/tests.xml b/tests/src/org/aspectj/systemtest/ajc182/tests.xml new file mode 100644 index 000000000..9b7383810 --- /dev/null +++ b/tests/src/org/aspectj/systemtest/ajc182/tests.xml @@ -0,0 +1,18 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="bugs182/440983" title="invis type annos"> + <compile options="-1.8" files="Code.java"/> + </ajc-test> + + <ajc-test dir="bugs182/440983" title="invis type annos 2"> + <compile options="-1.8" files="X.java" inpath="code.jar"/> + <run class="Code"> + <stdout> + <line text="works"/> + </stdout> + </run> + </ajc-test> + +</suite> |