aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Clement <aclement@gopivotal.com>2014-08-06 08:20:07 -0700
committerAndy Clement <aclement@gopivotal.com>2014-08-06 08:20:07 -0700
commitb09622f37d7c6d10eb3331097e2c09d670db61fa (patch)
tree5fd65c3f0816f288f180c9f76645721fb63da9f9
parent25f3a34a0c1e2db9b34f00afdbfb2d15d89e6418 (diff)
downloadaspectj-b09622f37d7c6d10eb3331097e2c09d670db61fa.tar.gz
aspectj-b09622f37d7c6d10eb3331097e2c09d670db61fa.zip
Fix 440983: RuntimeInvisTypeAnnotation unpacking
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/classfile/Attribute.java3
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/RuntimeInvisTypeAnnos.java3
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/RuntimeVisTypeAnnos.java8
-rw-r--r--lib/bcel/bcel-src.zipbin326548 -> 326466 bytes
-rw-r--r--lib/bcel/bcel.jarbin286993 -> 287014 bytes
-rw-r--r--tests/bugs182/440983/Code.java26
-rw-r--r--tests/bugs182/440983/X.java3
-rw-r--r--tests/bugs182/440983/code.jarbin0 -> 1229 bytes
-rw-r--r--tests/src/org/aspectj/systemtest/AllTests18.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc182/Ajc182Tests.java50
-rw-r--r--tests/src/org/aspectj/systemtest/ajc182/AllTestsAspectJ182.java27
-rw-r--r--tests/src/org/aspectj/systemtest/ajc182/tests.xml18
12 files changed, 130 insertions, 10 deletions
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/Attribute.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/Attribute.java
index 817628295..34ed08f5e 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/classfile/Attribute.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/Attribute.java
@@ -62,6 +62,7 @@ import java.io.Serializable;
import org.aspectj.apache.bcel.Constants;
import org.aspectj.apache.bcel.classfile.annotation.RuntimeInvisAnnos;
import org.aspectj.apache.bcel.classfile.annotation.RuntimeInvisParamAnnos;
+import org.aspectj.apache.bcel.classfile.annotation.RuntimeInvisTypeAnnos;
import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisAnnos;
import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisParamAnnos;
import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisTypeAnnos;
@@ -162,6 +163,8 @@ public abstract class Attribute implements Cloneable, Node, Serializable {
return new BootstrapMethods(idx,len,file,cpool);
case Constants.ATTR_RUNTIME_VISIBLE_TYPE_ANNOTATIONS:
return new RuntimeVisTypeAnnos(idx, len, file, cpool);
+ case Constants.ATTR_RUNTIME_INVISIBLE_TYPE_ANNOTATIONS:
+ return new RuntimeInvisTypeAnnos(idx, len, file, cpool);
case Constants.ATTR_METHOD_PARAMETERS:
return new MethodParameters(idx, len, file, cpool);
default:
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/RuntimeInvisTypeAnnos.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/RuntimeInvisTypeAnnos.java
index a635fdd55..333ccbddd 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/RuntimeInvisTypeAnnos.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/RuntimeInvisTypeAnnos.java
@@ -27,11 +27,10 @@ public class RuntimeInvisTypeAnnos extends RuntimeTypeAnnos {
}
public RuntimeInvisTypeAnnos(int nameIdx, int len, ConstantPool cpool) {
- super(Constants.ATTR_RUNTIME_INVISIBLE_TYPE_ANNOTATIONS, true, nameIdx, len, cpool);
+ super(Constants.ATTR_RUNTIME_INVISIBLE_TYPE_ANNOTATIONS, false, nameIdx, len, cpool);
}
public void accept(ClassVisitor v) {
v.visitRuntimeInvisibleTypeAnnotations(this);
}
-
} \ No newline at end of file
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/RuntimeVisTypeAnnos.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/RuntimeVisTypeAnnos.java
index dbb7d7aeb..59b77dabc 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/RuntimeVisTypeAnnos.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/RuntimeVisTypeAnnos.java
@@ -15,7 +15,6 @@ import java.io.DataInputStream;
import java.io.IOException;
import org.aspectj.apache.bcel.Constants;
-import org.aspectj.apache.bcel.classfile.Attribute;
import org.aspectj.apache.bcel.classfile.ConstantPool;
import org.aspectj.apache.bcel.classfile.ClassVisitor;
@@ -30,15 +29,8 @@ public class RuntimeVisTypeAnnos extends RuntimeTypeAnnos {
super(Constants.ATTR_RUNTIME_VISIBLE_TYPE_ANNOTATIONS, true, nameIdx, len, cpool);
}
-// public RuntimeVisTypeAnnos(int nameIndex, int len, byte[] rvaData,ConstantPool cpool) {
-// super(Constants.ATTR_RUNTIME_VISIBLE_TYPE_ANNOTATIONS,true,nameIndex,len,rvaData,cpool);
-// }
-
public void accept(ClassVisitor v) {
v.visitRuntimeVisibleTypeAnnotations(this);
}
-// public Attribute copy(ConstantPool constant_pool) {
-// throw new RuntimeException("Not implemented yet!");
-// }
} \ No newline at end of file
diff --git a/lib/bcel/bcel-src.zip b/lib/bcel/bcel-src.zip
index 7b2259ed0..5996c3ced 100644
--- a/lib/bcel/bcel-src.zip
+++ b/lib/bcel/bcel-src.zip
Binary files differ
diff --git a/lib/bcel/bcel.jar b/lib/bcel/bcel.jar
index f4b2cff65..5da7b4842 100644
--- a/lib/bcel/bcel.jar
+++ b/lib/bcel/bcel.jar
Binary files differ
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
new file mode 100644
index 000000000..1ed5f21ab
--- /dev/null
+++ b/tests/bugs182/440983/code.jar
Binary files differ
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>