diff options
author | aclement <aclement> | 2009-09-15 19:40:22 +0000 |
---|---|---|
committer | aclement <aclement> | 2009-09-15 19:40:22 +0000 |
commit | a8aa0b1673518bea0f9ba63a43f511f35f5f145b (patch) | |
tree | 42248ab7aed4b1a76b7aa0e6a6c8df8e04fce644 /bcel-builder | |
parent | 7c89067090cc77b93ed9936919e9439b0aa336e2 (diff) | |
download | aspectj-a8aa0b1673518bea0f9ba63a43f511f35f5f145b.tar.gz aspectj-a8aa0b1673518bea0f9ba63a43f511f35f5f145b.zip |
refactoring
Diffstat (limited to 'bcel-builder')
15 files changed, 188 insertions, 187 deletions
diff --git a/bcel-builder/.isJava5 b/bcel-builder/.isJava5 new file mode 100644 index 000000000..136d06384 --- /dev/null +++ b/bcel-builder/.isJava5 @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/AnnotationDefaultAttributeTest.java b/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/AnnotationDefaultAttributeTest.java index 2a57bbaac..ced29d489 100644 --- a/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/AnnotationDefaultAttributeTest.java +++ b/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/AnnotationDefaultAttributeTest.java @@ -15,8 +15,8 @@ package org.aspectj.apache.bcel.classfile.tests; import org.aspectj.apache.bcel.classfile.AnnotationDefault; import org.aspectj.apache.bcel.classfile.JavaClass; import org.aspectj.apache.bcel.classfile.Method; -import org.aspectj.apache.bcel.classfile.annotation.ElementValueGen; -import org.aspectj.apache.bcel.classfile.annotation.SimpleElementValueGen; +import org.aspectj.apache.bcel.classfile.annotation.ElementValue; +import org.aspectj.apache.bcel.classfile.annotation.SimpleElementValue; public class AnnotationDefaultAttributeTest extends BcelTestCase { @@ -35,9 +35,9 @@ public class AnnotationDefaultAttributeTest extends BcelTestCase { Method m = getMethod(clazz,"fruit"); AnnotationDefault a = (AnnotationDefault) findAttribute("AnnotationDefault",m.getAttributes()); - SimpleElementValueGen val = (SimpleElementValueGen) a.getElementValue(); + SimpleElementValue val = (SimpleElementValue) a.getElementValue(); assertTrue("Should be STRING but is "+val.getElementValueType(), - val.getElementValueType()==ElementValueGen.STRING); + val.getElementValueType()==ElementValue.STRING); assertTrue("Should have default of bananas but default is "+val.getValueString(), val.getValueString().equals("bananas")); } diff --git a/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/AnnotationGenTest.java b/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/AnnotationGenTest.java index cb2ed6676..901aa2ee7 100644 --- a/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/AnnotationGenTest.java +++ b/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/AnnotationGenTest.java @@ -24,12 +24,12 @@ import org.aspectj.apache.bcel.classfile.Attribute; import org.aspectj.apache.bcel.classfile.ConstantPool; import org.aspectj.apache.bcel.classfile.Utility; import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen; -import org.aspectj.apache.bcel.classfile.annotation.ElementNameValuePairGen; -import org.aspectj.apache.bcel.classfile.annotation.ElementValueGen; -import org.aspectj.apache.bcel.classfile.annotation.RuntimeAnnotations; -import org.aspectj.apache.bcel.classfile.annotation.RuntimeInvisibleAnnotations; -import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisibleAnnotations; -import org.aspectj.apache.bcel.classfile.annotation.SimpleElementValueGen; +import org.aspectj.apache.bcel.classfile.annotation.NameValuePair; +import org.aspectj.apache.bcel.classfile.annotation.ElementValue; +import org.aspectj.apache.bcel.classfile.annotation.RuntimeAnnos; +import org.aspectj.apache.bcel.classfile.annotation.RuntimeInvisAnnos; +import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisAnnos; +import org.aspectj.apache.bcel.classfile.annotation.SimpleElementValue; import org.aspectj.apache.bcel.generic.ClassGen; import org.aspectj.apache.bcel.generic.ObjectType; @@ -54,17 +54,17 @@ public class AnnotationGenTest extends BcelTestCase { ConstantPool cp = cg.getConstantPool(); // Create the simple primitive value '4' of type 'int' - SimpleElementValueGen evg = new SimpleElementValueGen(ElementValueGen.PRIMITIVE_INT, cp, 4); + SimpleElementValue evg = new SimpleElementValue(ElementValue.PRIMITIVE_INT, cp, 4); // Give it a name, call it 'id' - ElementNameValuePairGen nvGen = new ElementNameValuePairGen("id", evg, cp); + NameValuePair nvGen = new NameValuePair("id", evg, cp); // Check it looks right assertTrue("Should include string 'id=4' but says: " + nvGen.toString(), nvGen.toString().indexOf("id=4") != -1); ObjectType t = new ObjectType("SimpleAnnotation"); - List<ElementNameValuePairGen> elements = new ArrayList<ElementNameValuePairGen>(); + List<NameValuePair> elements = new ArrayList<NameValuePair>(); elements.add(nvGen); // Build an annotation of type 'SimpleAnnotation' with 'id=4' as the only value :) @@ -81,17 +81,17 @@ public class AnnotationGenTest extends BcelTestCase { ConstantPool cp = cg.getConstantPool(); // Create the simple primitive value '4' of type 'int' - SimpleElementValueGen evg = new SimpleElementValueGen(ElementValueGen.PRIMITIVE_INT, cp, 4); + SimpleElementValue evg = new SimpleElementValue(ElementValue.PRIMITIVE_INT, cp, 4); // Give it a name, call it 'id' - ElementNameValuePairGen nvGen = new ElementNameValuePairGen("id", evg, cp); + NameValuePair nvGen = new NameValuePair("id", evg, cp); // Check it looks right assertTrue("Should include string 'id=4' but says: " + nvGen.toString(), nvGen.toString().indexOf("id=4") != -1); ObjectType t = new ObjectType("SimpleAnnotation"); - List<ElementNameValuePairGen> elements = new ArrayList<ElementNameValuePairGen>(); + List<NameValuePair> elements = new ArrayList<NameValuePair>(); elements.add(nvGen); // Build a RV annotation of type 'SimpleAnnotation' with 'id=4' as the only value :) @@ -99,11 +99,11 @@ public class AnnotationGenTest extends BcelTestCase { Vector<AnnotationGen> v = new Vector<AnnotationGen>(); v.add(a); - Collection<RuntimeAnnotations> attributes = Utility.getAnnotationAttributes(cp, v); + Collection<RuntimeAnnos> attributes = Utility.getAnnotationAttributes(cp, v); boolean foundRV = false; for (Attribute attribute : attributes) { - if (attribute instanceof RuntimeVisibleAnnotations) { - assertTrue(((RuntimeAnnotations) attribute).areVisible()); + if (attribute instanceof RuntimeVisAnnos) { + assertTrue(((RuntimeAnnos) attribute).areVisible()); foundRV = true; } @@ -115,13 +115,13 @@ public class AnnotationGenTest extends BcelTestCase { Vector<AnnotationGen> v2 = new Vector<AnnotationGen>(); v2.add(a2); - Collection<RuntimeAnnotations> attributes2 = Utility.getAnnotationAttributes(cp, v2); + Collection<RuntimeAnnos> attributes2 = Utility.getAnnotationAttributes(cp, v2); boolean foundRIV = false; for (Attribute attribute : attributes2) { // for (int i = 0; i < attributes2.length; i++) { // Attribute attribute = attributes2[i]; - if (attribute instanceof RuntimeInvisibleAnnotations) { - assertFalse(((RuntimeAnnotations) attribute).areVisible()); + if (attribute instanceof RuntimeInvisAnnos) { + assertFalse(((RuntimeAnnos) attribute).areVisible()); foundRIV = true; } } @@ -134,7 +134,7 @@ public class AnnotationGenTest extends BcelTestCase { private void checkSerialize(AnnotationGen a, ConstantPool cpg) { try { String beforeName = a.getTypeName(); - List<ElementNameValuePairGen> beforeValues = a.getValues(); + List<NameValuePair> beforeValues = a.getValues(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(baos); a.dump(dos); @@ -150,7 +150,7 @@ public class AnnotationGenTest extends BcelTestCase { dis.close(); String afterName = annAfter.getTypeName(); - List<ElementNameValuePairGen> afterValues = annAfter.getValues(); + List<NameValuePair> afterValues = annAfter.getValues(); if (!beforeName.equals(afterName)) { fail("Deserialization failed: before type='" + beforeName + "' after type='" + afterName + "'"); @@ -159,8 +159,8 @@ public class AnnotationGenTest extends BcelTestCase { fail("Different numbers of element name value pairs?? " + a.getValues().size() + "!=" + annAfter.getValues().size()); } for (int i = 0; i < a.getValues().size(); i++) { - ElementNameValuePairGen beforeElement = a.getValues().get(i); - ElementNameValuePairGen afterElement = annAfter.getValues().get(i); + NameValuePair beforeElement = a.getValues().get(i); + NameValuePair afterElement = annAfter.getValues().get(i); if (!beforeElement.getNameString().equals(afterElement.getNameString())) { fail("Different names?? " + beforeElement.getNameString() + "!=" + afterElement.getNameString()); } diff --git a/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/BcelTestCase.java b/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/BcelTestCase.java index a68691f1b..2689aae04 100644 --- a/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/BcelTestCase.java +++ b/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/BcelTestCase.java @@ -23,9 +23,9 @@ import org.aspectj.apache.bcel.classfile.ConstantPool; import org.aspectj.apache.bcel.classfile.JavaClass; import org.aspectj.apache.bcel.classfile.Method; import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen; -import org.aspectj.apache.bcel.classfile.annotation.ElementNameValuePairGen; -import org.aspectj.apache.bcel.classfile.annotation.ElementValueGen; -import org.aspectj.apache.bcel.classfile.annotation.SimpleElementValueGen; +import org.aspectj.apache.bcel.classfile.annotation.NameValuePair; +import org.aspectj.apache.bcel.classfile.annotation.ElementValue; +import org.aspectj.apache.bcel.classfile.annotation.SimpleElementValue; import org.aspectj.apache.bcel.generic.ObjectType; import org.aspectj.apache.bcel.util.ClassPath; import org.aspectj.apache.bcel.util.SyntheticRepository; @@ -141,10 +141,10 @@ public class BcelTestCase extends TestCase { } public AnnotationGen createFruitAnnotation(ConstantPool cp, String aFruit, boolean visibility) { - SimpleElementValueGen evg = new SimpleElementValueGen(ElementValueGen.STRING, cp, aFruit); - ElementNameValuePairGen nvGen = new ElementNameValuePairGen("fruit", evg, cp); + SimpleElementValue evg = new SimpleElementValue(ElementValue.STRING, cp, aFruit); + NameValuePair nvGen = new NameValuePair("fruit", evg, cp); ObjectType t = new ObjectType("SimpleStringAnnotation"); - List<ElementNameValuePairGen> elements = new ArrayList<ElementNameValuePairGen>(); + List<NameValuePair> elements = new ArrayList<NameValuePair>(); elements.add(nvGen); return new AnnotationGen(t, elements, visibility, cp); } diff --git a/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/ElementValueGenTest.java b/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/ElementValueGenTest.java index 8fc5207bd..0a9f415aa 100644 --- a/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/ElementValueGenTest.java +++ b/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/ElementValueGenTest.java @@ -18,10 +18,10 @@ import java.io.IOException; import org.aspectj.apache.bcel.Constants; import org.aspectj.apache.bcel.generic.ClassGen; import org.aspectj.apache.bcel.classfile.ConstantPool; -import org.aspectj.apache.bcel.classfile.annotation.ClassElementValueGen; -import org.aspectj.apache.bcel.classfile.annotation.ElementValueGen; -import org.aspectj.apache.bcel.classfile.annotation.EnumElementValueGen; -import org.aspectj.apache.bcel.classfile.annotation.SimpleElementValueGen; +import org.aspectj.apache.bcel.classfile.annotation.ClassElementValue; +import org.aspectj.apache.bcel.classfile.annotation.ElementValue; +import org.aspectj.apache.bcel.classfile.annotation.EnumElementValue; +import org.aspectj.apache.bcel.classfile.annotation.SimpleElementValue; import org.aspectj.apache.bcel.generic.ObjectType; public class ElementValueGenTest extends BcelTestCase { @@ -42,7 +42,7 @@ public class ElementValueGenTest extends BcelTestCase { ClassGen cg = createClassGen("HelloWorld"); ConstantPool cp = cg.getConstantPool(); - SimpleElementValueGen evg = new SimpleElementValueGen(ElementValueGen.PRIMITIVE_INT,cp,555); + SimpleElementValue evg = new SimpleElementValue(ElementValue.PRIMITIVE_INT,cp,555); // Creation of an element like that should leave a new entry in the cpool assertTrue("Should have the same index in the constantpool but "+evg.getIndex()+"!="+cp.lookupInteger(555), evg.getIndex()==cp.lookupInteger(555)); @@ -53,7 +53,7 @@ public class ElementValueGenTest extends BcelTestCase { ClassGen cg = createClassGen("HelloWorld"); ConstantPool cp = cg.getConstantPool(); - SimpleElementValueGen evg = new SimpleElementValueGen(ElementValueGen.PRIMITIVE_FLOAT,cp,111.222f); + SimpleElementValue evg = new SimpleElementValue(ElementValue.PRIMITIVE_FLOAT,cp,111.222f); // Creation of an element like that should leave a new entry in the cpool assertTrue("Should have the same index in the constantpool but "+evg.getIndex()+"!="+cp.lookupFloat(111.222f), evg.getIndex()==cp.lookupFloat(111.222f)); @@ -64,7 +64,7 @@ public class ElementValueGenTest extends BcelTestCase { ClassGen cg = createClassGen("HelloWorld"); ConstantPool cp = cg.getConstantPool(); - SimpleElementValueGen evg = new SimpleElementValueGen(ElementValueGen.PRIMITIVE_DOUBLE,cp,333.44); + SimpleElementValue evg = new SimpleElementValue(ElementValue.PRIMITIVE_DOUBLE,cp,333.44); // Creation of an element like that should leave a new entry in the cpool int idx = cp.lookupDouble(333.44); assertTrue("Should have the same index in the constantpool but "+evg.getIndex()+"!="+idx, @@ -76,7 +76,7 @@ public class ElementValueGenTest extends BcelTestCase { ClassGen cg = createClassGen("HelloWorld"); ConstantPool cp = cg.getConstantPool(); - SimpleElementValueGen evg = new SimpleElementValueGen(ElementValueGen.PRIMITIVE_LONG,cp,3334455L); + SimpleElementValue evg = new SimpleElementValue(ElementValue.PRIMITIVE_LONG,cp,3334455L); // Creation of an element like that should leave a new entry in the cpool int idx = cp.lookupLong(3334455L); assertTrue("Should have the same index in the constantpool but "+evg.getIndex()+"!="+idx, @@ -88,7 +88,7 @@ public class ElementValueGenTest extends BcelTestCase { ClassGen cg = createClassGen("HelloWorld"); ConstantPool cp = cg.getConstantPool(); - SimpleElementValueGen evg = new SimpleElementValueGen(ElementValueGen.PRIMITIVE_CHAR,cp,(char)'t'); + SimpleElementValue evg = new SimpleElementValue(ElementValue.PRIMITIVE_CHAR,cp,(char)'t'); // Creation of an element like that should leave a new entry in the cpool int idx = cp.lookupInteger((char)'t'); assertTrue("Should have the same index in the constantpool but "+evg.getIndex()+"!="+idx, @@ -100,7 +100,7 @@ public class ElementValueGenTest extends BcelTestCase { ClassGen cg = createClassGen("HelloWorld"); ConstantPool cp = cg.getConstantPool(); - SimpleElementValueGen evg = new SimpleElementValueGen(ElementValueGen.PRIMITIVE_CHAR,cp,(byte)'z'); + SimpleElementValue evg = new SimpleElementValue(ElementValue.PRIMITIVE_CHAR,cp,(byte)'z'); // Creation of an element like that should leave a new entry in the cpool int idx = cp.lookupInteger((byte)'z'); assertTrue("Should have the same index in the constantpool but "+evg.getIndex()+"!="+idx, @@ -112,7 +112,7 @@ public class ElementValueGenTest extends BcelTestCase { ClassGen cg = createClassGen("HelloWorld"); ConstantPool cp = cg.getConstantPool(); - SimpleElementValueGen evg = new SimpleElementValueGen(ElementValueGen.PRIMITIVE_BOOLEAN,cp,true); + SimpleElementValue evg = new SimpleElementValue(ElementValue.PRIMITIVE_BOOLEAN,cp,true); // Creation of an element like that should leave a new entry in the cpool int idx = cp.lookupInteger(1); // 1 == true assertTrue("Should have the same index in the constantpool but "+evg.getIndex()+"!="+idx, @@ -124,7 +124,7 @@ public class ElementValueGenTest extends BcelTestCase { ClassGen cg = createClassGen("HelloWorld"); ConstantPool cp = cg.getConstantPool(); - SimpleElementValueGen evg = new SimpleElementValueGen(ElementValueGen.PRIMITIVE_SHORT,cp,(short)42); + SimpleElementValue evg = new SimpleElementValue(ElementValue.PRIMITIVE_SHORT,cp,(short)42); // Creation of an element like that should leave a new entry in the cpool int idx = cp.lookupInteger(42); assertTrue("Should have the same index in the constantpool but "+evg.getIndex()+"!="+idx, @@ -141,7 +141,7 @@ public class ElementValueGenTest extends BcelTestCase { ClassGen cg = createClassGen("HelloWorld"); ConstantPool cp = cg.getConstantPool(); - SimpleElementValueGen evg = new SimpleElementValueGen(ElementValueGen.STRING,cp,"hello"); + SimpleElementValue evg = new SimpleElementValue(ElementValue.STRING,cp,"hello"); // Creation of an element like that should leave a new entry in the cpool assertTrue("Should have the same index in the constantpool but "+evg.getIndex()+"!="+cp.lookupUtf8("hello"), evg.getIndex()==cp.lookupUtf8("hello")); @@ -158,7 +158,7 @@ public class ElementValueGenTest extends BcelTestCase { ObjectType enumType = new ObjectType("SimpleEnum"); // Supports rainbow :) - EnumElementValueGen evg = new EnumElementValueGen(enumType,"Red",cp); + EnumElementValue evg = new EnumElementValue(enumType,"Red",cp); // Creation of an element like that should leave a new entry in the cpool assertTrue("The new ElementValue value index should match the contents of the constantpool but "+ evg.getValueIndex()+"!="+cp.lookupUtf8("Red"), @@ -180,7 +180,7 @@ public class ElementValueGenTest extends BcelTestCase { ObjectType classType = new ObjectType("java.lang.Integer"); - ClassElementValueGen evg = new ClassElementValueGen(classType,cp); + ClassElementValue evg = new ClassElementValue(classType,cp); assertTrue("Unexpected value for contained class: '"+evg.getClassString()+"'", evg.getClassString().indexOf("Integer")!=-1); @@ -192,7 +192,7 @@ public class ElementValueGenTest extends BcelTestCase { //// // Helper methods - private void checkSerialize(ElementValueGen evgBefore,ConstantPool cpg) { + private void checkSerialize(ElementValue evgBefore,ConstantPool cpg) { try { String beforeValue = evgBefore.stringifyValue(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -205,7 +205,7 @@ public class ElementValueGenTest extends BcelTestCase { ByteArrayInputStream bais = new ByteArrayInputStream(bs); DataInputStream dis = new DataInputStream(bais); - ElementValueGen evgAfter = ElementValueGen.readElementValue(dis,cpg); + ElementValue evgAfter = ElementValue.readElementValue(dis,cpg); dis.close(); String afterValue = evgAfter.stringifyValue(); diff --git a/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/FieldAnnotationsTest.java b/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/FieldAnnotationsTest.java index f9a179ed8..6f5a4f8f3 100644 --- a/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/FieldAnnotationsTest.java +++ b/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/FieldAnnotationsTest.java @@ -19,7 +19,7 @@ import java.util.Iterator; import org.aspectj.apache.bcel.classfile.Field; import org.aspectj.apache.bcel.classfile.JavaClass; import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen; -import org.aspectj.apache.bcel.classfile.annotation.ElementNameValuePairGen; +import org.aspectj.apache.bcel.classfile.annotation.NameValuePair; import org.aspectj.apache.bcel.generic.ClassGen; import org.aspectj.apache.bcel.generic.FieldGen; import org.aspectj.apache.bcel.util.SyntheticRepository; @@ -116,7 +116,7 @@ public class FieldAnnotationsTest extends BcelTestCase { assertTrue("Expected annotation to have name "+name+" but it had name "+a.getTypeName(), a.getTypeName().equals(name)); assertTrue("Expected annotation to have one element but it had "+a.getValues().size(),a.getValues().size()==1); - ElementNameValuePairGen envp = a.getValues().get(0); + NameValuePair envp = a.getValues().get(0); assertTrue("Expected element name "+elementname+" but was "+envp.getNameString(), elementname.equals(envp.getNameString())); assertTrue("Expected element value "+elementvalue+" but was "+envp.getValue().stringifyValue(), @@ -127,8 +127,8 @@ public class FieldAnnotationsTest extends BcelTestCase { // helper methods public void checkValue(AnnotationGen a,String name,String tostring) { - for (Iterator<ElementNameValuePairGen> i = a.getValues().iterator(); i.hasNext();) { - ElementNameValuePairGen element = i.next(); + for (Iterator<NameValuePair> i = a.getValues().iterator(); i.hasNext();) { + NameValuePair element = i.next(); if (element.getNameString().equals(name)) { if (!element.getValue().stringifyValue().equals(tostring)) { fail("Expected element "+name+" to have value "+tostring+" but it had value "+element.getValue().stringifyValue()); diff --git a/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/GeneratingAnnotatedClassesTest.java b/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/GeneratingAnnotatedClassesTest.java index 92769c6f2..94e40d491 100644 --- a/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/GeneratingAnnotatedClassesTest.java +++ b/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/GeneratingAnnotatedClassesTest.java @@ -18,12 +18,12 @@ import org.aspectj.apache.bcel.Constants; import org.aspectj.apache.bcel.classfile.ConstantPool; import org.aspectj.apache.bcel.classfile.JavaClass; import org.aspectj.apache.bcel.classfile.Method; -import org.aspectj.apache.bcel.classfile.annotation.AnnotationElementValueGen; +import org.aspectj.apache.bcel.classfile.annotation.AnnotationElementValue; import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen; -import org.aspectj.apache.bcel.classfile.annotation.ArrayElementValueGen; -import org.aspectj.apache.bcel.classfile.annotation.ElementNameValuePairGen; -import org.aspectj.apache.bcel.classfile.annotation.ElementValueGen; -import org.aspectj.apache.bcel.classfile.annotation.SimpleElementValueGen; +import org.aspectj.apache.bcel.classfile.annotation.ArrayElementValue; +import org.aspectj.apache.bcel.classfile.annotation.NameValuePair; +import org.aspectj.apache.bcel.classfile.annotation.ElementValue; +import org.aspectj.apache.bcel.classfile.annotation.SimpleElementValue; import org.aspectj.apache.bcel.generic.ArrayType; import org.aspectj.apache.bcel.generic.ClassGen; import org.aspectj.apache.bcel.generic.InstructionBranch; @@ -78,13 +78,13 @@ public class GeneratingAnnotatedClassesTest extends BcelTestCase { "SimpleAnnotation")); assertTrue("Name of annotation 2 should be SimpleAnnotation but it is " + as[1].getTypeName(), as[1].getTypeName().equals( "SimpleAnnotation")); - List<ElementNameValuePairGen> vals = as[0].getValues(); - ElementNameValuePairGen nvp = vals.get(0); + List<NameValuePair> vals = as[0].getValues(); + NameValuePair nvp = vals.get(0); assertTrue("Name of element in SimpleAnnotation should be 'id' but it is " + nvp.getNameString(), nvp.getNameString() .equals("id")); - ElementValueGen ev = nvp.getValue(); + ElementValue ev = nvp.getValue(); assertTrue("Type of element value should be int but it is " + ev.getElementValueType(), - ev.getElementValueType() == ElementValueGen.PRIMITIVE_INT); + ev.getElementValueType() == ElementValue.PRIMITIVE_INT); assertTrue("Value of element should be 4 but it is " + ev.stringifyValue(), ev.stringifyValue().equals("4")); assertTrue(createTestdataFile("HelloWorld.class").delete()); } @@ -214,16 +214,16 @@ public class GeneratingAnnotatedClassesTest extends BcelTestCase { assertTrue("Expected one annotation but found " + annotations.length, annotations.length == 1); AnnotationGen a = annotations[0]; assertTrue("That annotation should only have one value but has " + a.getValues().size(), a.getValues().size() == 1); - ElementNameValuePairGen nvp = a.getValues().get(0); - ElementValueGen value = nvp.getValue(); - assertTrue("Value should be ArrayElementValueGen but is " + value, value instanceof ArrayElementValueGen); - ArrayElementValueGen arrayValue = (ArrayElementValueGen) value; + NameValuePair nvp = a.getValues().get(0); + ElementValue value = nvp.getValue(); + assertTrue("Value should be ArrayElementValueGen but is " + value, value instanceof ArrayElementValue); + ArrayElementValue arrayValue = (ArrayElementValue) value; assertTrue("Array value should be size one but is " + arrayValue.getElementValuesArraySize(), arrayValue .getElementValuesArraySize() == 1); - ElementValueGen innerValue = arrayValue.getElementValuesArray()[0]; + ElementValue innerValue = arrayValue.getElementValuesArray()[0]; assertTrue("Value in the array should be AnnotationElementValueGen but is " + innerValue, - innerValue instanceof AnnotationElementValueGen); - AnnotationElementValueGen innerAnnotationValue = (AnnotationElementValueGen) innerValue; + innerValue instanceof AnnotationElementValue); + AnnotationElementValue innerAnnotationValue = (AnnotationElementValue) innerValue; assertTrue("Should be called LSimpleAnnotation; but is called: " + innerAnnotationValue.getAnnotation().getTypeName(), innerAnnotationValue.getAnnotation().getTypeSignature().equals("LSimpleAnnotation;")); } @@ -238,12 +238,12 @@ public class GeneratingAnnotatedClassesTest extends BcelTestCase { // Check annotations are correctly preserved AnnotationGen[] annotations = cgen.getAnnotations(); assertTrue("Expected one annotation but found " + annotations.length, annotations.length == 1); - List<ElementNameValuePairGen> l = annotations[0].getValues(); + List<NameValuePair> l = annotations[0].getValues(); boolean found = false; - for (Iterator<ElementNameValuePairGen> iter = l.iterator(); iter.hasNext();) { - ElementNameValuePairGen element = iter.next(); + for (Iterator<NameValuePair> iter = l.iterator(); iter.hasNext();) { + NameValuePair element = iter.next(); if (element.getNameString().equals("dval")) { - if (((SimpleElementValueGen) element.getValue()).stringifyValue().equals("33.4")) + if (((SimpleElementValue) element.getValue()).stringifyValue().equals("33.4")) found = true; } } @@ -518,13 +518,13 @@ public class GeneratingAnnotatedClassesTest extends BcelTestCase { } public AnnotationGen createSimpleVisibleAnnotation(ConstantPool cp) { - SimpleElementValueGen evg = new SimpleElementValueGen(ElementValueGen.PRIMITIVE_INT, cp, 4); + SimpleElementValue evg = new SimpleElementValue(ElementValue.PRIMITIVE_INT, cp, 4); - ElementNameValuePairGen nvGen = new ElementNameValuePairGen("id", evg, cp); + NameValuePair nvGen = new NameValuePair("id", evg, cp); ObjectType t = new ObjectType("SimpleAnnotation"); - List<ElementNameValuePairGen> elements = new ArrayList<ElementNameValuePairGen>(); + List<NameValuePair> elements = new ArrayList<NameValuePair>(); elements.add(nvGen); AnnotationGen a = new AnnotationGen(t, elements, true, cp); @@ -532,10 +532,10 @@ public class GeneratingAnnotatedClassesTest extends BcelTestCase { } public AnnotationGen createFruitAnnotation(ConstantPool cp, String aFruit) { - SimpleElementValueGen evg = new SimpleElementValueGen(ElementValueGen.STRING, cp, aFruit); - ElementNameValuePairGen nvGen = new ElementNameValuePairGen("fruit", evg, cp); + SimpleElementValue evg = new SimpleElementValue(ElementValue.STRING, cp, aFruit); + NameValuePair nvGen = new NameValuePair("fruit", evg, cp); ObjectType t = new ObjectType("SimpleStringAnnotation"); - List<ElementNameValuePairGen> elements = new ArrayList<ElementNameValuePairGen>(); + List<NameValuePair> elements = new ArrayList<NameValuePair>(); elements.add(nvGen); return new AnnotationGen(t, elements, true, cp); } @@ -543,22 +543,22 @@ public class GeneratingAnnotatedClassesTest extends BcelTestCase { public AnnotationGen createCombinedAnnotation(ConstantPool cp) { // Create an annotation instance AnnotationGen a = createSimpleVisibleAnnotation(cp); - ArrayElementValueGen array = new ArrayElementValueGen(cp); - array.addElement(new AnnotationElementValueGen(a, cp)); - ElementNameValuePairGen nvp = new ElementNameValuePairGen("value", array, cp); - List<ElementNameValuePairGen> elements = new ArrayList<ElementNameValuePairGen>(); + ArrayElementValue array = new ArrayElementValue(cp); + array.addElement(new AnnotationElementValue(a, cp)); + NameValuePair nvp = new NameValuePair("value", array, cp); + List<NameValuePair> elements = new ArrayList<NameValuePair>(); elements.add(nvp); return new AnnotationGen(new ObjectType("CombinedAnnotation"), elements, true, cp); } public AnnotationGen createSimpleInvisibleAnnotation(ConstantPool cp) { - SimpleElementValueGen evg = new SimpleElementValueGen(ElementValueGen.PRIMITIVE_INT, cp, 4); + SimpleElementValue evg = new SimpleElementValue(ElementValue.PRIMITIVE_INT, cp, 4); - ElementNameValuePairGen nvGen = new ElementNameValuePairGen("id", evg, cp); + NameValuePair nvGen = new NameValuePair("id", evg, cp); ObjectType t = new ObjectType("SimpleAnnotation"); - List<ElementNameValuePairGen> elements = new ArrayList<ElementNameValuePairGen>(); + List<NameValuePair> elements = new ArrayList<NameValuePair>(); elements.add(nvGen); AnnotationGen a = new AnnotationGen(t, elements, false, cp); diff --git a/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/MethodAnnotationsTest.java b/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/MethodAnnotationsTest.java index 2e813e9f2..14d009cf0 100644 --- a/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/MethodAnnotationsTest.java +++ b/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/MethodAnnotationsTest.java @@ -19,7 +19,7 @@ import java.util.Iterator; import org.aspectj.apache.bcel.classfile.JavaClass; import org.aspectj.apache.bcel.classfile.Method; import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen; -import org.aspectj.apache.bcel.classfile.annotation.ElementNameValuePairGen; +import org.aspectj.apache.bcel.classfile.annotation.NameValuePair; import org.aspectj.apache.bcel.util.SyntheticRepository; @@ -77,7 +77,7 @@ public class MethodAnnotationsTest extends BcelTestCase { assertTrue("Expected annotation to have name "+name+" but it had name "+a.getTypeName(), a.getTypeName().equals(name)); assertTrue("Expected annotation to have one element but it had "+a.getValues().size(),a.getValues().size()==1); - ElementNameValuePairGen envp = a.getValues().get(0); + NameValuePair envp = a.getValues().get(0); assertTrue("Expected element name "+elementname+" but was "+envp.getNameString(), elementname.equals(envp.getNameString())); assertTrue("Expected element value "+elementvalue+" but was "+envp.getValue().stringifyValue(), @@ -88,8 +88,8 @@ public class MethodAnnotationsTest extends BcelTestCase { // helper methods public void checkValue(AnnotationGen a,String name,String tostring) { - for (Iterator<ElementNameValuePairGen> i = a.getValues().iterator(); i.hasNext();) { - ElementNameValuePairGen element = i.next(); + for (Iterator<NameValuePair> i = a.getValues().iterator(); i.hasNext();) { + NameValuePair element = i.next(); if (element.getNameString().equals(name)) { if (!element.getValue().stringifyValue().equals(tostring)) { fail("Expected element "+name+" to have value "+tostring+" but it had value "+element.getValue().stringifyValue()); diff --git a/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/ParameterAnnotationsTest.java b/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/ParameterAnnotationsTest.java index ea2f96a3e..7dd83ddb7 100644 --- a/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/ParameterAnnotationsTest.java +++ b/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/ParameterAnnotationsTest.java @@ -18,12 +18,12 @@ import org.aspectj.apache.bcel.classfile.Attribute; import org.aspectj.apache.bcel.classfile.ConstantPool; import org.aspectj.apache.bcel.classfile.JavaClass; import org.aspectj.apache.bcel.classfile.Method; -import org.aspectj.apache.bcel.classfile.annotation.AnnotationElementValueGen; +import org.aspectj.apache.bcel.classfile.annotation.AnnotationElementValue; import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen; -import org.aspectj.apache.bcel.classfile.annotation.ArrayElementValueGen; -import org.aspectj.apache.bcel.classfile.annotation.ElementNameValuePairGen; -import org.aspectj.apache.bcel.classfile.annotation.ElementValueGen; -import org.aspectj.apache.bcel.classfile.annotation.SimpleElementValueGen; +import org.aspectj.apache.bcel.classfile.annotation.ArrayElementValue; +import org.aspectj.apache.bcel.classfile.annotation.NameValuePair; +import org.aspectj.apache.bcel.classfile.annotation.ElementValue; +import org.aspectj.apache.bcel.classfile.annotation.SimpleElementValue; import org.aspectj.apache.bcel.generic.ArrayType; import org.aspectj.apache.bcel.generic.ClassGen; import org.aspectj.apache.bcel.generic.InstructionBranch; @@ -544,14 +544,14 @@ public class ParameterAnnotationsTest extends BcelTestCase { public AnnotationGen createSimpleVisibleAnnotation(ConstantPool cp) { - SimpleElementValueGen evg = new SimpleElementValueGen( - ElementValueGen.PRIMITIVE_INT, cp, 4); + SimpleElementValue evg = new SimpleElementValue( + ElementValue.PRIMITIVE_INT, cp, 4); - ElementNameValuePairGen nvGen = new ElementNameValuePairGen("id", evg,cp); + NameValuePair nvGen = new NameValuePair("id", evg,cp); ObjectType t = new ObjectType("SimpleAnnotation"); - List<ElementNameValuePairGen> elements = new ArrayList<ElementNameValuePairGen>(); + List<NameValuePair> elements = new ArrayList<NameValuePair>(); elements.add(nvGen); AnnotationGen a = new AnnotationGen(t, elements,true, cp); @@ -561,23 +561,23 @@ public class ParameterAnnotationsTest extends BcelTestCase { public AnnotationGen createCombinedAnnotation(ConstantPool cp) { // Create an annotation instance AnnotationGen a = createSimpleVisibleAnnotation(cp); - ArrayElementValueGen array = new ArrayElementValueGen(cp); - array.addElement(new AnnotationElementValueGen(a,cp)); - ElementNameValuePairGen nvp = new ElementNameValuePairGen("value",array,cp); - List<ElementNameValuePairGen> elements = new ArrayList<ElementNameValuePairGen>(); + ArrayElementValue array = new ArrayElementValue(cp); + array.addElement(new AnnotationElementValue(a,cp)); + NameValuePair nvp = new NameValuePair("value",array,cp); + List<NameValuePair> elements = new ArrayList<NameValuePair>(); elements.add(nvp); return new AnnotationGen(new ObjectType("CombinedAnnotation"),elements,true,cp); } public AnnotationGen createSimpleInvisibleAnnotation(ConstantPool cp) { - SimpleElementValueGen evg = new SimpleElementValueGen( - ElementValueGen.PRIMITIVE_INT, cp, 4); + SimpleElementValue evg = new SimpleElementValue( + ElementValue.PRIMITIVE_INT, cp, 4); - ElementNameValuePairGen nvGen = new ElementNameValuePairGen("id", evg,cp); + NameValuePair nvGen = new NameValuePair("id", evg,cp); ObjectType t = new ObjectType("SimpleAnnotation"); - List<ElementNameValuePairGen> elements = new ArrayList<ElementNameValuePairGen>(); + List<NameValuePair> elements = new ArrayList<NameValuePair>(); elements.add(nvGen); AnnotationGen a = new AnnotationGen(t, elements,false, cp); diff --git a/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/RuntimeVisibleAnnotationAttributeTest.java b/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/RuntimeVisibleAnnotationAttributeTest.java index 76ff0d54a..0f82b2059 100644 --- a/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/RuntimeVisibleAnnotationAttributeTest.java +++ b/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/RuntimeVisibleAnnotationAttributeTest.java @@ -22,15 +22,15 @@ import org.aspectj.apache.bcel.classfile.Attribute; import org.aspectj.apache.bcel.classfile.ConstantPool; import org.aspectj.apache.bcel.classfile.JavaClass; import org.aspectj.apache.bcel.classfile.Utility; -import org.aspectj.apache.bcel.classfile.annotation.AnnotationElementValueGen; +import org.aspectj.apache.bcel.classfile.annotation.AnnotationElementValue; import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen; -import org.aspectj.apache.bcel.classfile.annotation.ArrayElementValueGen; -import org.aspectj.apache.bcel.classfile.annotation.ClassElementValueGen; -import org.aspectj.apache.bcel.classfile.annotation.ElementNameValuePairGen; -import org.aspectj.apache.bcel.classfile.annotation.ElementValueGen; -import org.aspectj.apache.bcel.classfile.annotation.EnumElementValueGen; -import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisibleAnnotations; -import org.aspectj.apache.bcel.classfile.annotation.SimpleElementValueGen; +import org.aspectj.apache.bcel.classfile.annotation.ArrayElementValue; +import org.aspectj.apache.bcel.classfile.annotation.ClassElementValue; +import org.aspectj.apache.bcel.classfile.annotation.NameValuePair; +import org.aspectj.apache.bcel.classfile.annotation.ElementValue; +import org.aspectj.apache.bcel.classfile.annotation.EnumElementValue; +import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisAnnos; +import org.aspectj.apache.bcel.classfile.annotation.SimpleElementValue; import org.aspectj.apache.bcel.generic.ClassGen; import org.aspectj.apache.bcel.util.SyntheticRepository; @@ -56,21 +56,21 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase { JavaClass clazz = repos.loadClass("SimpleAnnotatedClass"); ConstantPool pool = clazz.getConstantPool(); Attribute[] rvaAttr = findAttribute("RuntimeVisibleAnnotations",clazz); - RuntimeVisibleAnnotations rva = (RuntimeVisibleAnnotations) rvaAttr[0]; + RuntimeVisAnnos rva = (RuntimeVisAnnos) rvaAttr[0]; List<AnnotationGen> anns = rva.getAnnotations(); assertTrue("Should be one annotation but found "+anns.size(), anns.size()==1); AnnotationGen ann = anns.get(0); assertTrue("Should be called 'SimpleAnnotation' but was called "+ann.getTypeName(), ann.getTypeName().equals("SimpleAnnotation")); - List<ElementNameValuePairGen> l = ann.getValues(); + List<NameValuePair> l = ann.getValues(); assertTrue("Should be one value for annotation 'SimpleAnnotation' but found "+l.size(), l.size()==1); - ElementNameValuePairGen envp = l.get(0); + NameValuePair envp = l.get(0); assertTrue("Name of element in SimpleAnnotation should be 'id' but it is "+envp.getNameString(), envp.getNameString().equals("id")); - SimpleElementValueGen evalue = (SimpleElementValueGen)envp.getValue(); - assertTrue("'id' should be of type int, but it is "+evalue.getElementValueType(),evalue.getElementValueType()==SimpleElementValueGen.PRIMITIVE_INT); + SimpleElementValue evalue = (SimpleElementValue)envp.getValue(); + assertTrue("'id' should be of type int, but it is "+evalue.getElementValueType(),evalue.getElementValueType()==SimpleElementValue.PRIMITIVE_INT); assertTrue("'id' should have value 4 but it is "+evalue.getValueInt(), evalue.getValueInt()==4); } @@ -140,12 +140,12 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase { AnnotationGen ann = anns[0]; assertTrue("should be called 'AnnotationStringElement' but was called "+ann.getTypeName(), ann.getTypeName().equals("AnnotationStringElement")); - List<ElementNameValuePairGen> l = ann.getValues(); + List<NameValuePair> l = ann.getValues(); assertTrue("Should be one value but there were "+l.size(),l.size()==1); - ElementNameValuePairGen nvp = l.get(0); + NameValuePair nvp = l.get(0); assertTrue("Name of element should be 'stringval' but was "+nvp.getNameString(), nvp.getNameString().equals("stringval")); - SimpleElementValueGen ev = (SimpleElementValueGen)nvp.getValue(); + SimpleElementValue ev = (SimpleElementValue)nvp.getValue(); assertTrue("String value should be 'hello' but was '"+ev.getValueString()+"'", ev.getValueString().equals("hello")); } @@ -183,7 +183,7 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase { AnnotationGen ann = anns[0]; assertTrue("Should be called 'ComplexAnnotation' but was called "+ann.getTypeName(), ann.getTypeName().equals("ComplexAnnotation")); - List<ElementNameValuePairGen> l = ann.getValues(); + List<NameValuePair> l = ann.getValues(); assertTrue("Should be eight values for annotation 'ComplexAnnotation' but found "+l.size(), l.size()==8); List<String> names = RuntimeVisibleAnnotationAttributeTest.getListOfAnnotationNames(ann); @@ -208,8 +208,8 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase { } private void checkValue(AnnotationGen a,String name,String tostring) { - for (Iterator<ElementNameValuePairGen> i = a.getValues().iterator(); i.hasNext();) { - ElementNameValuePairGen element = i.next(); + for (Iterator<NameValuePair> i = a.getValues().iterator(); i.hasNext();) { + NameValuePair element = i.next(); if (element.getNameString().equals(name)) { if (!element.getValue().stringifyValue().equals(tostring)) { fail("Expected element "+name+" to have value "+tostring+" but it had value "+element.getValue().stringifyValue()); @@ -261,12 +261,12 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase { AnnotationGen ann = anns[0]; assertTrue("should be called 'AnnotationClassElement' but was called "+ann.getTypeName(), ann.getTypeName().equals("AnnotationClassElement")); - List<ElementNameValuePairGen> l = ann.getValues(); + List<NameValuePair> l = ann.getValues(); assertTrue("Should be one value but there were "+l.size(),l.size()==1); - ElementNameValuePairGen nvp = l.get(0); + NameValuePair nvp = l.get(0); assertTrue("Name of element should be 'clz' but was "+nvp.getNameString(), nvp.getNameString().equals("clz")); - ClassElementValueGen ev = (ClassElementValueGen)nvp.getValue(); + ClassElementValue ev = (ClassElementValue)nvp.getValue(); assertTrue("String value should be 'Ljava/lang/Integer;' but was '"+ev.getClassString()+"'", ev.getClassString().equals("Ljava/lang/Integer;")); @@ -303,15 +303,15 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase { AnnotationGen ann = anns[0]; assertTrue("should be called 'AnnotationEnumElement' but was called "+ann.getTypeName(), ann.getTypeName().equals("AnnotationEnumElement")); - List<ElementNameValuePairGen> l = ann.getValues(); + List<NameValuePair> l = ann.getValues(); assertTrue("Should be one value but there were "+l.size(),l.size()==1); - ElementNameValuePairGen nvp = l.get(0); + NameValuePair nvp = l.get(0); assertTrue("Name of element should be 'enumval' but was "+nvp.getNameString(), nvp.getNameString().equals("enumval")); - ElementValueGen ev = nvp.getValue(); - assertTrue("Should be of type EnumElementValue but is "+ev,ev instanceof EnumElementValueGen); - EnumElementValueGen eev = (EnumElementValueGen)ev; - assertTrue("Should be an enum type value but is "+eev.getElementValueType(),eev.getElementValueType()==SimpleElementValueGen.ENUM_CONSTANT); + ElementValue ev = nvp.getValue(); + assertTrue("Should be of type EnumElementValue but is "+ev,ev instanceof EnumElementValue); + EnumElementValue eev = (EnumElementValue)ev; + assertTrue("Should be an enum type value but is "+eev.getElementValueType(),eev.getElementValueType()==SimpleElementValue.ENUM_CONSTANT); assertTrue("Enum type for annotation should be 'SimpleEnum' but is "+Utility.signatureToString(eev.getEnumTypeString()),Utility.signatureToString(eev.getEnumTypeString()).equals("SimpleEnum")); assertTrue("String value should be 'Red' but was '"+eev.getEnumValueString()+"'", eev.getEnumValueString().equals("Red")); @@ -352,26 +352,26 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase { private void checkCombinedAnnotation(AnnotationGen ann) { assertTrue("should be called 'CombinedAnnotation' but was called "+ann.getTypeName(), ann.getTypeName().equals("CombinedAnnotation")); - List<ElementNameValuePairGen> l = ann.getValues(); + List<NameValuePair> l = ann.getValues(); assertTrue("Should be one value but there were "+l.size(),l.size()==1); - ElementNameValuePairGen nvp = l.get(0); + NameValuePair nvp = l.get(0); assertTrue("Name of element should be 'value' but was "+nvp.getNameString(), nvp.getNameString().equals("value")); - ElementValueGen ev = nvp.getValue(); - assertTrue("Should be of type ArrayElementValue but is "+ev,ev instanceof ArrayElementValueGen); - ArrayElementValueGen aev = (ArrayElementValueGen)ev; + 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); - ElementValueGen[] evs = aev.getElementValuesArray(); + ElementValue[] evs = aev.getElementValuesArray(); assertTrue("Entry in the array should be AnnotationElementValue but is "+evs[0], - evs[0] instanceof AnnotationElementValueGen); - AnnotationElementValueGen inner_ev = (AnnotationElementValueGen)evs[0]; + evs[0] instanceof AnnotationElementValue); + AnnotationElementValue inner_ev = (AnnotationElementValue)evs[0]; AnnotationGen a = inner_ev.getAnnotation(); assertTrue("Should be SimpleAnnotation but is "+a.getTypeName(),a.getTypeName().equals("SimpleAnnotation")); - List<ElementNameValuePairGen> envps = a.getValues(); + List<NameValuePair> envps = a.getValues(); assertTrue("Should be one name value pair but found "+envps.size(),envps.size()==1); - ElementNameValuePairGen envp = envps.get(0); + NameValuePair envp = envps.get(0); assertTrue("Name should be 'id' but it is "+envp.getNameString(),envp.getNameString().equals("id")); assertTrue("Value of 'id' should be 4 but it is "+envp.getValue().stringifyValue(), envp.getValue().stringifyValue().equals("4")); @@ -383,10 +383,10 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase { } public static List<String> getListOfAnnotationNames(AnnotationGen a) { - List<ElementNameValuePairGen> l = a.getValues(); + List<NameValuePair> l = a.getValues(); List<String> names = new ArrayList<String>(); - for (Iterator<ElementNameValuePairGen> i = l.iterator(); i.hasNext();) { - ElementNameValuePairGen element = i.next(); + for (Iterator<NameValuePair> i = l.iterator(); i.hasNext();) { + NameValuePair element = i.next(); names.add(element.getNameString()); } return names; diff --git a/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/RuntimeVisibleParameterAnnotationAttributeTest.java b/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/RuntimeVisibleParameterAnnotationAttributeTest.java index 0d269e900..1b8af7419 100644 --- a/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/RuntimeVisibleParameterAnnotationAttributeTest.java +++ b/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/RuntimeVisibleParameterAnnotationAttributeTest.java @@ -20,8 +20,8 @@ import org.aspectj.apache.bcel.classfile.Attribute; import org.aspectj.apache.bcel.classfile.JavaClass; import org.aspectj.apache.bcel.classfile.Method; import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen; -import org.aspectj.apache.bcel.classfile.annotation.ElementNameValuePairGen; -import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisibleParameterAnnotations; +import org.aspectj.apache.bcel.classfile.annotation.NameValuePair; +import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisParamAnnos; import org.aspectj.apache.bcel.util.SyntheticRepository; @@ -41,8 +41,8 @@ public class RuntimeVisibleParameterAnnotationAttributeTest extends BcelTestCase for (int i = 0; i < methods.length; i++) { Method m = methods[i]; if (m.getName().equals("foo")) { - RuntimeVisibleParameterAnnotations paramAnns = - (RuntimeVisibleParameterAnnotations) findAttribute("RuntimeVisibleParameterAnnotations",m.getAttributes()); + RuntimeVisParamAnnos paramAnns = + (RuntimeVisParamAnnos) findAttribute("RuntimeVisibleParameterAnnotations",m.getAttributes()); assertTrue("foo takes two parameters, not "+paramAnns.getParameterAnnotations().size(), paramAnns.getParameterAnnotations().size()==2); @@ -55,8 +55,8 @@ public class RuntimeVisibleParameterAnnotationAttributeTest extends BcelTestCase } if (m.getName().equals("main")) { - RuntimeVisibleParameterAnnotations paramAnns = - (RuntimeVisibleParameterAnnotations) findAttribute("RuntimeVisibleParameterAnnotations",m.getAttributes()); + RuntimeVisParamAnnos paramAnns = + (RuntimeVisParamAnnos) findAttribute("RuntimeVisibleParameterAnnotations",m.getAttributes()); assertTrue("main takes one parameter, not "+paramAnns.getParameterAnnotations().size(), paramAnns.getParameterAnnotations().size()==1); @@ -113,7 +113,7 @@ public class RuntimeVisibleParameterAnnotationAttributeTest extends BcelTestCase assertTrue("Expected annotation to have name "+name+" but it had name "+a.getTypeName(), a.getTypeName().equals(name)); assertTrue("Expected annotation to have one element but it had "+a.getValues().size(),a.getValues().size()==1); - ElementNameValuePairGen envp = a.getValues().get(0); + NameValuePair envp = a.getValues().get(0); assertTrue("Expected element name "+elementname+" but was "+envp.getNameString(), elementname.equals(envp.getNameString())); assertTrue("Expected element value "+elementvalue+" but was "+envp.getValue().stringifyValue(), @@ -124,8 +124,8 @@ public class RuntimeVisibleParameterAnnotationAttributeTest extends BcelTestCase // helper methods public void checkValue(AnnotationGen a,String name,String tostring) { - for (Iterator<ElementNameValuePairGen> i = a.getValues().iterator(); i.hasNext();) { - ElementNameValuePairGen element = i.next(); + for (Iterator<NameValuePair> i = a.getValues().iterator(); i.hasNext();) { + NameValuePair element = i.next(); if (element.getNameString().equals(name)) { if (!element.getValue().stringifyValue().equals(tostring)) { fail("Expected element "+name+" to have value "+tostring+" but it had value "+element.getValue().stringifyValue()); diff --git a/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/VarargsTest.java b/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/VarargsTest.java index 770ac426a..877594728 100644 --- a/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/VarargsTest.java +++ b/bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/VarargsTest.java @@ -19,7 +19,7 @@ import java.util.Iterator; import org.aspectj.apache.bcel.classfile.JavaClass; import org.aspectj.apache.bcel.classfile.Method; import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen; -import org.aspectj.apache.bcel.classfile.annotation.ElementNameValuePairGen; +import org.aspectj.apache.bcel.classfile.annotation.NameValuePair; import org.aspectj.apache.bcel.util.SyntheticRepository; @@ -78,8 +78,8 @@ public class VarargsTest extends BcelTestCase { // helper methods public void checkValue(AnnotationGen a,String name,String tostring) { - for (Iterator<ElementNameValuePairGen> i = a.getValues().iterator(); i.hasNext();) { - ElementNameValuePairGen element = i.next(); + for (Iterator<NameValuePair> i = a.getValues().iterator(); i.hasNext();) { + NameValuePair element = i.next(); if (element.getNameString().equals(name)) { if (!element.getValue().stringifyValue().equals(tostring)) { fail("Expected element "+name+" to have value "+tostring+" but it had value "+element.getValue().stringifyValue()); diff --git a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/DescendingVisitor.java b/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/DescendingVisitor.java index 3130e6667..3c8483120 100644 --- a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/DescendingVisitor.java +++ b/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/DescendingVisitor.java @@ -94,10 +94,10 @@ import org.aspectj.apache.bcel.classfile.StackMapEntry; import org.aspectj.apache.bcel.classfile.Synthetic; import org.aspectj.apache.bcel.classfile.Unknown; import org.aspectj.apache.bcel.classfile.ClassVisitor; -import org.aspectj.apache.bcel.classfile.annotation.RuntimeInvisibleAnnotations; -import org.aspectj.apache.bcel.classfile.annotation.RuntimeInvisibleParameterAnnotations; -import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisibleAnnotations; -import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisibleParameterAnnotations; +import org.aspectj.apache.bcel.classfile.annotation.RuntimeInvisAnnos; +import org.aspectj.apache.bcel.classfile.annotation.RuntimeInvisParamAnnos; +import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisAnnos; +import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisParamAnnos; /** * Traverses a JavaClass with another Visitor object 'piggy-backed' @@ -105,7 +105,7 @@ import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisibleParameterAnnot * class supplies the traversal strategy, other classes can make use * of it. * - * @version $Id: DescendingVisitor.java,v 1.3 2009/09/09 19:56:20 aclement Exp $ + * @version $Id: DescendingVisitor.java,v 1.4 2009/09/15 19:40:22 aclement Exp $ * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A> */ public class DescendingVisitor implements ClassVisitor { @@ -380,25 +380,25 @@ public class DescendingVisitor implements ClassVisitor { stack.pop(); } - public void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations attribute) { + public void visitRuntimeVisibleAnnotations(RuntimeVisAnnos attribute) { stack.push(attribute); attribute.accept(visitor); stack.pop(); } - public void visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations attribute) { + public void visitRuntimeInvisibleAnnotations(RuntimeInvisAnnos attribute) { stack.push(attribute); attribute.accept(visitor); stack.pop(); } - public void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations attribute) { + public void visitRuntimeVisibleParameterAnnotations(RuntimeVisParamAnnos attribute) { stack.push(attribute); attribute.accept(visitor); stack.pop(); } - public void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations attribute) { + public void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisParamAnnos attribute) { stack.push(attribute); attribute.accept(visitor); stack.pop(); diff --git a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/EmptyClassVisitor.java b/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/EmptyClassVisitor.java index 9d9f968bd..5dbe317b8 100644 --- a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/EmptyClassVisitor.java +++ b/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/EmptyClassVisitor.java @@ -90,10 +90,10 @@ import org.aspectj.apache.bcel.classfile.StackMapEntry; import org.aspectj.apache.bcel.classfile.Synthetic; import org.aspectj.apache.bcel.classfile.Unknown; import org.aspectj.apache.bcel.classfile.ClassVisitor; -import org.aspectj.apache.bcel.classfile.annotation.RuntimeInvisibleAnnotations; -import org.aspectj.apache.bcel.classfile.annotation.RuntimeInvisibleParameterAnnotations; -import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisibleAnnotations; -import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisibleParameterAnnotations; +import org.aspectj.apache.bcel.classfile.annotation.RuntimeInvisAnnos; +import org.aspectj.apache.bcel.classfile.annotation.RuntimeInvisParamAnnos; +import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisAnnos; +import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisParamAnnos; /** * Visitor with empty method bodies, can be extended and used in conjunction with the @@ -102,7 +102,7 @@ import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisibleParameterAnnot * By courtesy of David Spencer. * * @see DescendingVisitor - * @version $Id: EmptyClassVisitor.java,v 1.2 2008/05/28 23:53:00 aclement Exp $ + * @version $Id: EmptyClassVisitor.java,v 1.3 2009/09/15 19:40:22 aclement Exp $ * */ public class EmptyClassVisitor implements ClassVisitor { @@ -143,10 +143,10 @@ public class EmptyClassVisitor implements ClassVisitor { // J5SUPPORT: public void visitEnclosingMethod(EnclosingMethod obj) {} - public void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations attribute) {} - public void visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations attribute) {} - public void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations attribute) {} - public void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations attribute) {} + public void visitRuntimeVisibleAnnotations(RuntimeVisAnnos attribute) {} + public void visitRuntimeInvisibleAnnotations(RuntimeInvisAnnos attribute) {} + public void visitRuntimeVisibleParameterAnnotations(RuntimeVisParamAnnos attribute) {} + public void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisParamAnnos attribute) {} public void visitAnnotationDefault(AnnotationDefault attribute) {} public void visitLocalVariableTypeTable(LocalVariableTypeTable obj) {} diff --git a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/statics/StringRepresentation.java b/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/statics/StringRepresentation.java index 113e9227a..6b9fa3912 100644 --- a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/statics/StringRepresentation.java +++ b/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/statics/StringRepresentation.java @@ -88,10 +88,10 @@ import org.aspectj.apache.bcel.classfile.SourceFile; import org.aspectj.apache.bcel.classfile.StackMap; import org.aspectj.apache.bcel.classfile.Synthetic; import org.aspectj.apache.bcel.classfile.Unknown; -import org.aspectj.apache.bcel.classfile.annotation.RuntimeInvisibleAnnotations; -import org.aspectj.apache.bcel.classfile.annotation.RuntimeInvisibleParameterAnnotations; -import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisibleAnnotations; -import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisibleParameterAnnotations; +import org.aspectj.apache.bcel.classfile.annotation.RuntimeInvisAnnos; +import org.aspectj.apache.bcel.classfile.annotation.RuntimeInvisParamAnnos; +import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisAnnos; +import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisParamAnnos; import org.aspectj.apache.bcel.verifier.exc.AssertionViolatedException; /** @@ -106,7 +106,7 @@ import org.aspectj.apache.bcel.verifier.exc.AssertionViolatedException; * Note that this class also serves as a placeholder for more sophisticated message * handling in future versions of JustIce. * - * @version $Id: StringRepresentation.java,v 1.3 2008/08/28 00:02:14 aclement Exp $ + * @version $Id: StringRepresentation.java,v 1.4 2009/09/15 19:40:22 aclement Exp $ * @author <A HREF="http://www.inf.fu-berlin.de/~ehaase"/>Enver Haase</A> */ public class StringRepresentation extends org.aspectj.apache.bcel.verifier.EmptyClassVisitor{ @@ -258,10 +258,10 @@ public class StringRepresentation extends org.aspectj.apache.bcel.verifier.Empty tostring = toString(obj); } - public void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations obj) {tostring = toString(obj);} - public void visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations obj) {tostring = toString(obj);} - public void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations obj) {tostring = toString(obj);} - public void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations obj) {tostring = toString(obj);} + public void visitRuntimeVisibleAnnotations(RuntimeVisAnnos obj) {tostring = toString(obj);} + public void visitRuntimeInvisibleAnnotations(RuntimeInvisAnnos obj) {tostring = toString(obj);} + public void visitRuntimeVisibleParameterAnnotations(RuntimeVisParamAnnos obj) {tostring = toString(obj);} + public void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisParamAnnos obj) {tostring = toString(obj);} public void visitAnnotationDefault(AnnotationDefault obj) {tostring = toString(obj);} public void visitLocalVariableTypeTable(LocalVariableTypeTable obj) {tostring = toString(obj);} |