aboutsummaryrefslogtreecommitdiffstats
path: root/bcel-builder
diff options
context:
space:
mode:
Diffstat (limited to 'bcel-builder')
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/AnnotationDefault.java30
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/EnclosingMethod.java54
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/LocalVariableTypeTable.java20
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/MethodParameters.java38
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/AnnotationElementValue.java14
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/AnnotationGen.java18
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/ArrayElementValue.java14
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/ClassElementValue.java14
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/ElementValue.java14
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/EnumElementValue.java14
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/NameValuePair.java16
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeAnnos.java16
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeInvisAnnos.java26
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeInvisParamAnnos.java24
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeInvisTypeAnnos.java16
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeParamAnnos.java38
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeTypeAnnos.java26
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeVisAnnos.java24
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeVisParamAnnos.java24
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeVisTypeAnnos.java24
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/SimpleElementValue.java14
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/TypeAnnotationGen.java64
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/LineNumberTag.java30
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/LocalVariableTag.java16
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/Tag.java16
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/AnnotationAccessFlagTest.java26
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/AnnotationDefaultAttributeTest.java22
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/AnnotationGenTest.java10
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/AnonymousClassTest.java42
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/BcelTestCase.java16
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ConstantPoolToStringTest.java30
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ElementValueGenTest.java10
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/EnclosingMethodAttributeTest.java16
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/EnumAccessFlagTest.java26
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/FieldAnnotationsTest.java48
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GeneratingAnnotatedClassesTest.java12
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GenericSignatureParsingTest.java180
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GenericsErasureTesting.java28
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GetReflectMembersTest.java36
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/LocalVariableTypeTableTest.java30
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/MethodAnnotationsTest.java44
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/MethodParametersTest.java36
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ModuleTest.java28
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ParameterAnnotationsTest.java140
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/RuntimeVisibleAnnotationAttributeTest.java112
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/RuntimeVisibleParameterAnnotationAttributeTest.java44
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/TypeAnnotationsTest.java58
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/UtilTests.java32
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/VarargsTest.java44
49 files changed, 837 insertions, 837 deletions
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/AnnotationDefault.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/AnnotationDefault.java
index bd5a7251f..23564007e 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/AnnotationDefault.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/AnnotationDefault.java
@@ -1,14 +1,14 @@
/* *******************************************************************
* Copyright (c) 2004 IBM Corporation
- *
- * 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 implementation
+ *
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Andy Clement initial implementation
* ******************************************************************/
package org.aspectj.apache.bcel.classfile;
@@ -20,11 +20,11 @@ import org.aspectj.apache.bcel.Constants;
import org.aspectj.apache.bcel.classfile.annotation.ElementValue;
/**
- * This attribute is attached to a method and indicates the default
+ * This attribute is attached to a method and indicates the default
* value for an annotation element.
*/
public class AnnotationDefault extends Attribute {
-
+
private ElementValue value;
public AnnotationDefault(int nameIndex, int len, DataInputStream dis, ConstantPool cpool) throws IOException {
@@ -41,13 +41,13 @@ public class AnnotationDefault extends Attribute {
// is this next line sufficient?
// return (EnclosingMethod)clone();
}
-
- public final ElementValue getElementValue() { return value; }
-
+
+ public final ElementValue getElementValue() { return value; }
+
public final void dump(DataOutputStream dos) throws IOException {
super.dump(dos);
value.dump(dos);
- }
+ }
public void accept(ClassVisitor v) {
v.visitAnnotationDefault(this);
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/EnclosingMethod.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/EnclosingMethod.java
index 9e1554ec5..eda8b3b09 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/EnclosingMethod.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/EnclosingMethod.java
@@ -1,14 +1,14 @@
/* *******************************************************************
* Copyright (c) 2004 IBM Corporation
- *
- * 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 implementation
+ *
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Andy Clement initial implementation
* ******************************************************************/
package org.aspectj.apache.bcel.classfile;
@@ -19,22 +19,22 @@ import java.io.IOException;
import org.aspectj.apache.bcel.Constants;
/**
- * This attribute exists for local or
+ * This attribute exists for local or
* anonymous classes and ... there can be only one.
*/
public class EnclosingMethod extends Attribute {
-
- // Pointer to the CONSTANT_Class_info structure representing the
+
+ // Pointer to the CONSTANT_Class_info structure representing the
// innermost class that encloses the declaration of the current class.
private int classIndex;
-
- // If the current class is not immediately enclosed by a method or
- // constructor, then the value of the method_index item must be zero.
- // Otherwise, the value of the method_index item must point to a
- // CONSTANT_NameAndType_info structure representing the name and the
- // type of a method in the class referenced by the class we point
- // to in the class_index. *It is the compiler responsibility* to
- // ensure that the method identified by this index is the closest
+
+ // If the current class is not immediately enclosed by a method or
+ // constructor, then the value of the method_index item must be zero.
+ // Otherwise, the value of the method_index item must point to a
+ // CONSTANT_NameAndType_info structure representing the name and the
+ // type of a method in the class referenced by the class we point
+ // to in the class_index. *It is the compiler responsibility* to
+ // ensure that the method identified by this index is the closest
// lexically enclosing method that includes the local/anonymous class.
private int methodIndex;
@@ -58,23 +58,23 @@ public class EnclosingMethod extends Attribute {
// is this next line sufficient?
// return (EnclosingMethod)clone();
}
-
+
// Accessors
- public final int getEnclosingClassIndex() { return classIndex; }
+ public final int getEnclosingClassIndex() { return classIndex; }
public final int getEnclosingMethodIndex(){ return methodIndex;}
-
+
public final void setEnclosingClassIndex(int idx) {classIndex = idx;}
public final void setEnclosingMethodIndex(int idx){methodIndex= idx;}
public final ConstantClass getEnclosingClass() {
- ConstantClass c =
+ ConstantClass c =
(ConstantClass)cpool.getConstant(classIndex,Constants.CONSTANT_Class);
return c;
}
-
+
public final ConstantNameAndType getEnclosingMethod() {
if (methodIndex == 0) return null;
- ConstantNameAndType nat =
+ ConstantNameAndType nat =
(ConstantNameAndType)cpool.getConstant(methodIndex,Constants.CONSTANT_NameAndType);
return nat;
}
@@ -83,5 +83,5 @@ public class EnclosingMethod extends Attribute {
super.dump(file);
file.writeShort(classIndex);
file.writeShort(methodIndex);
- }
+ }
}
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/LocalVariableTypeTable.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/LocalVariableTypeTable.java
index ecd7e4383..93951faf8 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/LocalVariableTypeTable.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/LocalVariableTypeTable.java
@@ -1,14 +1,14 @@
/* *******************************************************************
* Copyright (c) 2004 IBM Corporation
- *
- * 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 implementation
+ *
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Andy Clement initial implementation
* Heavily based on LocalVariableTable
* ******************************************************************/
package org.aspectj.apache.bcel.classfile;
@@ -37,7 +37,7 @@ import org.aspectj.apache.bcel.Constants;
// u2 attribute_name_index;
// u4 attribute_length;
// u2 local_variable_type_table_length;
-// {
+// {
// u2 start_pc;
// u2 length;
// u2 name_index;
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/MethodParameters.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/MethodParameters.java
index 547041584..df331ac4e 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/MethodParameters.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/MethodParameters.java
@@ -1,14 +1,14 @@
/* *******************************************************************
* Copyright (c) 2013 VMware
- *
- * 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 implementation
+ *
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Andy Clement initial implementation
* ******************************************************************/
package org.aspectj.apache.bcel.classfile;
@@ -24,24 +24,24 @@ public class MethodParameters extends Attribute {
public final static int[] NO_PARAMETER_NAME_INDEXES = new int[0];
public final static int[] NO_PARAMETER_ACCESS_FLAGS = new int[0];
-
+
public final static int ACCESS_FLAGS_FINAL = 0x0010;
public final static int ACCESS_FLAGS_SYNTHETIC = 0x1000;
public final static int ACCESS_FLAGS_MANDATED = 0x8000;
-
+
// if 'isInPackedState' then this data needs unpacking
private boolean isInPackedState = false;
private byte[] data;
private int[] names;
private int[] accessFlags;
-
+
public MethodParameters(int index, int length, DataInputStream dis, ConstantPool cpool) throws IOException {
super(Constants.ATTR_METHOD_PARAMETERS,index,length,cpool);
data = new byte[length];
dis.readFully(data,0,length);
isInPackedState = true;
}
-
+
private void ensureInflated() {
if (names!=null) return;
try {
@@ -63,7 +63,7 @@ public class MethodParameters extends Attribute {
throw new RuntimeException("Unabled to inflate type annotation data, badly formed?");
}
}
-
+
public void dump(DataOutputStream dos) throws IOException {
super.dump(dos);
if (isInPackedState) {
@@ -76,18 +76,18 @@ public class MethodParameters extends Attribute {
}
}
}
-
+
public int getParametersCount() {
ensureInflated();
return names.length;
}
-
+
public String getParameterName(int parameter) {
ensureInflated();
ConstantUtf8 c = (ConstantUtf8) cpool.getConstant(names[parameter], Constants.CONSTANT_Utf8);
return c.getValue();
}
-
+
public int getAccessFlags(int parameter) {
ensureInflated();
return accessFlags[parameter];
@@ -96,11 +96,11 @@ public class MethodParameters extends Attribute {
public boolean isFinal(int parameter) {
return (getAccessFlags(parameter) & ACCESS_FLAGS_FINAL)!=0;
}
-
+
public boolean isSynthetic(int parameter) {
return (getAccessFlags(parameter) & ACCESS_FLAGS_SYNTHETIC)!=0;
}
-
+
public boolean isMandated(int parameter) {
return (getAccessFlags(parameter) & ACCESS_FLAGS_MANDATED)!=0;
}
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/AnnotationElementValue.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/AnnotationElementValue.java
index 2e6024580..d5995b274 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/AnnotationElementValue.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/AnnotationElementValue.java
@@ -1,12 +1,12 @@
/* *******************************************************************
* Copyright (c) 2004 IBM
- * 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:
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
* Andy Clement - initial implementation {date}
* ******************************************************************/
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/AnnotationGen.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/AnnotationGen.java
index 8418abdb8..93c875d4c 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/AnnotationGen.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/AnnotationGen.java
@@ -1,14 +1,14 @@
/* *******************************************************************
* Copyright (c) 2004, 2013 IBM Corporation
- *
- * 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 implementation
+ *
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Andy Clement initial implementation
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.annotation;
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/ArrayElementValue.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/ArrayElementValue.java
index 4cb5f5fe8..3481f64a8 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/ArrayElementValue.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/ArrayElementValue.java
@@ -1,12 +1,12 @@
/* *******************************************************************
* Copyright (c) 2004 IBM
- * 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:
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
* Andy Clement - initial implementation {date}
* ******************************************************************/
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/ClassElementValue.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/ClassElementValue.java
index a4e18b6d4..c946b213f 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/ClassElementValue.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/ClassElementValue.java
@@ -1,12 +1,12 @@
/* *******************************************************************
* Copyright (c) 2004 IBM
- * 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:
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
* Andy Clement - initial implementation {date}
* ******************************************************************/
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/ElementValue.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/ElementValue.java
index 06f7c7273..63ab8caa7 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/ElementValue.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/ElementValue.java
@@ -1,12 +1,12 @@
/* *******************************************************************
* Copyright (c) 2004, 2013 IBM, VMware
- * 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:
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
* Andy Clement - initial implementation {date}
* ******************************************************************/
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/EnumElementValue.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/EnumElementValue.java
index a8b219774..6d16ff732 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/EnumElementValue.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/EnumElementValue.java
@@ -1,12 +1,12 @@
/* *******************************************************************
* Copyright (c) 2004 IBM
- * 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:
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
* Andy Clement - initial implementation {date}
* ******************************************************************/
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/NameValuePair.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/NameValuePair.java
index 99b4211ec..0140b34cb 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/NameValuePair.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/NameValuePair.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2004 IBM
- * 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 implementation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Andy Clement - initial implementation
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.annotation;
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeAnnos.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeAnnos.java
index b4734ee92..2cfda2452 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeAnnos.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeAnnos.java
@@ -1,12 +1,12 @@
/* *******************************************************************
* Copyright (c) 2004, 2013 IBM, VMware
- * 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:
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
* Andy Clement - initial implementation {date}
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.annotation;
@@ -69,7 +69,7 @@ public abstract class RuntimeAnnos extends Attribute {
}
}
-
+
private void inflate() {
try {
DataInputStream dis = new DataInputStream(new ByteArrayInputStream(annotation_data));
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeInvisAnnos.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeInvisAnnos.java
index 9ec53978d..e433ffac0 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeInvisAnnos.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeInvisAnnos.java
@@ -1,12 +1,12 @@
/* *******************************************************************
* Copyright (c) 2004, 2013 IBM, VMware
- * 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:
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
* Andy Clement - initial implementation {date}
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.annotation;
@@ -21,17 +21,17 @@ import org.aspectj.apache.bcel.classfile.ClassVisitor;
import org.aspectj.apache.bcel.classfile.ConstantPool;
public class RuntimeInvisAnnos extends RuntimeAnnos {
-
- public RuntimeInvisAnnos(int nameIdx, int len, ConstantPool cpool) {
+
+ public RuntimeInvisAnnos(int nameIdx, int len, ConstantPool cpool) {
super(Constants.ATTR_RUNTIME_INVISIBLE_ANNOTATIONS, false, nameIdx, len, cpool);
- }
+ }
- public RuntimeInvisAnnos(int nameIdx, int len,
+ public RuntimeInvisAnnos(int nameIdx, int len,
DataInputStream dis,ConstantPool cpool) throws IOException {
this(nameIdx, len, cpool);
readAnnotations(dis,cpool);
}
-
+
public RuntimeInvisAnnos(int nameIndex, int len, byte[] rvaData,ConstantPool cpool) {
super(Constants.ATTR_RUNTIME_INVISIBLE_ANNOTATIONS,false,nameIndex,len,rvaData,cpool);
}
@@ -48,4 +48,4 @@ public class RuntimeInvisAnnos extends RuntimeAnnos {
public Attribute copy(ConstantPool constant_pool) {
throw new RuntimeException("Not implemented yet!");
}
-} \ No newline at end of file
+}
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeInvisParamAnnos.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeInvisParamAnnos.java
index dd5d2a655..d8b2a1e33 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeInvisParamAnnos.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeInvisParamAnnos.java
@@ -1,12 +1,12 @@
/* *******************************************************************
* Copyright (c) 2004, 2013 IBM, VMware
- * 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:
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
* Andy Clement - initial implementation {date}
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.annotation;
@@ -20,17 +20,17 @@ import org.aspectj.apache.bcel.classfile.ClassVisitor;
import org.aspectj.apache.bcel.classfile.ConstantPool;
public class RuntimeInvisParamAnnos extends RuntimeParamAnnos {
-
- public RuntimeInvisParamAnnos(int nameIdx, int len, ConstantPool cpool) {
+
+ public RuntimeInvisParamAnnos(int nameIdx, int len, ConstantPool cpool) {
super(Constants.ATTR_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS, false, nameIdx, len, cpool);
}
- public RuntimeInvisParamAnnos(int nameIdx, int len,
+ public RuntimeInvisParamAnnos(int nameIdx, int len,
DataInputStream dis,ConstantPool cpool) throws IOException {
this(nameIdx, len, cpool);
readParameterAnnotations(dis,cpool);
}
-
+
public RuntimeInvisParamAnnos(int nameIndex, int len, byte[] rvaData,ConstantPool cpool) {
super(Constants.ATTR_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS,false,nameIndex,len,rvaData,cpool);
}
@@ -42,4 +42,4 @@ public class RuntimeInvisParamAnnos extends RuntimeParamAnnos {
public Attribute copy(ConstantPool constant_pool) {
throw new RuntimeException("Not implemented yet!");
}
-} \ No newline at end of file
+}
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeInvisTypeAnnos.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeInvisTypeAnnos.java
index 335194840..b54848faa 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeInvisTypeAnnos.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeInvisTypeAnnos.java
@@ -1,12 +1,12 @@
/* *******************************************************************
* Copyright (c) 2013 VMware
- * 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:
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
* Andy Clement - initial implementation {date}
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.annotation;
@@ -33,4 +33,4 @@ public class RuntimeInvisTypeAnnos extends RuntimeTypeAnnos {
public void accept(ClassVisitor v) {
v.visitRuntimeInvisibleTypeAnnotations(this);
}
-} \ No newline at end of file
+}
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeParamAnnos.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeParamAnnos.java
index 5b1dcafff..1a38d2bc6 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeParamAnnos.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeParamAnnos.java
@@ -1,12 +1,12 @@
/* *******************************************************************
* Copyright (c) 2004 IBM
- * 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:
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
* Andy Clement - initial implementation {date}
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.annotation;
@@ -22,45 +22,45 @@ import org.aspectj.apache.bcel.classfile.Attribute;
import org.aspectj.apache.bcel.classfile.ConstantPool;
public abstract class RuntimeParamAnnos extends Attribute {
-
+
private List<AnnotationGen[]> parameterAnnotations;
private boolean visible;
-
+
// Keep just a byte stream of the data until someone actually asks for it
private boolean inflated = false;
private byte[] annotation_data;
-
+
public RuntimeParamAnnos(byte attrid, boolean visible,
int nameIdx, int len, ConstantPool cpool) {
super(attrid,nameIdx,len,cpool);
- this.visible = visible;
+ this.visible = visible;
parameterAnnotations = new ArrayList<>();
}
-
+
public RuntimeParamAnnos(byte attrid,boolean visible,int nameIdx,int len,byte[] data,ConstantPool cpool) {
super(attrid,nameIdx,len,cpool);
this.visible = visible;
parameterAnnotations = new ArrayList<>();
annotation_data = data;
}
-
+
public final void dump(DataOutputStream dos) throws IOException {
super.dump(dos);
writeAnnotations(dos);
- }
+ }
public Attribute copy(ConstantPool constant_pool) {
throw new RuntimeException("Not implemented yet!");
}
-
+
/** Return a list of Annotation[] - each list entry contains the annotations for one parameter */
public List /*Annotation[]*/<AnnotationGen[]> getParameterAnnotations() {
if (!inflated) inflate();
return parameterAnnotations;
}
-
+
public AnnotationGen[] getAnnotationsOnParameter(int parameterIndex) {
if (!inflated) inflate();
// This may happen. In a ctor for a non static inner type the compiler
@@ -73,7 +73,7 @@ public abstract class RuntimeParamAnnos extends Attribute {
}
return parameterAnnotations.get(parameterIndex);
}
-
+
public boolean areVisible() {
return visible;
}
@@ -109,7 +109,7 @@ public abstract class RuntimeParamAnnos extends Attribute {
}
}
-
+
protected void writeAnnotations(DataOutputStream dos) throws IOException {
if (!inflated) {
dos.write(annotation_data,0,length);
@@ -123,7 +123,7 @@ public abstract class RuntimeParamAnnos extends Attribute {
}
}
}
-
+
/** FOR TESTING ONLY: Tells you if the annotations have been inflated to an object graph */
public boolean isInflated() {
return inflated;
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeTypeAnnos.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeTypeAnnos.java
index 4e4fae650..ba87f52f4 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeTypeAnnos.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeTypeAnnos.java
@@ -1,12 +1,12 @@
/* *******************************************************************
* Copyright (c) 2013 VMware
- * 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:
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
* Andy Clement - initial implementation {date}
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.annotation;
@@ -20,10 +20,10 @@ import org.aspectj.apache.bcel.classfile.Attribute;
import org.aspectj.apache.bcel.classfile.ConstantPool;
public abstract class RuntimeTypeAnnos extends Attribute {
-
+
private boolean visible;
private TypeAnnotationGen[] typeAnnotations; // null until inflated
-
+
// Keep just a byte stream of the data until someone actually asks for the information within
private byte[] annotation_data;
@@ -40,10 +40,10 @@ public abstract class RuntimeTypeAnnos extends Attribute {
public final void dump(DataOutputStream dos) throws IOException {
super.dump(dos);
writeTypeAnnotations(dos);
- }
+ }
protected void writeTypeAnnotations(DataOutputStream dos) throws IOException {
- if (typeAnnotations == null) {
+ if (typeAnnotations == null) {
dos.write(annotation_data,0,length);
} else {
dos.writeShort(typeAnnotations.length);
@@ -68,8 +68,8 @@ public abstract class RuntimeTypeAnnos extends Attribute {
ensureInflated();
return typeAnnotations;
}
-
-
+
+
public boolean areVisible() {
return visible;
}
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeVisAnnos.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeVisAnnos.java
index 97512bd6a..998af4187 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeVisAnnos.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeVisAnnos.java
@@ -1,12 +1,12 @@
/* *******************************************************************
* Copyright (c) 2004 IBM
- * 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:
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
* Andy Clement - initial implementation {date}
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.annotation;
@@ -21,12 +21,12 @@ import org.aspectj.apache.bcel.classfile.ClassVisitor;
import org.aspectj.apache.bcel.classfile.ConstantPool;
public class RuntimeVisAnnos extends RuntimeAnnos {
-
- public RuntimeVisAnnos(int nameIdx, int len, ConstantPool cpool) {
+
+ public RuntimeVisAnnos(int nameIdx, int len, ConstantPool cpool) {
super(Constants.ATTR_RUNTIME_VISIBLE_ANNOTATIONS, true, nameIdx, len, cpool);
- }
+ }
- public RuntimeVisAnnos(int nameIdx, int len,
+ public RuntimeVisAnnos(int nameIdx, int len,
DataInputStream dis,ConstantPool cpool) throws IOException {
this(nameIdx, len, cpool);
readAnnotations(dis,cpool);
@@ -48,4 +48,4 @@ public class RuntimeVisAnnos extends RuntimeAnnos {
public Attribute copy(ConstantPool constant_pool) {
throw new RuntimeException("Not implemented yet!");
}
-} \ No newline at end of file
+}
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeVisParamAnnos.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeVisParamAnnos.java
index d8432732b..cbe4a374d 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeVisParamAnnos.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeVisParamAnnos.java
@@ -1,12 +1,12 @@
/* *******************************************************************
* Copyright (c) 2004 IBM
- * 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:
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
* Andy Clement - initial implementation {date}
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.annotation;
@@ -20,16 +20,16 @@ import org.aspectj.apache.bcel.classfile.ClassVisitor;
import org.aspectj.apache.bcel.classfile.ConstantPool;
public class RuntimeVisParamAnnos extends RuntimeParamAnnos {
-
- public RuntimeVisParamAnnos(int nameIdx, int len, ConstantPool cpool) {
+
+ public RuntimeVisParamAnnos(int nameIdx, int len, ConstantPool cpool) {
super(Constants.ATTR_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS, true, nameIdx, len, cpool);
}
-
+
public RuntimeVisParamAnnos(int nameIndex, int len, byte[] rvaData,ConstantPool cpool) {
super(Constants.ATTR_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS,true,nameIndex,len,rvaData,cpool);
}
- public RuntimeVisParamAnnos(int nameIdx, int len,
+ public RuntimeVisParamAnnos(int nameIdx, int len,
DataInputStream dis,ConstantPool cpool) throws IOException {
this(nameIdx, len, cpool);
readParameterAnnotations(dis,cpool);
@@ -42,4 +42,4 @@ public class RuntimeVisParamAnnos extends RuntimeParamAnnos {
public Attribute copy(ConstantPool constant_pool) {
throw new RuntimeException("Not implemented yet!");
}
-} \ No newline at end of file
+}
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeVisTypeAnnos.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeVisTypeAnnos.java
index 2bccc130e..d775f1982 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeVisTypeAnnos.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/RuntimeVisTypeAnnos.java
@@ -1,12 +1,12 @@
/* *******************************************************************
* Copyright (c) 2013 VMware
- * 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:
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
* Andy Clement - initial implementation {date}
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.annotation;
@@ -19,18 +19,18 @@ import org.aspectj.apache.bcel.classfile.ClassVisitor;
import org.aspectj.apache.bcel.classfile.ConstantPool;
public class RuntimeVisTypeAnnos extends RuntimeTypeAnnos {
-
+
public RuntimeVisTypeAnnos(int nameIdx, int len, DataInputStream dis,ConstantPool cpool) throws IOException {
this(nameIdx, len, cpool);
readTypeAnnotations(dis,cpool);
}
-
- public RuntimeVisTypeAnnos(int nameIdx, int len, ConstantPool cpool) {
+
+ public RuntimeVisTypeAnnos(int nameIdx, int len, ConstantPool cpool) {
super(Constants.ATTR_RUNTIME_VISIBLE_TYPE_ANNOTATIONS, true, nameIdx, len, cpool);
}
-
+
public void accept(ClassVisitor v) {
v.visitRuntimeVisibleTypeAnnotations(this);
}
-} \ No newline at end of file
+}
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/SimpleElementValue.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/SimpleElementValue.java
index fabfa8ca4..cba515b62 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/SimpleElementValue.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/SimpleElementValue.java
@@ -1,12 +1,12 @@
/* *******************************************************************
* Copyright (c) 2004 IBM
- * 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:
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
* Andy Clement - initial implementation {date}
* ******************************************************************/
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/TypeAnnotationGen.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/TypeAnnotationGen.java
index ad7544eba..b1f488229 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/TypeAnnotationGen.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/TypeAnnotationGen.java
@@ -1,14 +1,14 @@
/* *******************************************************************
* Copyright (c) 2013 VMware
- *
- * 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 implementation
+ *
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Andy Clement initial implementation
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.annotation;
@@ -21,7 +21,7 @@ import org.aspectj.apache.bcel.classfile.ConstantPool;
public class TypeAnnotationGen {
public static final TypeAnnotationGen[] NO_TYPE_ANNOTATIONS = new TypeAnnotationGen[0];
public static final int[] NO_TYPE_PATH = new int[0];
-
+
private ConstantPool cpool;
private TypeAnnotationGen(ConstantPool cpool) {
@@ -34,20 +34,20 @@ public class TypeAnnotationGen {
private int info; // meaning varies depending on target type
private int info2; // meaning varies depending on target type
private int[] localVarTarget;
-
+
// target type constants
public final static int CLASS_TYPE_PARAMETER = 0x00;
public final static int METHOD_TYPE_PARAMETER = 0x01;
-
+
public final static int CLASS_EXTENDS = 0x10;
public final static int CLASS_TYPE_PARAMETER_BOUND = 0x11;
public final static int METHOD_TYPE_PARAMETER_BOUND = 0x12;
public final static int FIELD = 0x13;
- public final static int METHOD_RETURN = 0x14;
+ public final static int METHOD_RETURN = 0x14;
public final static int METHOD_RECEIVER = 0x15;
public final static int METHOD_FORMAL_PARAMETER = 0x16;
public final static int THROWS = 0x17;
-
+
public final static int LOCAL_VARIABLE = 0x40;
public final static int RESOURCE_VARIABLE = 0x41;
public final static int EXCEPTION_PARAMETER = 0x42;
@@ -60,14 +60,14 @@ public class TypeAnnotationGen {
public final static int METHOD_INVOCATION_TYPE_ARGUMENT = 0x49;
public final static int CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT = 0x4A;
public final static int METHOD_REFERENCE_TYPE_ARGUMENT = 0x4B;
-
+
// type path entry kinds
public final static int TYPE_PATH_ENTRY_KIND_ARRAY = 0;
public final static int TYPE_PATH_ENTRY_KIND_INNER_TYPE = 1;
public final static int TYPE_PATH_ENTRY_KIND_WILDCARD = 2;
public final static int TYPE_PATH_ENTRY_KIND_TYPE_ARGUMENT = 3;
-
+
public static TypeAnnotationGen read(DataInputStream dis, ConstantPool cpool, boolean isVisible) throws IOException {
TypeAnnotationGen typeAnno = new TypeAnnotationGen(cpool);
typeAnno.targetType = dis.readUnsignedByte();
@@ -139,7 +139,7 @@ public class TypeAnnotationGen {
typeAnno.annotation = AnnotationGen.read(dis, cpool, isVisible);
return typeAnno;
}
-
+
public static int[] readLocalVarTarget(DataInputStream dis) throws IOException {
int tableLength = dis.readUnsignedShort();
int[] table = new int[tableLength*3];
@@ -213,32 +213,32 @@ public class TypeAnnotationGen {
}
annotation.dump(dos);
}
-
+
public int getSupertypeIndex() {
assert (targetType==CLASS_EXTENDS);
return info;
}
-
+
public int getOffset() {
assert (targetType==INSTANCEOF || targetType==NEW || targetType==CONSTRUCTOR_REFERENCE || targetType==METHOD_REFERENCE ||
- targetType==CAST || targetType==CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT ||
- targetType==METHOD_INVOCATION_TYPE_ARGUMENT || targetType==CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT ||
+ targetType==CAST || targetType==CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT ||
+ targetType==METHOD_INVOCATION_TYPE_ARGUMENT || targetType==CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT ||
targetType==METHOD_REFERENCE_TYPE_ARGUMENT);
return info;
}
-
+
public int getTypeParameterIndex() {
- assert (targetType==CLASS_TYPE_PARAMETER || targetType==METHOD_TYPE_PARAMETER ||
+ assert (targetType==CLASS_TYPE_PARAMETER || targetType==METHOD_TYPE_PARAMETER ||
targetType==CLASS_TYPE_PARAMETER_BOUND || targetType==METHOD_TYPE_PARAMETER_BOUND);
return info;
}
-
+
public int getTypeArgumentIndex() {
- assert (targetType==CAST || targetType==CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT ||
+ assert (targetType==CAST || targetType==CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT ||
targetType==METHOD_INVOCATION_TYPE_ARGUMENT || targetType==CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT || targetType==METHOD_REFERENCE_TYPE_ARGUMENT);
return info2;
}
-
+
public int getBoundIndex() {
assert (targetType==CLASS_TYPE_PARAMETER_BOUND || targetType==METHOD_TYPE_PARAMETER_BOUND);
return info2;
@@ -265,11 +265,11 @@ public class TypeAnnotationGen {
}
-
+
public int getTargetType() {
return targetType;
}
-
+
public AnnotationGen getAnnotation() {
return annotation;
}
@@ -332,7 +332,7 @@ public class TypeAnnotationGen {
// }
// return false;
// }
-
+
// public TypeAnnotationGen(TypeAnnotationGen a, ConstantPool cpool, boolean copyPoolEntries) {
// this.cpool = cpool;
// if (copyPoolEntries) {
@@ -369,11 +369,11 @@ public class TypeAnnotationGen {
public int[] getTypePath() {
return typePath;
}
-
+
public String getTypePathString() {
return toTypePathString(typePath);
}
-
+
public static String toTypePathString(int[] typepath) {
StringBuilder sb = new StringBuilder();
int count = 0;
@@ -395,7 +395,7 @@ public class TypeAnnotationGen {
break;
case TYPE_PATH_ENTRY_KIND_TYPE_ARGUMENT:
sb.append("TYPE_ARGUMENT(").append(typepath[count++]).append(")");
- break;
+ break;
}
}
sb.append("]");
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/LineNumberTag.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/LineNumberTag.java
index fe1d56c27..6bafd8977 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/LineNumberTag.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/LineNumberTag.java
@@ -1,21 +1,21 @@
/* *******************************************************************
* Copyright (c) 2002 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:
- * PARC initial implementation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
* Andy Clement pushed down into bcel module
* ******************************************************************/
package org.aspectj.apache.bcel.generic;
-/**
- * we don't actually target instructions, but instructions target us.
+/**
+ * we don't actually target instructions, but instructions target us.
*/
public class LineNumberTag extends Tag {
@@ -24,15 +24,15 @@ public class LineNumberTag extends Tag {
public LineNumberTag(int lineNumber) {
this.lineNumber = lineNumber;
}
-
- public int getLineNumber() {
- return lineNumber;
+
+ public int getLineNumber() {
+ return lineNumber;
}
-
+
public String toString() {
return "line " + lineNumber;
}
-
+
public boolean equals(Object other) {
if (!(other instanceof LineNumberTag)) return false;
return lineNumber == ((LineNumberTag)other).lineNumber;
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/LocalVariableTag.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/LocalVariableTag.java
index 7a4fab4e9..bb09988aa 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/LocalVariableTag.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/LocalVariableTag.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2002 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:
- * PARC initial implementation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
* Andy Clement pushed down into bcel module
* ******************************************************************/
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/Tag.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/Tag.java
index 1d6935e6d..cd293fd21 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/Tag.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/Tag.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2002 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:
- * PARC initial implementation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * PARC initial implementation
* Andy Clement pushed down into bcel module
* ******************************************************************/
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/AnnotationAccessFlagTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/AnnotationAccessFlagTest.java
index abc6e8513..fed0f7bb4 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/AnnotationAccessFlagTest.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/AnnotationAccessFlagTest.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2004 IBM
- * 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 implementation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Andy Clement - initial implementation
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.tests;
@@ -22,19 +22,19 @@ import org.aspectj.apache.bcel.util.SyntheticRepository;
import junit.framework.TestCase;
public class AnnotationAccessFlagTest extends TestCase {
-
+
private boolean verbose = false;
protected void setUp() throws Exception {
super.setUp();
}
-
+
/**
* If you write an annotation and compile it, the class file generated should be
* marked as an annotation type - which is detectable through BCEL.
*/
public void testAnnotationClassSaysItIs() throws ClassNotFoundException {
- ClassPath cp =
+ ClassPath cp =
new ClassPath("testdata"+File.separator+"testcode.jar"+File.pathSeparator+System.getProperty("java.class.path"));
SyntheticRepository repos = SyntheticRepository.getInstance(cp);
JavaClass clazz = repos.loadClass("SimpleAnnotation");
@@ -45,11 +45,11 @@ public class AnnotationAccessFlagTest extends TestCase {
assertTrue("Expected SimpleClass class to say it was not an annotation - but it didn't !",
!clazz.isAnnotation());
}
-
+
protected void tearDown() throws Exception {
super.tearDown();
}
-
+
}
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/AnnotationDefaultAttributeTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/AnnotationDefaultAttributeTest.java
index ced29d489..dc4945fcd 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/AnnotationDefaultAttributeTest.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/AnnotationDefaultAttributeTest.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2004 IBM
- * 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 implementation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Andy Clement - initial implementation
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.tests;
@@ -24,7 +24,7 @@ public class AnnotationDefaultAttributeTest extends BcelTestCase {
super.setUp();
}
-
+
/**
* For values in an annotation that have default values, we should be able to
* query the AnnotationDefault attribute against the method to discover the
@@ -32,7 +32,7 @@ public class AnnotationDefaultAttributeTest extends BcelTestCase {
*/
public void testMethodAnnotations() throws ClassNotFoundException {
JavaClass clazz = getClassFromJar("SimpleAnnotation");
-
+
Method m = getMethod(clazz,"fruit");
AnnotationDefault a = (AnnotationDefault) findAttribute("AnnotationDefault",m.getAttributes());
SimpleElementValue val = (SimpleElementValue) a.getElementValue();
@@ -45,5 +45,5 @@ public class AnnotationDefaultAttributeTest extends BcelTestCase {
protected void tearDown() throws Exception {
super.tearDown();
}
-
+
}
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/AnnotationGenTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/AnnotationGenTest.java
index 84f9d9532..90d51ca40 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/AnnotationGenTest.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/AnnotationGenTest.java
@@ -1,9 +1,9 @@
/*******************************************************************************
* Copyright (c) 2004 IBM 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
- *
+ * materials are made available under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
* Contributors: Andy Clement - initial implementation
******************************************************************************/
@@ -176,4 +176,4 @@ public class AnnotationGenTest extends BcelTestCase {
super.tearDown();
}
-} \ No newline at end of file
+}
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/AnonymousClassTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/AnonymousClassTest.java
index 4a9bc0a3f..b5ce1c8aa 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/AnonymousClassTest.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/AnonymousClassTest.java
@@ -1,13 +1,13 @@
/**
* Copyright (c) 2005 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:
- * Adrian Colyer - initial implementation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Adrian Colyer - initial implementation
*/
package org.aspectj.apache.bcel.classfile.tests;
@@ -26,35 +26,35 @@ import junit.framework.TestCase;
public class AnonymousClassTest extends TestCase {
private SyntheticRepository repos;
-
+
public void testRegularClassIsNotAnonymous() throws ClassNotFoundException {
JavaClass clazz = repos.loadClass("AnonymousClassTest");
assertFalse("regular outer classes are not anonymous",clazz.isAnonymous());
assertFalse("regular outer classes are not nested",clazz.isNested());
}
-
+
public void testNamedInnerClassIsNotAnonymous() throws ClassNotFoundException {
JavaClass clazz = repos.loadClass("AnonymousClassTest$X");
- assertFalse("regular inner classes are not anonymous",clazz.isAnonymous());
- assertTrue("regular inner classes are nested",clazz.isNested());
+ assertFalse("regular inner classes are not anonymous",clazz.isAnonymous());
+ assertTrue("regular inner classes are nested",clazz.isNested());
}
-
+
public void testStaticInnerClassIsNotAnonymous() throws ClassNotFoundException {
JavaClass clazz = repos.loadClass("AnonymousClassTest$Y");
- assertFalse("regular static inner classes are not anonymous",clazz.isAnonymous());
- assertTrue("regular static inner classes are nested",clazz.isNested());
+ assertFalse("regular static inner classes are not anonymous",clazz.isAnonymous());
+ assertTrue("regular static inner classes are nested",clazz.isNested());
}
-
+
public void testAnonymousInnerClassIsAnonymous() throws ClassNotFoundException {
JavaClass clazz = repos.loadClass("AnonymousClassTest$1");
- assertTrue("anonymous inner classes are anonymous",clazz.isAnonymous());
- assertTrue("anonymous inner classes are anonymous",clazz.isNested());
+ assertTrue("anonymous inner classes are anonymous",clazz.isAnonymous());
+ assertTrue("anonymous inner classes are anonymous",clazz.isNested());
}
-
+
protected void setUp() throws Exception {
- ClassPath cp =
+ ClassPath cp =
new ClassPath("testdata"+File.separator+"testcode.jar"+File.pathSeparator+System.getProperty("java.class.path"));
repos = SyntheticRepository.getInstance(cp);
}
-
+
}
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/BcelTestCase.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/BcelTestCase.java
index b18d51308..a67eaca0a 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/BcelTestCase.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/BcelTestCase.java
@@ -1,12 +1,12 @@
/* *******************************************************************
* Copyright (c) 2004 - 2016 IBM, VMware, 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:
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
* Andy Clement - initial implementation {date}
* ******************************************************************/
@@ -162,7 +162,7 @@ public abstract class BcelTestCase extends TestCase {
elements.add(nvGen);
return new AnnotationGen(t, elements, visibility, cp);
}
-
+
public Attribute getAttribute(Attribute[] attrs, byte tag) {
for (Attribute attr: attrs) {
if (attr.getTag() == tag) {
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ConstantPoolToStringTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ConstantPoolToStringTest.java
index 3a41c6c70..73b863067 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ConstantPoolToStringTest.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ConstantPoolToStringTest.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2018 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 implementation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Andy Clement - initial implementation
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.tests;
@@ -30,17 +30,17 @@ public class ConstantPoolToStringTest extends BcelTestCase {
ConstantPool pool = clazz.getConstantPool();
Method[] methods = clazz.getMethods();
String codeString = methods[1].getCode().getCodeString();
- assertEquals("Code(max_stack = 1, max_locals = 2, code_length = 13)\n" +
- "0: invokedynamic #0.run ()Ljava/lang/Runnable; (2)\n" +
- "5: astore_1\n" +
- "6: aload_1\n" +
- "7: invokeinterface java.lang.Runnable.run ()V (3) 1 0\n" +
+ assertEquals("Code(max_stack = 1, max_locals = 2, code_length = 13)\n" +
+ "0: invokedynamic #0.run ()Ljava/lang/Runnable; (2)\n" +
+ "5: astore_1\n" +
+ "6: aload_1\n" +
+ "7: invokeinterface java.lang.Runnable.run ()V (3) 1 0\n" +
"12: return\n",codeString);
-
+
// #20 = MethodHandle 6:#32 // REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
String cts = pool.constantToString(pool.getConstant(20));
assertEquals("6:java.lang.invoke.LambdaMetafactory.metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;",cts);
-
+
// #21 = MethodType #10 // ()V
cts = pool.constantToString(pool.getConstant(21));
assertEquals("()V",cts);
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ElementValueGenTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ElementValueGenTest.java
index ec7645aeb..02604fdfd 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ElementValueGenTest.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ElementValueGenTest.java
@@ -1,9 +1,9 @@
/*******************************************************************************
* Copyright (c) 2004 IBM 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
- *
+ * materials are made available under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
* Contributors: Andy Clement - initial implementation
******************************************************************************/
@@ -226,4 +226,4 @@ public class ElementValueGenTest extends BcelTestCase {
super.tearDown();
}
-} \ No newline at end of file
+}
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/EnclosingMethodAttributeTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/EnclosingMethodAttributeTest.java
index a03c9b386..86d4c3ddf 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/EnclosingMethodAttributeTest.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/EnclosingMethodAttributeTest.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2004 IBM
- * 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 implementation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Andy Clement - initial implementation
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.tests;
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/EnumAccessFlagTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/EnumAccessFlagTest.java
index 2909a391c..1896cec9a 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/EnumAccessFlagTest.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/EnumAccessFlagTest.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2004 IBM
- * 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 implementation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Andy Clement - initial implementation
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.tests;
@@ -22,20 +22,20 @@ import org.aspectj.apache.bcel.util.SyntheticRepository;
import junit.framework.TestCase;
public class EnumAccessFlagTest extends TestCase {
-
+
private boolean verbose = false;
protected void setUp() throws Exception {
super.setUp();
}
-
+
/**
* An enumerated type, once compiled, should result in a class file that
* is marked such that we can determine from the access flags (through BCEL) that
* it was originally an enum type declaration.
*/
public void testEnumClassSaysItIs() throws ClassNotFoundException {
- ClassPath cp =
+ ClassPath cp =
new ClassPath("testdata"+File.separator+"testcode.jar"+File.pathSeparator+System.getProperty("java.class.path"));
SyntheticRepository repos = SyntheticRepository.getInstance(cp);
JavaClass clazz = repos.loadClass("SimpleEnum");
@@ -46,11 +46,11 @@ public class EnumAccessFlagTest extends TestCase {
assertTrue("Expected SimpleClass class to say it was not an enum - but it didn't !",
!clazz.isEnum());
}
-
+
protected void tearDown() throws Exception {
super.tearDown();
}
-
+
}
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/FieldAnnotationsTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/FieldAnnotationsTest.java
index 54969f490..cdf705077 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/FieldAnnotationsTest.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/FieldAnnotationsTest.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2004 IBM
- * 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 implementation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Andy Clement - initial implementation
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.tests;
@@ -25,19 +25,19 @@ import org.aspectj.apache.bcel.util.SyntheticRepository;
public class FieldAnnotationsTest extends BcelTestCase {
-
+
protected void setUp() throws Exception {
super.setUp();
}
-
-
+
+
/**
* Check field annotations are retrievable.
*/
public void testFieldAnnotations() throws ClassNotFoundException {
JavaClass clazz = getClassFromJar("AnnotatedFields");
-
+
checkAnnotatedField(clazz,"i","SimpleAnnotation","id","1");
checkAnnotatedField(clazz,"s","SimpleAnnotation","id","2");
@@ -48,17 +48,17 @@ public class FieldAnnotationsTest extends BcelTestCase {
*/
public void testFieldAnnotationsReadWrite() throws ClassNotFoundException,IOException {
JavaClass clazz = getClassFromJar("AnnotatedFields");
-
+
checkAnnotatedField(clazz,"i","SimpleAnnotation","id","1");
checkAnnotatedField(clazz,"s","SimpleAnnotation","id","2");
-
+
// Write it out
File tfile = createTestdataFile("AnnotatedFields.class");
clazz.dump(tfile);
-
+
SyntheticRepository repos2 = createRepos(".");
JavaClass clazz2 = repos2.loadClass("AnnotatedFields");
-
+
checkAnnotatedField(clazz,"i","SimpleAnnotation","id","1");
checkAnnotatedField(clazz,"s","SimpleAnnotation","id","2");
@@ -72,7 +72,7 @@ public class FieldAnnotationsTest extends BcelTestCase {
public void testFieldAnnotationsModification() throws ClassNotFoundException, IOException {
boolean dbg = false;
JavaClass clazz = getClassFromJar("AnnotatedFields");
-
+
ClassGen clg = new ClassGen(clazz);
Field f = clg.getFields()[0];
if (dbg) System.err.println("Field in freshly constructed class is: "+f);
@@ -87,16 +87,16 @@ public class FieldAnnotationsTest extends BcelTestCase {
if (dbg) System.err.println("Replacing original field with new field that has extra annotation");
clg.removeField(f);
clg.addField(fg.getField());
-
+
f = clg.getFields()[1]; // there are two fields in the class, removing and readding has changed the order
// so this time index [1] is the 'int i' field
if (dbg) System.err.println("Field now looks like this: "+f);
if (dbg) System.err.println("With annotations: "+dumpAnnotations(f.getAnnotations()));
assertTrue("Should be 2 annotations on this field, but there are "+f.getAnnotations().length,f.getAnnotations().length==2);
}
-
+
// helper methods
-
+
public void checkAnnotatedField(JavaClass clazz,String fieldname,
String annotationName,String annotationElementName,String annotationElementValue) {
Field[] fields = clazz.getFields();
@@ -109,7 +109,7 @@ public class FieldAnnotationsTest extends BcelTestCase {
}
}
}
-
+
private void checkAnnotation(AnnotationGen a,String name,String elementname,String elementvalue) {
assertTrue("Expected annotation to have name "+name+" but it had name "+a.getTypeName(),
a.getTypeName().equals(name));
@@ -120,10 +120,10 @@ public class FieldAnnotationsTest extends BcelTestCase {
assertTrue("Expected element value "+elementvalue+" but was "+envp.getValue().stringifyValue(),
elementvalue.equals(envp.getValue().stringifyValue()));
}
-
+
// helper methods
-
+
public void checkValue(AnnotationGen a,String name,String tostring) {
for (NameValuePair element : a.getValues()) {
if (element.getNameString().equals(name)) {
@@ -139,5 +139,5 @@ public class FieldAnnotationsTest extends BcelTestCase {
protected void tearDown() throws Exception {
super.tearDown();
}
-
+
}
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GeneratingAnnotatedClassesTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GeneratingAnnotatedClassesTest.java
index 00a300b61..f493ca409 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GeneratingAnnotatedClassesTest.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GeneratingAnnotatedClassesTest.java
@@ -1,9 +1,9 @@
/*******************************************************************************
* Copyright (c) 2004 IBM 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
- *
+ * materials are made available under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
* Contributors: Andy Clement - initial implementation
******************************************************************************/
@@ -40,7 +40,7 @@ import org.aspectj.apache.bcel.util.SyntheticRepository;
* The program that some of the tests generate looks like this: public class HelloWorld { public static void main(String[] argv) {
* BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String name = null; try { name = "Andy"; }
* catch(IOException e) { return; } System.out.println("Hello, " + name); } }
- *
+ *
*/
public class GeneratingAnnotatedClassesTest extends BcelTestCase {
@@ -567,4 +567,4 @@ public class GeneratingAnnotatedClassesTest extends BcelTestCase {
super.tearDown();
}
-} \ No newline at end of file
+}
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GenericSignatureParsingTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GenericSignatureParsingTest.java
index c97e12678..d5f53c98d 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GenericSignatureParsingTest.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GenericSignatureParsingTest.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2005 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 (IBM) initial implementation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Andy Clement (IBM) initial implementation
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.tests;
@@ -34,11 +34,11 @@ import org.aspectj.apache.bcel.classfile.Utility;
* that is not part of the JVM type system, such as generic type and method
* declarations and parameterized types. This kind of information is
* needed to support reflection and debugging, and by the Java compiler.
- *
- * =============================================
- *
+ *
+ * =============================================
+ *
* ClassTypeSignature = LPackageSpecifier* SimpleClassTypeSignature ClassTypeSignatureSuffix*;
- *
+ *
* PackageSpecifier = Identifier/PackageSpecifier*
* SimpleClassTypeSignature= Identifier TypeArguments(opt)
* ClassTypeSignatureSuffix= .SimpleClassTypeSignature
@@ -51,7 +51,7 @@ import org.aspectj.apache.bcel.classfile.Utility;
* ArrayTypeSignature = [TypeSignature
* TypeSignature = [FieldTypeSignature
* [BaseType
- *
+ *
* <not sure those [ should be prefixing fts and bt>
* Examples:
* Ljava/util/List; == java.util.List
@@ -61,54 +61,54 @@ import org.aspectj.apache.bcel.classfile.Utility;
* Ljava/util/List<-Ljava/lang/Number;>; == java.util.List<? super java.lang.Number>
* Ljava/util/List<*>; == java.util.List<?>
* Ljava/util/Map<*-Ljava/lang/Number;>; == java.util.Map<?,? super java.lang.Number>
- *
- * =============================================
- *
+ *
+ * =============================================
+ *
* ClassSignature = FormalTypeParameters(opt) SuperclassSignature SuperinterfaceSignatures*
- *
+ *
* optional formal type parameters then a superclass signature then a superinterface signature
- *
+ *
* FormalTypeParameters = <FormalTypeParameter+>
- * FormalTypeParameter = Identifier ClassBound InterfaceBound*
+ * FormalTypeParameter = Identifier ClassBound InterfaceBound*
* ClassBound = :FieldTypeSignature(opt)
* InterfaceBound = :FieldTypeSignature
- *
+ *
* If it exists, a set of formal type parameters are contained in anglies and consist of an identifier a classbound (assumed to be
* object if not specified) and then an optional list of InterfaceBounds
- *
+ *
* SuperclassSignature = ClassTypeSignature
* SuperinterfaceSignature = ClassTypeSignature
* FieldTypeSignature = ClassTypeSignature
* ArrayTypeSignature
* TypeVariableSignature
- *
- *
+ *
+ *
* MethodTypeSignature = FormalTypeParameters(opt) ( TypeSignature* ) ReturnType ThrowsSignature*
* ReturnType = TypeSignature
* VoidDescriptor
* ThrowsSignature = ^ClassTypeSignature
* ^TypeVariableSignature
- *
- * Examples:
- *
+ *
+ * Examples:
+ *
* <T::Ljava/lang/Comparable<-Ljava/lang/Number;>;>
- *
+ *
* ClassBound not supplied, Object assumed. Interface bound is Comparable<? super Number>
- *
+ *
* "T:Ljava/lang/Object;:Ljava/lang/Comparable<-TT;>;","T extends java.lang.Object & java.lang.Comparable<? super T>"
*
*/
public class GenericSignatureParsingTest extends BcelTestCase {
-
-
- /**
- * Throw some generic format signatures at the BCEL signature
+
+
+ /**
+ * Throw some generic format signatures at the BCEL signature
* parsing code and see what it does.
*/
public void testParsingGenericSignatures_ClassTypeSignature() {
// trivial
checkClassTypeSignature("Ljava/util/List;","java.util.List");
-
+
// basics
checkClassTypeSignature("Ljava/util/List<Ljava/lang/String;>;","java.util.List<java.lang.String>");
checkClassTypeSignature("Ljava/util/List<Ljava/lang/Double;>;","java.util.List<java.lang.Double>");
@@ -118,37 +118,37 @@ public class GenericSignatureParsingTest extends BcelTestCase {
checkClassTypeSignature("Ljava/util/List<-Ljava/lang/Number;>;","java.util.List<? super java.lang.Number>");
checkClassTypeSignature("Ljava/util/List<*>;", "java.util.List<?>");
checkClassTypeSignature("Ljava/util/Map<*-Ljava/lang/Number;>;","java.util.Map<?,? super java.lang.Number>");
-
+
// with type params
checkClassTypeSignature("Ljava/util/Collection<TT;>;","java.util.Collection<T>");
-
+
// arrays
checkClassTypeSignature("Ljava/util/List<[Ljava/lang/String;>;","java.util.List<java.lang.String[]>");
checkClassTypeSignature("[Ljava/util/List<Ljava/lang/String;>;","java.util.List<java.lang.String>[]");
}
-
-
+
+
public void testMethodTypeToSignature() {
checkMethodTypeToSignature("void",new String[]{"java.lang.String[]","boolean"},"([Ljava/lang/String;Z)V");
checkMethodTypeToSignature("void",new String[]{"java.util.List<java/lang/String>"},"(Ljava/util/List<java/lang/String>;)V");
}
-
+
public void testMethodSignatureToArgumentTypes() {
checkMethodSignatureArgumentTypes("([Ljava/lang/String;Z)V",new String[]{"java.lang.String[]","boolean"});
// checkMethodSignatureArgumentTypes("(Ljava/util/List<java/lang/String>;)V",new String[]{"java.util.List<java/lang/String>"});
}
-
+
public void testMethodSignatureReturnType() {
checkMethodSignatureReturnType("([Ljava/lang/String;)Z","boolean");
}
-
+
public void testLoadingGenerics() throws ClassNotFoundException {
JavaClass clazz = getClassFromJar("PossibleGenericsSigs");
// J5TODO asc fill this bit in...
}
-
-
+
+
// helper methods below
// These routines call BCEL to determine if it can correctly translate from one form to the other.
@@ -158,21 +158,21 @@ public class GenericSignatureParsingTest extends BcelTestCase {
assertTrue("Only swallowed "+p+" chars of this sig "+sig+" (len="+sig.length()+")",p==sig.length());
assertTrue("Expected '"+expected+"' but got '"+result.toString()+"'",result.toString().equals(expected));
}
-
+
private void checkMethodTypeToSignature(String ret,String[] args,String expected) {
String res = GenericSignatureParsingTest.methodTypeToSignature(ret,args);
if (!res.equals(expected)) {
fail("Should match. Got: "+res+" Expected:"+expected);
}
}
-
+
private void checkMethodSignatureReturnType(String sig,String expected) {
String result = GenericSignatureParsingTest.methodSignatureReturnType(sig,false);
if (!result.equals(expected)) {
fail("Should match. Got: "+result+" Expected:"+expected);
}
}
-
+
private void checkMethodSignatureArgumentTypes(String in,String[] expected) {
String[] result = GenericSignatureParsingTest.methodSignatureArgumentTypes(in,false);
if (result.length!=expected.length) {
@@ -184,7 +184,7 @@ public class GenericSignatureParsingTest extends BcelTestCase {
fail("Argument: "+i+" should have been "+expected[i]+" but was "+string);
}
}
-
+
public Signature getSignatureAttribute(JavaClass clazz,String name) {
Method m = getMethod(clazz,name);
Attribute[] as = m.getAttributes();
@@ -201,7 +201,7 @@ public class GenericSignatureParsingTest extends BcelTestCase {
* Takes a string and consumes a single complete signature from it, returning
* how many chars it consumed. The chopit flag indicates whether to shorten
* type references ( java/lang/String => String )
- *
+ *
* FIXME asc this should also create some kind of object you can query for information about whether its parameterized, what the bounds are, etc...
*/
public static final int readClassTypeSignatureFrom(String signature, int posn, StringBuffer result, boolean chopit) {
@@ -217,37 +217,37 @@ public class GenericSignatureParsingTest extends BcelTestCase {
case 'S' : result.append("short"); return 1;
case 'Z' : result.append("boolean");return 1;
case 'V' : result.append("void"); return 1;
-
-
+
+
//FIXME ASC Need a state machine to check we are parsing the right stuff here !
- case 'T' :
+ case 'T' :
idx++;
int nextSemiIdx = signature.indexOf(';',idx);
result.append(signature.substring(idx,nextSemiIdx));
return nextSemiIdx+1-posn;
-
- case '+' :
+
+ case '+' :
result.append("? extends ");
return readClassTypeSignatureFrom(signature,idx+1,result,chopit)+1;
-
- case '-' :
+
+ case '-' :
result.append("? super ");
return readClassTypeSignatureFrom(signature,idx+1,result,chopit)+1;
-
- case '*' :
+
+ case '*' :
result.append("?");
return 1;
-
+
case 'L' : // Full class name
boolean parameterized = false;
int idxSemicolon = signature.indexOf(';',idx); // Look for closing ';' or '<'
int idxAngly = signature.indexOf('<',idx);
int endOfSig = idxSemicolon;
if ((idxAngly!=-1) && idxAngly<endOfSig) { endOfSig = idxAngly; parameterized = true; }
-
+
String p = signature.substring(idx+1,endOfSig);
String t = Utility.compactClassName(p,chopit);
-
+
result.append(t);
idx=endOfSig;
// we might have finished now, depending on whether this is a parameterized type...
@@ -263,15 +263,15 @@ public class GenericSignatureParsingTest extends BcelTestCase {
if (signature.charAt(idx)!=';') throw new RuntimeException("Did not find ';' at end of signature, found "+signature.charAt(idx));
idx++;
return idx-posn;
-
-
+
+
case '[' : // Array declaration
int dim = 0;
while (signature.charAt(idx)=='[') {dim++;idx++;}
idx+=readClassTypeSignatureFrom(signature,idx,result,chopit);
while (dim>0) {result.append("[]");dim--;}
return idx-posn;
-
+
default : throw new ClassFormatException("Invalid signature: `" +
signature + "'");
}
@@ -309,14 +309,14 @@ public class GenericSignatureParsingTest extends BcelTestCase {
default:
}
}
-
+
if (open) throw new RuntimeException("Illegally nested brackets:" + brackets);
-
+
return count;
}
- /**
+ /**
* Parse Java type such as "char", or "java.lang.String[]" and return the
* signature in byte code format, e.g. "C" or "[Ljava/lang/String;" respectively.
*
@@ -328,46 +328,46 @@ public class GenericSignatureParsingTest extends BcelTestCase {
char[] chars = type.toCharArray();
boolean char_found = false, delim = false;
int index = -1;
-
+
loop:
for (int i=0; i < chars.length; i++) {
switch (chars[i]) {
case ' ': case '\t': case '\n': case '\r': case '\f':
if (char_found) delim = true;
break;
-
+
case '[':
if (!char_found) throw new RuntimeException("Illegal type: " + type);
index = i;
break loop;
-
+
default:
char_found = true;
if (!delim) buf.append(chars[i]);
}
}
-
+
int brackets = 0;
-
+
if(index > 0) brackets = GenericSignatureParsingTest.countBrackets(type.substring(index));
-
+
type = buf.toString();
buf.setLength(0);
-
+
for (int i=0; i < brackets; i++) buf.append('[');
-
+
boolean found = false;
-
+
for(int i=Constants.T_BOOLEAN; (i <= Constants.T_VOID) && !found; i++) {
if (Constants.TYPE_NAMES[i].equals(type)) {
found = true;
buf.append(Constants.SHORT_TYPE_NAMES[i]);
}
}
-
+
// Class name
if (!found) buf.append('L' + type.replace('.', '/') + ';');
-
+
return buf.toString();
}
@@ -385,7 +385,7 @@ public class GenericSignatureParsingTest extends BcelTestCase {
String type;
try {
// Read return type after `)'
- index = signature.lastIndexOf(')') + 1;
+ index = signature.lastIndexOf(')') + 1;
type = Utility.signatureToString(signature.substring(index), chopit);
} catch (StringIndexOutOfBoundsException e) {
throw new ClassFormatException("Invalid method signature: " + signature);
@@ -397,10 +397,10 @@ public class GenericSignatureParsingTest extends BcelTestCase {
/**
* For some method signature (class file format) like '([Ljava/lang/String;)Z' this returns
* the string representing the return type its 'normal' form, e.g. 'boolean'
- *
+ *
* @param signature Method signature
* @return return type of method
- * @throws ClassFormatException
+ * @throws ClassFormatException
*/
public static final String methodSignatureReturnType(String signature) throws ClassFormatException {
return GenericSignatureParsingTest.methodSignatureReturnType(signature, true);
@@ -410,7 +410,7 @@ public class GenericSignatureParsingTest extends BcelTestCase {
/**
* For some method signature (class file format) like '([Ljava/lang/String;Z)V' this returns an array
* of strings representing the arguments in their 'normal' form, e.g. '{java.lang.String[],boolean}'
- *
+ *
* @param signature Method signature
* @param chopit Shorten class names
* @return Array of argument types
@@ -419,13 +419,13 @@ public class GenericSignatureParsingTest extends BcelTestCase {
List<String> vec = new ArrayList<>();
int index;
String[] types;
-
+
try { // Read all declarations between for `(' and `)'
if (signature.charAt(0) != '(')
throw new ClassFormatException("Invalid method signature: " + signature);
-
+
index = 1; // current string position
-
+
while(signature.charAt(index) != ')') {
Utility.ResultHolder rh = Utility.signatureToStringInternal(signature.substring(index),chopit);
vec.add(rh.getResult());
@@ -434,7 +434,7 @@ public class GenericSignatureParsingTest extends BcelTestCase {
} catch(StringIndexOutOfBoundsException e) {
throw new ClassFormatException("Invalid method signature: " + signature);
}
-
+
types = new String[vec.size()];
vec.toArray(types);
return types;
@@ -442,7 +442,7 @@ public class GenericSignatureParsingTest extends BcelTestCase {
/**
- * Converts string containing the method return and argument types
+ * Converts string containing the method return and argument types
* to a byte code method signature.
*
* @param returnType Return type of method (e.g. "char" or "java.lang.String[]")
@@ -450,9 +450,9 @@ public class GenericSignatureParsingTest extends BcelTestCase {
* @return Byte code representation of method signature
*/
public final static String methodTypeToSignature(String returnType, String[] methodArgs) throws ClassFormatException {
-
+
StringBuffer buf = new StringBuffer("(");
-
+
if (methodArgs != null) {
for (String methodArg : methodArgs) {
String str = GenericSignatureParsingTest.getSignature(methodArg);
@@ -463,10 +463,10 @@ public class GenericSignatureParsingTest extends BcelTestCase {
buf.append(str);
}
}
-
+
buf.append(")" + GenericSignatureParsingTest.getSignature(returnType));
-
+
return buf.toString();
}
-
+
}
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GenericsErasureTesting.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GenericsErasureTesting.java
index 73f2e6d1b..6f66ff579 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GenericsErasureTesting.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GenericsErasureTesting.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2005 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 (IBM) initial implementation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Andy Clement (IBM) initial implementation
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.tests;
@@ -21,8 +21,8 @@ import org.aspectj.apache.bcel.classfile.Signature;
* the signature attribute.
*/
public class GenericsErasureTesting extends BcelTestCase {
-
-
+
+
public void testLoadingGenerics() throws ClassNotFoundException {
JavaClass clazz = getClassFromJar("ErasureTestData");
Method m = getMethod(clazz,"getData");
@@ -31,10 +31,10 @@ public class GenericsErasureTesting extends BcelTestCase {
System.err.println(sig);
assertTrue("Incorrect: "+sig,sig.equals("()Ljava/util/Vector<Ljava/lang/String;>;"));
}
-
-
+
+
// helper methods below
-
+
public Signature getSignatureAttribute(JavaClass clazz,String name) {
Method m = getMethod(clazz,name);
Attribute[] as = m.getAttributes();
@@ -45,5 +45,5 @@ public class GenericsErasureTesting extends BcelTestCase {
}
return null;
}
-
+
}
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GetReflectMembersTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GetReflectMembersTest.java
index 06bd9ccc8..c5a3bff5f 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GetReflectMembersTest.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GetReflectMembersTest.java
@@ -1,12 +1,12 @@
/* *******************************************************************
* Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
* Adrian Colyer Initial implementation
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.tests;
@@ -25,37 +25,37 @@ public class GetReflectMembersTest extends TestCase {
private Repository bcelRepository;
private JavaClass jc;
-
+
public void testGetMethod() throws Exception {
assertNotNull(jc.getMethod(GetMe.class.getMethod("foo",new Class[] {String.class})));
}
-
+
public void testGetConstructor() throws Exception {
- assertNotNull(jc.getMethod(GetMe.class.getConstructor(new Class[] {int.class})));
+ assertNotNull(jc.getMethod(GetMe.class.getConstructor(new Class[] {int.class})));
}
-
+
public void testGetField() throws Exception {
assertNotNull(jc.getField(GetMe.class.getDeclaredField("x")));
}
-
+
protected void setUp() throws Exception {
super.setUp();
this.bcelRepository = new ClassLoaderRepository(getClass().getClassLoader());
this.jc = bcelRepository.loadClass(GetMe.class);
}
-
+
protected void tearDown() throws Exception {
super.tearDown();
this.bcelRepository.clear();
}
-
+
private static class GetMe {
-
+
private int x;
-
+
public GetMe(int x) { this.x = x;}
-
+
public void foo(String s) {};
-
+
}
}
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/LocalVariableTypeTableTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/LocalVariableTypeTableTest.java
index 202cd5462..017367fc9 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/LocalVariableTypeTableTest.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/LocalVariableTypeTableTest.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2004 IBM
- * 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 implementation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Andy Clement - initial implementation
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.tests;
@@ -21,23 +21,23 @@ import org.aspectj.apache.bcel.classfile.Utility;
public class LocalVariableTypeTableTest extends BcelTestCase {
-
+
protected void setUp() throws Exception {
super.setUp();
}
-
+
/**
* Check the local variable type table includes information about generic signatures.
*/
public void testLocalVariableTypeTableAttribute() throws ClassNotFoundException {
JavaClass clazz = getClassFromJar("SimpleGenericsProgram");
-
+
Method mainMethod = getMethod(clazz,"main");
Code codeAttr = (Code) findAttribute("Code",mainMethod.getAttributes());
- LocalVariableTypeTable localVariableTypeTable =
+ LocalVariableTypeTable localVariableTypeTable =
(LocalVariableTypeTable) findAttribute("LocalVariableTypeTable",codeAttr.getAttributes());
-
+
assertTrue("Should be two entries in the LocalVariableTypeTable but found "+localVariableTypeTable.getTableLength(),
localVariableTypeTable.getTableLength()==2);
@@ -64,9 +64,9 @@ public class LocalVariableTypeTableTest extends BcelTestCase {
}
if (!tc1OK || !tc2OK) fail(errormessage);
}
-
+
protected void tearDown() throws Exception {
super.tearDown();
}
-
+
}
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/MethodAnnotationsTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/MethodAnnotationsTest.java
index 26f877cce..5b7fb8a5b 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/MethodAnnotationsTest.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/MethodAnnotationsTest.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2004 IBM
- * 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 implementation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Andy Clement - initial implementation
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.tests;
@@ -23,41 +23,41 @@ import org.aspectj.apache.bcel.util.SyntheticRepository;
public class MethodAnnotationsTest extends BcelTestCase {
-
+
protected void setUp() throws Exception {
super.setUp();
}
-
+
public void testMethodAnnotations() throws ClassNotFoundException {
JavaClass clazz = getClassFromJar("AnnotatedMethods");
-
+
checkAnnotatedMethod(clazz,"method1","SimpleAnnotation","id","1");
checkAnnotatedMethod(clazz,"method2","SimpleAnnotation","id","2");
}
-
+
public void testMethodAnnotationsReadWrite() throws ClassNotFoundException,IOException {
JavaClass clazz = getClassFromJar("AnnotatedMethods");
-
+
checkAnnotatedMethod(clazz,"method1","SimpleAnnotation","id","1");
checkAnnotatedMethod(clazz,"method2","SimpleAnnotation","id","2");
-
+
// Write it out
File tfile = createTestdataFile("AnnotatedMethods.class");
clazz.dump(tfile);
-
+
SyntheticRepository repos2 = createRepos(".");
JavaClass clazz2 = repos2.loadClass("AnnotatedMethods");
-
+
checkAnnotatedMethod(clazz,"method1","SimpleAnnotation","id","1");
checkAnnotatedMethod(clazz,"method2","SimpleAnnotation","id","2");
assertTrue(tfile.delete());
}
-
+
// helper methods
-
+
public void checkAnnotatedMethod(JavaClass clazz,String methodname,
String annotationName,String annotationElementName,String annotationElementValue) {
Method[] methods = clazz.getMethods();
@@ -70,7 +70,7 @@ public class MethodAnnotationsTest extends BcelTestCase {
}
}
}
-
+
private void checkAnnotation(AnnotationGen a,String name,String elementname,String elementvalue) {
assertTrue("Expected annotation to have name "+name+" but it had name "+a.getTypeName(),
a.getTypeName().equals(name));
@@ -81,10 +81,10 @@ public class MethodAnnotationsTest extends BcelTestCase {
assertTrue("Expected element value "+elementvalue+" but was "+envp.getValue().stringifyValue(),
elementvalue.equals(envp.getValue().stringifyValue()));
}
-
+
// helper methods
-
+
public void checkValue(AnnotationGen a,String name,String tostring) {
for (NameValuePair element : a.getValues()) {
if (element.getNameString().equals(name)) {
@@ -100,5 +100,5 @@ public class MethodAnnotationsTest extends BcelTestCase {
protected void tearDown() throws Exception {
super.tearDown();
}
-
+
}
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/MethodParametersTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/MethodParametersTest.java
index 76a9b84d8..295666b61 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/MethodParametersTest.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/MethodParametersTest.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2013 VMware
- * 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 implementation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Andy Clement - initial implementation
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.tests;
@@ -17,11 +17,11 @@ import org.aspectj.apache.bcel.classfile.Method;
import org.aspectj.apache.bcel.classfile.MethodParameters;
public class MethodParametersTest extends BcelTestCase {
-
+
protected void setUp() throws Exception {
super.setUp();
}
-
+
public void testMethodParameters1() throws Exception {
JavaClass jc = getClassFromJava8Jar("Parameters");
Method m = getMethod(jc, "foo");
@@ -34,7 +34,7 @@ public class MethodParametersTest extends BcelTestCase {
assertFalse(mp.isSynthetic(0));
assertFalse(mp.isMandated(0));
}
-
+
// this method specifies the receiver
public void testMethodParameters2() throws Exception {
JavaClass jc = getClassFromJava8Jar("Parameters");
@@ -53,34 +53,34 @@ public class MethodParametersTest extends BcelTestCase {
Method m = getMethod(jc, "<init>");
MethodParameters mp = (MethodParameters)getAttribute(m.getAttributes(),Constants.ATTR_METHOD_PARAMETERS);
assertEquals(2,mp.getParametersCount());
-
+
assertEquals("this$0",mp.getParameterName(0));
assertTrue(mp.isFinal(0));
assertFalse(mp.isSynthetic(0));
assertTrue(mp.isMandated(0));
-
+
assertEquals("x",mp.getParameterName(1));
assertFalse(mp.isFinal(1));
assertFalse(mp.isSynthetic(1));
assertFalse(mp.isMandated(1));
}
-
+
// access flags
public void testMethodParameters4() throws Exception {
JavaClass jc = getClassFromJava8Jar("Parameters$Color");
Method m = getMethod(jc, "<init>");
MethodParameters mp = (MethodParameters)getAttribute(m.getAttributes(),Constants.ATTR_METHOD_PARAMETERS);
assertEquals(2,mp.getParametersCount());
-
+
assertEquals("$enum$name",mp.getParameterName(0));
assertFalse(mp.isFinal(0));
assertTrue(mp.isSynthetic(0));
assertFalse(mp.isMandated(0));
-
+
assertEquals("$enum$ordinal",mp.getParameterName(1));
assertFalse(mp.isFinal(1));
assertTrue(mp.isSynthetic(1));
assertFalse(mp.isMandated(1));
}
-
-} \ No newline at end of file
+
+}
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ModuleTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ModuleTest.java
index 454817df8..2eab96c54 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ModuleTest.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ModuleTest.java
@@ -1,10 +1,10 @@
/* *******************************************************************
* Copyright (c) 2016-2017 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
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.tests;
@@ -26,7 +26,7 @@ import org.aspectj.apache.bcel.classfile.SourceFile;
/**
* http://cr.openjdk.java.net/~mr/jigsaw/spec/lang-vm.html
- *
+ *
* @author Andy Clement
*/
public class ModuleTest extends BcelTestCase {
@@ -38,7 +38,7 @@ public class ModuleTest extends BcelTestCase {
assertNotNull(javaClass);
assertEquals(Constants.MAJOR_1_9,javaClass.getMajor());
assertEquals(Constants.MINOR_1_9,javaClass.getMinor());
- assertEquals(Constants.ACC_MODULE,javaClass.getModifiers());
+ assertEquals(Constants.ACC_MODULE,javaClass.getModifiers());
assertEquals(0,javaClass.getSuperclassNameIndex());
assertEquals(0,javaClass.getInterfaceIndices().length);
assertEquals(0,javaClass.getFields().length);
@@ -65,7 +65,7 @@ public class ModuleTest extends BcelTestCase {
}
}
}
-
+
public void testRequires() throws Exception {
Module moduleAttr = getModuleAttribute("testdata/modules/two/d/module-info.class");
@@ -80,7 +80,7 @@ public class ModuleTest extends BcelTestCase {
assertEquals("b.c.d",requires[2].getModuleName());
assertEquals("c.d.e",requires[3].getModuleName());
}
-
+
public void testExports() throws Exception {
Module moduleAttr = getModuleAttribute("testdata/modules/two/e/module-info.class");
Export[] exports = moduleAttr.getExports();
@@ -95,7 +95,7 @@ public class ModuleTest extends BcelTestCase {
assertEquals("a.b.c",exports[2].getToModuleNames()[0]);
assertEquals("b.c.d",exports[2].getToModuleNames()[1]);
}
-
+
public void testOpens() throws Exception {
Module moduleAttr = getModuleAttribute("testdata/modules/two/h/module-info.class");
Open[] opens = moduleAttr.getOpens();
@@ -104,7 +104,7 @@ public class ModuleTest extends BcelTestCase {
assertEquals("opens com.foo2 to a.b.c", opens[1].toString());
assertEquals("opens com.foo3 to a.b.c, b.c.d", opens[2].toString());
}
-
+
public void testUses() throws Exception {
Module moduleAttr = getModuleAttribute("testdata/modules/two/f/module-info.class");
Uses[] uses = moduleAttr.getUses();
@@ -112,7 +112,7 @@ public class ModuleTest extends BcelTestCase {
assertEquals("com/foo1/I1",uses[0].getTypeName());
assertEquals("uses com.foo1.I1",uses[0].toString());
}
-
+
public void testProvides() throws Exception {
Module moduleAttr = getModuleAttribute("testdata/modules/two/g/module-info.class");
Provide[] provides = moduleAttr.getProvides();
@@ -126,11 +126,11 @@ public class ModuleTest extends BcelTestCase {
}
// ---
-
+
private Module getModuleAttribute(String moduleInfoClass) throws Exception {
ClassParser classParser = new ClassParser(moduleInfoClass);
JavaClass javaClass = classParser.parse();
return (Module)getAttribute(javaClass.getAttributes(), Constants.ATTR_MODULE);
}
-
+
}
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ParameterAnnotationsTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ParameterAnnotationsTest.java
index 8a979b73f..334ba840f 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ParameterAnnotationsTest.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ParameterAnnotationsTest.java
@@ -1,9 +1,9 @@
/*******************************************************************************
* Copyright (c) 2004 IBM 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
- *
+ * materials are made available under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
* Contributors: Andy Clement - initial implementation
******************************************************************************/
@@ -65,12 +65,12 @@ public class ParameterAnnotationsTest extends BcelTestCase {
ClassGen clg = createClassGen("HelloWorld");
ConstantPool cpg = clg.getConstantPool();
InstructionList il = new InstructionList();
-
+
buildClassContentsWithAnnotatedMethods(clg,cpg,il,true);
-
+
int i = clg.getMethods().length;
assertTrue("Class should have 2 methods but has "+i,i==2);
-
+
Method mainMethod = clg.getMethods()[0];
AnnotationGen[] annos = mainMethod.getAnnotationsOnParameter(0);
assertTrue("Should be two annotation on the 'argv' parameter to main() but there are "+annos.length,annos.length==2);
@@ -79,9 +79,9 @@ public class ParameterAnnotationsTest extends BcelTestCase {
assertTrue("This annotation should contain the string 'fruit=Oranges' but it is "+annos[1].toString(),
annos[1].toString().contains("fruit=Oranges"));
}
-
-
-
+
+
+
/**
* Check we can save and load a constructed class that contains parameter annotations
*/
@@ -89,18 +89,18 @@ public class ParameterAnnotationsTest extends BcelTestCase {
ClassGen clg = createClassGen("HelloWorld");
ConstantPool cpg = clg.getConstantPool();
InstructionList il = new InstructionList();
-
+
buildClassContentsWithAnnotatedMethods(clg,cpg,il,true);
-
+
dumpClass(clg,"temp5","HelloWorld.class");
-
+
JavaClass jc = getClassFrom("temp5","HelloWorld");
-
+
clg = new ClassGen(jc);
-
+
int i = clg.getMethods().length;
assertTrue("Class should have 2 methods but has "+i,i==2);
-
+
Method mainMethod = clg.getMethods()[0];
AnnotationGen[] annos = mainMethod.getAnnotationsOnParameter(0);
assertTrue("Should be two annotation on the 'argv' parameter to main() but there are "+annos.length,annos.length==2);
@@ -109,45 +109,45 @@ public class ParameterAnnotationsTest extends BcelTestCase {
assertTrue("This annotation should contain the string 'fruit=Oranges' but it is "+annos[1].toString(),
annos[1].toString().contains("fruit=Oranges"));
assertTrue(wipe("temp5","HelloWorld.class"));
-
+
}
-
-
+
+
/*
* Load an existing class, add new parameter annotations, save and then reload it
*/
public void testParameterAnnotations_loadedThenModifiedThenSavedAndLoadedOK() throws ClassNotFoundException {
JavaClass jc = getClassFrom("testcode.jar","AnnotatedParameters");
-
+
ClassGen clg = new ClassGen(jc);
ConstantPool cpg = clg.getConstantPool();
-
+
//
// Foo method looks like this:
// public void foo(@SimpleAnnotation(id=2) int arg1,
// @SimpleAnnotation(id=3) @AnnotationEnumElement(enumval=SimpleEnum.Red) String arg2)
Method m = findMethod(clg,"foo");
assertTrue("Should be able to find method foo but couldn't",m!=null);
-
-
+
+
/////////////////////// 1. Check the right number of annotations are there
int i = m.getAnnotationsOnParameter(1).length;
assertTrue("Should be two annotations on the second parameter but found: "+i,i==2);
-
-
+
+
/////////////////////// 2. Let's add a new parameter annotation, a visible one, to the first parameter.
// Build a modifiable version of the foo method
MethodGen mg = new MethodGen(m,clg.getClassName(),cpg);
-
+
// Check the annotations survived that transform
i = mg.getAnnotationsOnParameter(1).size();
assertTrue("Should be two annotations on the second parameter but found: "+i,i==2);
-
+
// That worked, so let's add a new parameter annotation
mg.addParameterAnnotation(0,createFruitAnnotation(cpg,"Banana",true));
-
+
// Foo method should now look like this:
// public void foo(@SimpleAnnotation(id=2) @SimpleStringAnnotation(fruit=Banana) int arg1,
// @SimpleAnnotation(id=3) @AnnotationEnumElement(enumval=SimpleEnum.Red) String arg2)
@@ -160,17 +160,17 @@ public class ParameterAnnotationsTest extends BcelTestCase {
// delete the old method and add the new one
clg.removeMethod(m);
clg.addMethod(mg.getMethod());
-
+
/////////////////////// 3. Dump it to disk
dumpClass(clg,"temp2","AnnotatedParameters.class");
-
+
/////////////////////// 4. Load it back in and verify the annotations persisted
JavaClass jc2 = getClassFrom("temp2","AnnotatedParameters");
m = jc2.getMethods()[2];
AnnotationGen[] p1annotations = m.getAnnotationsOnParameter(0);
AnnotationGen[] p2annotations = m.getAnnotationsOnParameter(1);
-
+
assertTrue("Expected two annotations on the first parameter but found "+p1annotations.length,p1annotations.length==2);
assertTrue("Expected two annotations on the second parameter but found "+p2annotations.length,p2annotations.length==2);
String expectedString = "[@SimpleAnnotation(id=2),@SimpleStringAnnotation(fruit=Banana)]";
@@ -179,44 +179,44 @@ public class ParameterAnnotationsTest extends BcelTestCase {
expectedString = "[@SimpleAnnotation(id=3),@AnnotationEnumElement(enumval=LSimpleEnum;Red)]";
assertTrue("Expected formatted short string of '"+expectedString+"' but it was '"+dumpAnnotations(p2annotations)+"'",
dumpAnnotations(p2annotations).equals(expectedString));
-
+
assertTrue(wipe("temp2","AnnotatedParameters.class"));
}
-
-
+
+
/**
* same as above test but attaching invisible runtime parameter annotations
- */
+ */
public void testParameterAnnotations_loadedThenModifiedWithInvisibleAnnotationThenSavedAndLoadedOK() throws ClassNotFoundException {
JavaClass jc = getClassFrom("testcode.jar","AnnotatedParameters");
ClassGen clg = new ClassGen(jc);
ConstantPool cpg = clg.getConstantPool();
-
+
//
// Foo method looks like this:
// public void foo(@SimpleAnnotation(id=2) int arg1,
// @SimpleAnnotation(id=3) @AnnotationEnumElement(enumval=SimpleEnum.Red) String arg2)
Method m = findMethod(clg,"foo");
assertTrue("Should be able to find method foo but couldn't",m!=null);
-
-
+
+
/////////////////////// 1. Check the right number of annotations are there
int i = m.getAnnotationsOnParameter(1).length;
assertTrue("Should be two annotations on the second parameter but found: "+i,i==2);
-
-
+
+
/////////////////////// 2. Let's add a new parameter annotation, a visible one, to the first parameter.
// Build a modifiable version of the foo method
MethodGen mg = new MethodGen(m,clg.getClassName(),cpg);
-
+
// Check the annotations survived that transform
i = mg.getAnnotationsOnParameter(1).size();
assertTrue("Should be two annotations on the second parameter but found: "+i,i==2);
-
+
// That worked, so let's add a new parameter annotation
mg.addParameterAnnotation(0,createFruitAnnotation(cpg,"Banana",false));
-
+
// Foo method should now look like this:
// public void foo(@SimpleAnnotation(id=2) @SimpleStringAnnotation(fruit=Banana) int arg1,
// @SimpleAnnotation(id=3) @AnnotationEnumElement(enumval=SimpleEnum.Red) String arg2)
@@ -230,10 +230,10 @@ public class ParameterAnnotationsTest extends BcelTestCase {
// delete the old method and add the new one
clg.removeMethod(m);
clg.addMethod(mg.getMethod());
-
+
/////////////////////// 3. Dump it to disk
dumpClass(clg,"temp3","AnnotatedParameters.class");
-
+
/////////////////////// 4. Load it back in and verify the annotations persisted
JavaClass jc2 = getClassFrom("temp3","AnnotatedParameters");
@@ -241,7 +241,7 @@ public class ParameterAnnotationsTest extends BcelTestCase {
m = jc2.getMethods()[2];
AnnotationGen[] p1annotations = m.getAnnotationsOnParameter(0);
AnnotationGen[] p2annotations = m.getAnnotationsOnParameter(1);
-
+
assertTrue("Expected two annotations on the first parameter but found "+p1annotations.length,p1annotations.length==2);
assertTrue("Expected two annotations on the second parameter but found "+p2annotations.length,p2annotations.length==2);
String expectedString = "[@SimpleAnnotation(id=2),@SimpleStringAnnotation(fruit=Banana)]";
@@ -250,12 +250,12 @@ public class ParameterAnnotationsTest extends BcelTestCase {
expectedString = "[@SimpleAnnotation(id=3),@AnnotationEnumElement(enumval=LSimpleEnum;Red)]";
assertTrue("Expected formatted short string of '"+expectedString+"' but it was '"+dumpAnnotations(p2annotations)+"'",
dumpAnnotations(p2annotations).equals(expectedString));
-
+
assertTrue("Second annotation on first parameter should be runtime invisible?",
!p1annotations[1].isRuntimeVisible());
assertTrue(wipe("temp3","AnnotatedParameters.class"));
-
-
+
+
// 5. Verify that when annotations for parameters are unpacked from attributes, the
// attributes vanish !
clg = new ClassGen(jc2);
@@ -265,18 +265,18 @@ public class ParameterAnnotationsTest extends BcelTestCase {
List<AnnotationGen> l = mg.getAnnotationsOnParameter(0);
assertTrue("Should be 2 annotations on first parameter but there is only "+l.size()+":"+l.toString(),
l.size()==2);
- assertTrue("Should be 0 but there are "+mg.getAttributes().size(),mg.getAttributes().size()==0);
+ assertTrue("Should be 0 but there are "+mg.getAttributes().size(),mg.getAttributes().size()==0);
}
-
+
private Method findMethod(ClassGen c,String mname) {
Method[] ms = c.getMethods();
for (Method m : ms) {
if (m.getName().equals(mname)) return m;
}
return null;
- }
-
+ }
+
private void dumpClass(ClassGen cg, String fname) {
try {
File f = createTestdataFile(fname);
@@ -285,7 +285,7 @@ public class ParameterAnnotationsTest extends BcelTestCase {
System.err.println(e);
}
}
-
+
private void dumpClass(ClassGen cg, String dir, String fname) {
dumpClass(cg,dir+File.separator+fname);
@@ -355,11 +355,11 @@ public class ParameterAnnotationsTest extends BcelTestCase {
LocalVariableGen var_ex = mg.addLocalVariable("ex",Type.getType("Ljava.io.IOException;"),null,null);
int var_ex_slot = var_ex.getIndex();
-
+
InstructionHandle handler = il.append(InstructionFactory.createASTORE(var_ex_slot));
var_ex.setStart(handler);
var_ex.setEnd(il.append(InstructionConstants.RETURN));
-
+
mg.addExceptionHandler(try_start, try_end, handler,
new ObjectType("java.io.IOException"));
@@ -396,7 +396,7 @@ public class ParameterAnnotationsTest extends BcelTestCase {
// would have to be computed on the fly and add a default constructor
// method to the class, which is empty in this case.
- mg.addParameterAnnotation(0,createFruitAnnotation(cp,"Apples",true));
+ mg.addParameterAnnotation(0,createFruitAnnotation(cp,"Apples",true));
mg.addParameterAnnotation(0,createFruitAnnotation(cp,"Oranges",true));
mg.setMaxStack();
mg.setMaxLocals();
@@ -404,7 +404,7 @@ public class ParameterAnnotationsTest extends BcelTestCase {
il.dispose(); // Allow instruction handles to be reused
cg.addEmptyConstructor(Constants.ACC_PUBLIC);
}
-
+
private void buildClassContents(ClassGen cg, ConstantPool cp, InstructionList il) {
// Create method 'public static void main(String[]argv)'
MethodGen mg = createMethodGen("main",il,cp);
@@ -468,11 +468,11 @@ public class ParameterAnnotationsTest extends BcelTestCase {
LocalVariableGen var_ex = mg.addLocalVariable("ex",Type.getType("Ljava.io.IOException;"),null,null);
int var_ex_slot = var_ex.getIndex();
-
+
InstructionHandle handler = il.append(InstructionFactory.createASTORE(var_ex_slot));
var_ex.setStart(handler);
var_ex.setEnd(il.append(InstructionConstants.RETURN));
-
+
mg.addExceptionHandler(try_start, try_end, handler,
new ObjectType("java.io.IOException"));
@@ -520,18 +520,18 @@ public class ParameterAnnotationsTest extends BcelTestCase {
SyntheticRepository repos = createRepos(where);
return repos.loadClass(clazzname);
}
-
-
-
+
+
+
// helper methods
-
+
private ClassGen createClassGen(String classname) {
return new ClassGen(classname, "java.lang.Object",
"<generated>", Constants.ACC_PUBLIC | Constants.ACC_SUPER, null);
}
-
+
private MethodGen createMethodGen(String methodname,InstructionList il,ConstantPool cp) {
return new MethodGen(
Constants.ACC_STATIC | Constants.ACC_PUBLIC, // access flags
@@ -542,7 +542,7 @@ public class ParameterAnnotationsTest extends BcelTestCase {
il, cp);
}
-
+
public AnnotationGen createSimpleVisibleAnnotation(ConstantPool cp) {
SimpleElementValue evg = new SimpleElementValue(
ElementValue.PRIMITIVE_INT, cp, 4);
@@ -557,18 +557,18 @@ public class ParameterAnnotationsTest extends BcelTestCase {
AnnotationGen a = new AnnotationGen(t, elements,true, cp);
return a;
}
-
+
public AnnotationGen createCombinedAnnotation(ConstantPool cp) {
// Create an annotation instance
AnnotationGen a = createSimpleVisibleAnnotation(cp);
ArrayElementValue array = new ArrayElementValue(cp);
- array.addElement(new AnnotationElementValue(a,cp));
+ array.addElement(new AnnotationElementValue(a,cp));
NameValuePair nvp = new NameValuePair("value",array,cp);
List<NameValuePair> elements = new ArrayList<>();
elements.add(nvp);
return new AnnotationGen(new ObjectType("CombinedAnnotation"),elements,true,cp);
}
-
+
public AnnotationGen createSimpleInvisibleAnnotation(ConstantPool cp) {
SimpleElementValue evg = new SimpleElementValue(
ElementValue.PRIMITIVE_INT, cp, 4);
@@ -587,4 +587,4 @@ public class ParameterAnnotationsTest extends BcelTestCase {
super.tearDown();
}
-} \ No newline at end of file
+}
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/RuntimeVisibleAnnotationAttributeTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/RuntimeVisibleAnnotationAttributeTest.java
index 62c1b3bd7..6c04eac28 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/RuntimeVisibleAnnotationAttributeTest.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/RuntimeVisibleAnnotationAttributeTest.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2004 IBM
- * 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 implementation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Andy Clement - initial implementation
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.tests;
@@ -35,12 +35,12 @@ import org.aspectj.apache.bcel.util.SyntheticRepository;
public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase {
-
+
protected void setUp() throws Exception {
super.setUp();
}
-
+
public void testSeeAnnotationsAsAttribute() throws ClassNotFoundException {
SyntheticRepository repos = createRepos("testcode.jar");
JavaClass clazz = repos.loadClass("SimpleAnnotatedClass");
@@ -49,7 +49,7 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase {
assertTrue("Expected a RuntimeVisibleAnnotations attribute but found none",
rvaAttr.length==1);
}
-
+
public void testAnnotationsAttributeContainsRightData() throws ClassNotFoundException {
SyntheticRepository repos = createRepos("testcode.jar");
JavaClass clazz = repos.loadClass("SimpleAnnotatedClass");
@@ -73,7 +73,7 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase {
assertTrue("'id' should have value 4 but it is "+evalue.getValueInt(),
evalue.getValueInt()==4);
}
-
+
public void testAccessingAnnotationsOnClazz() throws ClassNotFoundException {
SyntheticRepository repos = createRepos("testcode.jar");
JavaClass clazz = repos.loadClass("SimpleAnnotatedClass");
@@ -82,7 +82,7 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase {
assertTrue("Expected one annotation on SimpleAnnotatedClass class but got "+anns.length,
anns.length==1);
}
-
+
public void testReadingWritingAnnotations() throws ClassNotFoundException, IOException {
SyntheticRepository repos = createRepos("testcode.jar");
JavaClass clazz = repos.loadClass("SimpleAnnotatedClass");
@@ -90,45 +90,45 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase {
AnnotationGen[] anns = clazz.getAnnotations();
assertTrue("Expected one annotation on SimpleAnnotatedClass class but got "+anns.length,
anns.length==1);
-
+
// Write it out
File tfile = createTestdataFile("SimpleAnnotatedClass.class");
clazz.dump(tfile);
-
+
SyntheticRepository repos2 = createRepos(".");
JavaClass clazz2 = repos.loadClass("SimpleAnnotatedClass");
ConstantPool pool2 = clazz2.getConstantPool();
AnnotationGen[] anns2 = clazz2.getAnnotations();
assertTrue("Expected one annotation on SimpleAnnotatedClass class but got "+anns2.length,
anns2.length==1);
-
+
assertTrue(tfile.delete());
}
-
-
-
+
+
+
////
// Test for annotations containing string elements
-
+
public void testAnnotationStringElement() throws ClassNotFoundException {
SyntheticRepository repos = createRepos("testcode.jar");
JavaClass clazz = repos.loadClass("AnnotatedClass");
verifyAnnotationStringElement(clazz);
}
-
+
public void testAnnotationStringElementReadWrite() throws ClassNotFoundException, IOException {
SyntheticRepository repos = createRepos("testcode.jar");
JavaClass clazz = repos.loadClass("AnnotatedClass");
verifyAnnotationStringElement(clazz);
-
+
// Write it out
File tfile = createTestdataFile("AnnotatedClass.class");
clazz.dump(tfile);
-
+
SyntheticRepository repos2 = createRepos(".");
JavaClass clazz2 = repos2.loadClass("AnnotatedClass");
- verifyAnnotationStringElement(clazz2);
+ verifyAnnotationStringElement(clazz2);
assertTrue(tfile.delete());
}
@@ -148,16 +148,16 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase {
assertTrue("String value should be 'hello' but was '"+ev.getValueString()+"'",
ev.getValueString().equals("hello"));
}
-
+
////
// Test for complex annotation that includes all primitives
-
+
public void testComplexAnnotation() throws ClassNotFoundException {
SyntheticRepository repos = createRepos("testcode.jar");
JavaClass clazz = repos.loadClass("ComplexAnnotatedClass");
verifyComplexAnnotation(clazz);
}
-
+
public void testComplexAnnotationsReadWrite() throws ClassNotFoundException, IOException {
SyntheticRepository repos = createRepos("testcode.jar");
@@ -167,15 +167,15 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase {
// Write it out
File tfile = createTestdataFile("ComplexAnnotatedClass.class");
clazz.dump(tfile);
-
+
SyntheticRepository repos2 = createRepos(".");
JavaClass clazz2 = repos.loadClass("ComplexAnnotatedClass");
verifyComplexAnnotation(clazz2);
-
+
assertTrue(tfile.delete());
-
+
}
-
+
private void verifyComplexAnnotation(JavaClass clazz) {
AnnotationGen[] anns = clazz.getAnnotations();
assertTrue("Should be one annotation but found "+anns.length,anns.length==1);
@@ -194,7 +194,7 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase {
assertTrue("Cant find expected element ",names.contains("sval"));
assertTrue("Cant find expected element ",names.contains("bval"));
assertTrue("Cant find expected element ",names.contains("cval"));
-
+
checkValue(ann,"ival","4");
checkValue(ann,"jval","56");
checkValue(ann,"fval","3.0");
@@ -203,7 +203,7 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase {
checkValue(ann,"bval","2");
checkValue(ann,"cval", Character.toString('5'));
checkValue(ann,"zval","false");
-
+
}
private void checkValue(AnnotationGen a,String name,String tostring) {
@@ -220,13 +220,13 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase {
////
// Test an annotation containing a 'Class' element
-
+
public void testAnnotationClassElement() throws ClassNotFoundException {
SyntheticRepository repos = createRepos("testcode.jar");
JavaClass clazz = repos.loadClass("AnnotatedWithClassClass");
verifyClassAnnotation(clazz);
}
-
+
public void testAnnotationClassElementCopying() throws ClassNotFoundException {
SyntheticRepository repos = createRepos("testcode.jar");
JavaClass clazz = repos.loadClass("AnnotatedWithClassClass");
@@ -236,7 +236,7 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase {
new AnnotationGen(anns[0],cg.getConstantPool(),true);
new AnnotationGen(anns[0],cg.getConstantPool(),false);
}
-
+
public void testAnnotationClassElementReadWrite() throws ClassNotFoundException,IOException {
SyntheticRepository repos = createRepos("testcode.jar");
JavaClass clazz = repos.loadClass("AnnotatedWithClassClass");
@@ -245,14 +245,14 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase {
// Write it out
File tfile = createTestdataFile("AnnotatedWithClassClass.class");
clazz.dump(tfile);
-
+
SyntheticRepository repos2 = createRepos(".");
JavaClass clazz2 = repos2.loadClass("AnnotatedWithClassClass");
verifyClassAnnotation(clazz2);
-
+
assertTrue(wipe("AnnotatedWithClassClass.class"));
}
-
+
private void verifyClassAnnotation(JavaClass clazz) {
AnnotationGen[] anns = clazz.getAnnotations();
assertTrue("should be one annotation but found "+anns.length,anns.length==1);
@@ -267,18 +267,18 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase {
ClassElementValue ev = (ClassElementValue)nvp.getValue();
assertTrue("String value should be 'Ljava/lang/Integer;' but was '"+ev.getClassString()+"'",
ev.getClassString().equals("Ljava/lang/Integer;"));
-
+
}
-
+
////
// Test an annotation containing an enum element
-
+
public void testAnnotationEnumElement() throws ClassNotFoundException {
SyntheticRepository repos = createRepos("testcode.jar");
JavaClass clazz = repos.loadClass("AnnotatedWithEnumClass");
verifyAnnotationEnumElement(clazz);
}
-
+
public void testAnnotationEnumElementReadWrite() throws ClassNotFoundException, IOException {
SyntheticRepository repos = createRepos("testcode.jar");
JavaClass clazz = repos.loadClass("AnnotatedWithEnumClass");
@@ -287,14 +287,14 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase {
// Write it out
File tfile = createTestdataFile("AnnotatedWithEnumClass.class");
clazz.dump(tfile);
-
+
SyntheticRepository repos2 = createRepos(".");
JavaClass clazz2 = repos2.loadClass("AnnotatedWithEnumClass");
verifyAnnotationEnumElement(clazz2);
-
+
assertTrue(tfile.delete());
}
-
+
public void verifyAnnotationEnumElement(JavaClass clazz) {
AnnotationGen[] anns = clazz.getAnnotations();
assertTrue("should be one annotation but found "+anns.length,anns.length==1);
@@ -314,10 +314,10 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase {
assertTrue("String value should be 'Red' but was '"+eev.getEnumValueString()+"'",
eev.getEnumValueString().equals("Red"));
}
-
+
////
// Test an annotation with an array element
-
+
public void testAnnotationArraysOfAnnotations() throws ClassNotFoundException {
SyntheticRepository repos = createRepos("testcode.jar");
JavaClass clazz = repos.loadClass("AnnotatedWithCombinedAnnotation");
@@ -325,18 +325,18 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase {
assertTrue("should be one annotation but found "+anns.length,anns.length==1);
checkCombinedAnnotation(anns[0]);
}
-
+
public void testAnnotationArraysOfAnnotationsReadWrite() throws ClassNotFoundException, IOException {
SyntheticRepository repos = createRepos("testcode.jar");
JavaClass clazz = repos.loadClass("AnnotatedWithCombinedAnnotation");
AnnotationGen[] anns = clazz.getAnnotations();
assertTrue("should be one annotation but found "+anns.length,anns.length==1);
checkCombinedAnnotation(anns[0]);
-
+
// Write it out
File tfile = createTestdataFile("AnnotatedWithCombinedAnnotation.class");
clazz.dump(tfile);
-
+
SyntheticRepository repos2 = createRepos(".");
JavaClass clazz2 = repos2.loadClass("AnnotatedWithCombinedAnnotation");
AnnotationGen[] anns2 = clazz2.getAnnotations();
@@ -345,8 +345,8 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase {
assertTrue(tfile.delete());
}
-
-
+
+
private void checkCombinedAnnotation(AnnotationGen ann) {
assertTrue("should be called 'CombinedAnnotation' but was called "+ann.getTypeName(),
ann.getTypeName().equals("CombinedAnnotation"));
@@ -358,7 +358,7 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase {
ElementValue ev = nvp.getValue();
assertTrue("Should be of type ArrayElementValue but is "+ev,ev instanceof ArrayElementValue);
ArrayElementValue aev = (ArrayElementValue)ev;
-
+
assertTrue("Array element value should be of size 1 but is "+aev.getElementValuesArraySize(),
aev.getElementValuesArraySize()==1);
ElementValue[] evs = aev.getElementValuesArray();
@@ -374,7 +374,7 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase {
assertTrue("Value of 'id' should be 4 but it is "+envp.getValue().stringifyValue(),
envp.getValue().stringifyValue().equals("4"));
}
-
+
protected void tearDown() throws Exception {
super.tearDown();
@@ -388,5 +388,5 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase {
}
return names;
}
-
+
}
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/RuntimeVisibleParameterAnnotationAttributeTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/RuntimeVisibleParameterAnnotationAttributeTest.java
index be0b2fb30..3ccd41ba4 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/RuntimeVisibleParameterAnnotationAttributeTest.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/RuntimeVisibleParameterAnnotationAttributeTest.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2004 IBM
- * 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 implementation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Andy Clement - initial implementation
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.tests;
@@ -25,12 +25,12 @@ import org.aspectj.apache.bcel.util.SyntheticRepository;
public class RuntimeVisibleParameterAnnotationAttributeTest extends BcelTestCase {
-
+
protected void setUp() throws Exception {
super.setUp();
}
-
+
public void testAccessingRuntimeVisibleParameterAnnotations() throws ClassNotFoundException {
JavaClass clazz = getClassFromJar("AnnotatedParameters");
@@ -63,32 +63,32 @@ public class RuntimeVisibleParameterAnnotationAttributeTest extends BcelTestCase
}
}
}
-
+
public void testAccessingParameterAnnotationsThroughGetAnnotations() throws ClassNotFoundException {
JavaClass clazz = getClassFromJar("AnnotatedParameters");
Attribute[] rvaAttr = findAttribute("RuntimeVisibleParameterAnnotations",clazz);
-
+
checkFooMethod(clazz);
}
-
+
public void testParameterAnnotationsReadWrite() throws ClassNotFoundException,IOException {
JavaClass clazz = getClassFromJar("AnnotatedParameters");
-
+
checkFooMethod(clazz);
// Write it out
File tfile = createTestdataFile("AnnotatedParameters.class");
clazz.dump(tfile);
-
+
SyntheticRepository repos2 = createRepos(".");
JavaClass clazz2 = repos2.loadClass("AnnotatedParameters");
-
+
checkFooMethod(clazz);
assertTrue(tfile.delete());
}
-
-
+
+
public void checkFooMethod(JavaClass clazz) {
Method[] methods = clazz.getMethods();
@@ -105,7 +105,7 @@ public class RuntimeVisibleParameterAnnotationAttributeTest extends BcelTestCase
}
}
}
-
+
private void checkAnnotation(AnnotationGen a,String name,String elementname,String elementvalue) {
assertTrue("Expected annotation to have name "+name+" but it had name "+a.getTypeName(),
a.getTypeName().equals(name));
@@ -116,10 +116,10 @@ public class RuntimeVisibleParameterAnnotationAttributeTest extends BcelTestCase
assertTrue("Expected element value "+elementvalue+" but was "+envp.getValue().stringifyValue(),
elementvalue.equals(envp.getValue().stringifyValue()));
}
-
+
// helper methods
-
+
public void checkValue(AnnotationGen a,String name,String tostring) {
for (NameValuePair element : a.getValues()) {
if (element.getNameString().equals(name)) {
@@ -135,5 +135,5 @@ public class RuntimeVisibleParameterAnnotationAttributeTest extends BcelTestCase
protected void tearDown() throws Exception {
super.tearDown();
}
-
+
}
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/TypeAnnotationsTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/TypeAnnotationsTest.java
index be3e3d5ac..c63b4fb9b 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/TypeAnnotationsTest.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/TypeAnnotationsTest.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2013 VMware
- * 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 implementation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Andy Clement - initial implementation
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.tests;
@@ -21,11 +21,11 @@ import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisTypeAnnos;
import org.aspectj.apache.bcel.classfile.annotation.TypeAnnotationGen;
public class TypeAnnotationsTest extends BcelTestCase {
-
+
protected void setUp() throws Exception {
super.setUp();
}
-
+
public Attribute getAttribute(Attribute[] attrs, byte tag) {
for (Attribute attr: attrs) {
if (attr.getTag() == tag) {
@@ -34,7 +34,7 @@ public class TypeAnnotationsTest extends BcelTestCase {
}
return null;
}
-
+
public void testClassTypeParameter() throws Exception {
JavaClass jc = getClassFromJava8Jar("TypeAnnoOnClassTypeParameter");
RuntimeVisTypeAnnos rvta = (RuntimeVisTypeAnnos)getAttribute(jc.getAttributes(), Constants.ATTR_RUNTIME_VISIBLE_TYPE_ANNOTATIONS);
@@ -44,7 +44,7 @@ public class TypeAnnotationsTest extends BcelTestCase {
checkTypeAnnotationClassTypeParameter(tas[0],0,"@Anno");
checkTypeAnnotationClassTypeParameter(tas[1],1,"@Anno(value=2)");
}
-
+
public void testMethodTypeParameter() throws Exception {
JavaClass jc = getClassFromJava8Jar("TypeAnnoOnMethodTypeParameter");
Method m = getMethod(jc, "m");
@@ -54,7 +54,7 @@ public class TypeAnnotationsTest extends BcelTestCase {
assertEquals(1,tas.length);
checkTypeAnnotationMethodTypeParameter(tas[0],0,"@Anno");
}
-
+
public void testSuperinterface() throws Exception {
JavaClass jc = getClassFromJava8Jar("TypeAnnoOnSuperinterface1");
RuntimeVisTypeAnnos rvta = (RuntimeVisTypeAnnos)getAttribute(jc.getAttributes(), Constants.ATTR_RUNTIME_VISIBLE_TYPE_ANNOTATIONS);
@@ -64,7 +64,7 @@ public class TypeAnnotationsTest extends BcelTestCase {
TypeAnnotationGen ta = tas[0];
checkTypeAnnotationClassExtends(ta, 0, "@Anno");
}
-
+
public void testSupertypes() throws Exception {
JavaClass jc = getClassFromJava8Jar("TypeAnnoOnSupertypes");
RuntimeVisTypeAnnos rvta = (RuntimeVisTypeAnnos)getAttribute(jc.getAttributes(), Constants.ATTR_RUNTIME_VISIBLE_TYPE_ANNOTATIONS);
@@ -114,15 +114,15 @@ public class TypeAnnotationsTest extends BcelTestCase {
assertEquals(1,tas.length);
checkTypeAnnotationField(tas[0],"@Anno");
checkTypePath(tas[0],TypeAnnotationGen.NO_TYPE_PATH);
-
+
tas = getTypeAnnotations(getField(jc,"f2"),true);
checkTypeAnnotationField(tas[0],"@Anno");
checkTypePath(tas[0],new int[]{TypeAnnotationGen.TYPE_PATH_ENTRY_KIND_TYPE_ARGUMENT,0});
-
+
tas = getTypeAnnotations(getField(jc,"f3"),true);
checkTypeAnnotationField(tas[0],"@Anno");
checkTypePath(tas[0],new int[]{TypeAnnotationGen.TYPE_PATH_ENTRY_KIND_ARRAY,0});
-
+
tas = getTypeAnnotations(getField(jc,"f4"),true);
checkTypeAnnotationField(tas[0],"@Anno");
checkTypePath(tas[0],new int[]{
@@ -160,7 +160,7 @@ public class TypeAnnotationsTest extends BcelTestCase {
checkTypeAnnotationThrows(tas[1],1, "@Anno(value=2)");
checkTypePath(tas[1],TypeAnnotationGen.NO_TYPE_PATH);
}
-
+
public void testLocalVariable() throws Exception {
JavaClass jc = getClassFromJava8Jar("TypeAnnoOnLocalVariable");
// TODO I think the attribute should be on the code for the method, not the method
@@ -177,7 +177,7 @@ public class TypeAnnotationsTest extends BcelTestCase {
checkTypeAnnotationResourceVariable(tas[0],new int[]{17,204,1}, "@Anno");
checkTypeAnnotationResourceVariable(tas[1],new int[]{36,114,3}, "@Anno(value=99)");
}
-
+
public void testExceptionParameter() throws Exception {
JavaClass jc = getClassFromJava8Jar("TypeAnnoOnExceptionParameter");
// TODO I think the attribute should be on the code for the method, not the method
@@ -203,7 +203,7 @@ public class TypeAnnotationsTest extends BcelTestCase {
assertEquals(4,tas.length);
checkTypeAnnotationNew(tas[0],0, "@Anno");
checkTypePath(tas[0],TypeAnnotationGen.NO_TYPE_PATH);
-
+
// TODO type path bugs in javac b90 according to the spec
// checkTypeAnnotationNew(tas[1],8, "@Anno(value=2)");
// checkTypePath(tas[1],new int[]{
@@ -224,17 +224,17 @@ public class TypeAnnotationsTest extends BcelTestCase {
RuntimeTypeAnnos rvta = (RuntimeTypeAnnos)getAttribute(attrs, visible?Constants.ATTR_RUNTIME_VISIBLE_TYPE_ANNOTATIONS:Constants.ATTR_RUNTIME_INVISIBLE_TYPE_ANNOTATIONS);
return rvta.getTypeAnnotations();
}
-
+
private TypeAnnotationGen[] getTypeAnnotations(Method m, boolean visible) {
RuntimeTypeAnnos rvta = (RuntimeTypeAnnos)getAttribute(m.getAttributes(), visible?Constants.ATTR_RUNTIME_VISIBLE_TYPE_ANNOTATIONS:Constants.ATTR_RUNTIME_INVISIBLE_TYPE_ANNOTATIONS);
return rvta.getTypeAnnotations();
}
-
+
private TypeAnnotationGen[] getTypeAnnotations(Field f, boolean visible) {
RuntimeTypeAnnos rvta = (RuntimeTypeAnnos)getAttribute(f.getAttributes(), visible?Constants.ATTR_RUNTIME_VISIBLE_TYPE_ANNOTATIONS:Constants.ATTR_RUNTIME_INVISIBLE_TYPE_ANNOTATIONS);
return rvta.getTypeAnnotations();
}
-
+
private void checkTypePath(TypeAnnotationGen ta, int[] expectedTypePath) {
int[] typepath = ta.getTypePath();
if (expectedTypePath==TypeAnnotationGen.NO_TYPE_PATH || expectedTypePath==null) {
@@ -260,7 +260,7 @@ public class TypeAnnotationsTest extends BcelTestCase {
}
}
}
-
+
public static String toLocalVarTargetString(int[] localVarTarget) {
StringBuilder sb = new StringBuilder();
int count = 0;
@@ -327,18 +327,18 @@ public class TypeAnnotationsTest extends BcelTestCase {
assertEquals(expectedFormalParameterIndex,ta.getMethodFormalParameterIndex());
assertEquals(expectedAnnotationText,ta.getAnnotation().toShortString());
}
-
+
private void checkTypeAnnotationThrows(TypeAnnotationGen ta, int expectedThrowsTypeIndex, String expectedAnnotationText) {
assertEquals(TypeAnnotationGen.THROWS,ta.getTargetType());
assertEquals(expectedThrowsTypeIndex,ta.getThrowsTypeIndex());
assertEquals(expectedAnnotationText,ta.getAnnotation().toShortString());
}
-
+
private void checkTypeAnnotationMethodReceiver(TypeAnnotationGen ta, String expectedAnnotationText) {
assertEquals(TypeAnnotationGen.METHOD_RECEIVER,ta.getTargetType());
assertEquals(expectedAnnotationText,ta.getAnnotation().toShortString());
}
-
+
private void checkTypeAnnotationClassExtends(TypeAnnotationGen ta, int expectedSupertypeIndex, String expectedAnnotationText) {
assertEquals(TypeAnnotationGen.CLASS_EXTENDS,ta.getTargetType());
assertEquals(expectedSupertypeIndex,ta.getSupertypeIndex());
@@ -350,7 +350,7 @@ public class TypeAnnotationsTest extends BcelTestCase {
assertEquals(expectedTypeParameterIndex,ta.getTypeParameterIndex());
assertEquals(expectedAnnotationText,ta.getAnnotation().toShortString());
}
-
+
private void checkTypeAnnotationClassTypeParameterBound(TypeAnnotationGen ta, int expectedTypeParameterIndex, int expectedBoundIndex, String expectedAnnotationText) {
assertEquals(TypeAnnotationGen.CLASS_TYPE_PARAMETER_BOUND,ta.getTargetType());
assertEquals(expectedTypeParameterIndex,ta.getTypeParameterIndex());
@@ -370,5 +370,5 @@ public class TypeAnnotationsTest extends BcelTestCase {
assertEquals(expectedTypeParameterIndex,ta.getTypeParameterIndex());
assertEquals(expectedAnnotationText,ta.getAnnotation().toShortString());
}
-
+
}
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/UtilTests.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/UtilTests.java
index 750dbf4f1..f96efdaa3 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/UtilTests.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/UtilTests.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2004 IBM
- * 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 implementation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Andy Clement - initial implementation
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.tests;
@@ -19,31 +19,31 @@ import org.aspectj.apache.bcel.generic.Type;
import junit.framework.TestCase;
public class UtilTests extends TestCase {
-
+
protected void setUp() throws Exception {
super.setUp();
}
-
+
public void testUtilityClassSignatureManipulation1() {
String[] ss = UtilTests.methodSignatureArgumentTypes("(Ljava/lang/String;I[Ljava/lang/Integer;)");
assertTrue("should be 3 not "+ss.length,ss.length==3);
-
+
assertTrue("first should be 'String', not "+ss[0],ss[0].equals("String"));
assertTrue("second should be 'int', not "+ss[1],ss[1].equals("int"));
assertTrue("third should be 'Integer[]', not "+ss[2],ss[2].equals("Integer[]"));
}
-
+
public void testUtilityClassSignatureManipulation2() {
String s = Utility.methodSignatureToString("(Ljava/lang/String;[Z[[Ljava/lang/Integer;II)Z","hello","public");
String expected = "public boolean hello(String arg1, boolean[] arg2, Integer[][] arg3, int arg4, int arg5)";
assertTrue("Expected '"+expected+"' but got "+s,s.equals(expected));
}
-
+
public void testTypeUtilMethods1() {
String s = Utility.toMethodSignature(Type.DOUBLE,new Type[]{Type.INT,Type.STRING,Type.SHORT});
System.err.println(s);
}
-
+
public void testTypeUtilMethods2() {
Type s = Type.getType("Ljava/lang/String;");
System.err.println(s);
@@ -58,11 +58,11 @@ public class UtilTests extends TestCase {
/**
* @param signature Method signature
* @return Array of argument types
- * @throws ClassFormatException
+ * @throws ClassFormatException
*/
public static final String[] methodSignatureArgumentTypes(String signature) throws ClassFormatException {
return GenericSignatureParsingTest.methodSignatureArgumentTypes(signature, true);
}
-
+
}
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/VarargsTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/VarargsTest.java
index 23c46ac25..a497fd2e1 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/VarargsTest.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/VarargsTest.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2004 IBM
- * 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 implementation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v 2.0
+ * which accompanies this distribution and is available at
+ * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ *
+ * Contributors:
+ * Andy Clement - initial implementation
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.tests;
@@ -23,44 +23,44 @@ import org.aspectj.apache.bcel.util.SyntheticRepository;
public class VarargsTest extends BcelTestCase {
-
+
protected void setUp() throws Exception {
super.setUp();
}
-
-
+
+
public void testVarargs() throws ClassNotFoundException {
JavaClass clazz = getClassFromJar("VarargsClass");
-
+
checkMarkedVarargs(clazz,"foo",true);
checkMarkedVarargs(clazz,"goo",true);
checkMarkedVarargs(clazz,"hoo",false);
}
-
+
public void testVarargsReadWrite() throws ClassNotFoundException,IOException {
JavaClass clazz = getClassFromJar("VarargsClass");
-
+
checkMarkedVarargs(clazz,"foo",true);
checkMarkedVarargs(clazz,"goo",true);
checkMarkedVarargs(clazz,"hoo",false);
-
+
// Write it out
File tfile = createTestdataFile("VarargsClass.class");
clazz.dump(tfile);
-
+
SyntheticRepository repos2 = createRepos(".");
JavaClass clazz2 = repos2.loadClass("VarargsClass");
-
+
checkMarkedVarargs(clazz,"foo",true);
checkMarkedVarargs(clazz,"goo",true);
checkMarkedVarargs(clazz,"hoo",false);
assertTrue(tfile.delete());
}
-
+
// helper methods
-
+
public void checkMarkedVarargs(JavaClass clazz,String methodname,boolean shouldBeMarked) {
Method[] methods = clazz.getMethods();
@@ -71,10 +71,10 @@ public class VarargsTest extends BcelTestCase {
}
}
}
-
+
// helper methods
-
+
public void checkValue(AnnotationGen a,String name,String tostring) {
for (NameValuePair element : a.getValues()) {
if (element.getNameString().equals(name)) {
@@ -90,5 +90,5 @@ public class VarargsTest extends BcelTestCase {
protected void tearDown() throws Exception {
super.tearDown();
}
-
+
}