@@ -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: |
@@ -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); | |||
} | |||
} |
@@ -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!"); | |||
// } | |||
} |
@@ -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(..)) {} | |||
//} |
@@ -0,0 +1,3 @@ | |||
aspect X { | |||
before(): execution(* xxx(..)) {} | |||
} |
@@ -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()); |
@@ -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"); | |||
} | |||
} |
@@ -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; | |||
} | |||
} |
@@ -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> |