summaryrefslogtreecommitdiffstats
path: root/bcel-builder/src
diff options
context:
space:
mode:
authoraclement <aclement>2008-08-27 23:59:32 +0000
committeraclement <aclement>2008-08-27 23:59:32 +0000
commit525c1bf389eff272a4eaf577cbf805d7c1a8dbfa (patch)
tree0709907c28872786ddbdd7fc3e472b4d574b53c7 /bcel-builder/src
parent87ef73fb813749243fd6b549888a83f92e36644e (diff)
downloadaspectj-525c1bf389eff272a4eaf577cbf805d7c1a8dbfa.tar.gz
aspectj-525c1bf389eff272a4eaf577cbf805d7c1a8dbfa.zip
chewed by formatter
Diffstat (limited to 'bcel-builder/src')
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/classfile/AttributeUtils.java91
1 files changed, 54 insertions, 37 deletions
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/AttributeUtils.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/AttributeUtils.java
index 3c540e8c9..c2f7ed1c0 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/classfile/AttributeUtils.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/AttributeUtils.java
@@ -8,75 +8,90 @@ import org.aspectj.apache.bcel.Constants;
public class AttributeUtils {
- public static Attribute[] readAttributes(DataInputStream dataInputstream, ConstantPool cpool) {
- try {
- int length = dataInputstream.readUnsignedShort();
- if (length==0) return Attribute.NoAttributes;
- Attribute[] attrs = new Attribute[length];
- for (int i=0; i < length; i++)
- attrs[i] = Attribute.readAttribute(dataInputstream, cpool);
- return attrs;
- } catch (IOException e) {
- throw new ClassFormatException("IOException whilst reading set of attributes: "+e.toString());
- }
- }
-
+ public static Attribute[] readAttributes(DataInputStream dataInputstream, ConstantPool cpool) {
+ try {
+ int length = dataInputstream.readUnsignedShort();
+ if (length == 0) {
+ return Attribute.NoAttributes;
+ }
+ Attribute[] attrs = new Attribute[length];
+ for (int i = 0; i < length; i++) {
+ attrs[i] = Attribute.readAttribute(dataInputstream, cpool);
+ }
+ return attrs;
+ } catch (IOException e) {
+ throw new ClassFormatException("IOException whilst reading set of attributes: " + e.toString());
+ }
+ }
+
/** Write (serialize) a set of attributes into a specified output stream */
- public static void writeAttributes(Attribute[] attributes,DataOutputStream file) throws IOException {
- if (attributes==null) {
+ public static void writeAttributes(Attribute[] attributes, DataOutputStream file) throws IOException {
+ if (attributes == null) {
file.writeShort(0);
} else {
file.writeShort(attributes.length);
- for(int i=0; i < attributes.length; i++)
- attributes[i].dump(file);
+ for (int i = 0; i < attributes.length; i++) {
+ attributes[i].dump(file);
+ }
}
}
public static Attribute[] copy(Attribute[] attributes, ConstantPool constant_pool) {
- if (attributes==null || attributes.length==0) return Attribute.NoAttributes;
+ if (attributes == null || attributes.length == 0) {
+ return Attribute.NoAttributes;
+ }
Attribute[] attrs = new Attribute[attributes.length];
for (int i = 0; i < attributes.length; i++) {
- attrs[i] = attributes[i].copy(constant_pool);
+ attrs[i] = attributes[i].copy(constant_pool);
}
return attrs;
}
public static Signature getSignatureAttribute(Attribute[] attributes) {
- for(int i=0; i < attributes.length; i++) {
- if (attributes[i].tag==Constants.ATTR_SIGNATURE) return ((Signature)attributes[i]);
- }
+ for (int i = 0; i < attributes.length; i++) {
+ if (attributes[i].tag == Constants.ATTR_SIGNATURE) {
+ return (Signature) attributes[i];
+ }
+ }
return null;
}
public static Code getCodeAttribute(Attribute[] attributes) {
- for(int i=0; i < attributes.length; i++) {
- if (attributes[i].tag==Constants.ATTR_CODE) { return ((Code)attributes[i]);}
- }
+ for (int i = 0; i < attributes.length; i++) {
+ if (attributes[i].tag == Constants.ATTR_CODE) {
+ return (Code) attributes[i];
+ }
+ }
return null;
}
public static ExceptionTable getExceptionTableAttribute(Attribute[] attributes) {
- for(int i=0; i < attributes.length; i++) {
- if (attributes[i].tag==Constants.ATTR_EXCEPTIONS) { return ((ExceptionTable)attributes[i]);}
- }
+ for (int i = 0; i < attributes.length; i++) {
+ if (attributes[i].tag == Constants.ATTR_EXCEPTIONS) {
+ return (ExceptionTable) attributes[i];
+ }
+ }
return null;
}
public static ConstantValue getConstantValueAttribute(Attribute[] attributes) {
- for(int i=0; i < attributes.length; i++) {
- if(attributes[i].getTag() == Constants.ATTR_CONSTANT_VALUE) return (ConstantValue)attributes[i];
- }
+ for (int i = 0; i < attributes.length; i++) {
+ if (attributes[i].getTag() == Constants.ATTR_CONSTANT_VALUE) {
+ return (ConstantValue) attributes[i];
+ }
+ }
return null;
}
- public static void accept(Attribute[] attributes,ClassVisitor visitor) {
- for(int i=0; i < attributes.length; i++)
+ public static void accept(Attribute[] attributes, ClassVisitor visitor) {
+ for (int i = 0; i < attributes.length; i++) {
attributes[i].accept(visitor);
+ }
}
public static boolean hasSyntheticAttribute(Attribute[] attributes) {
for (int i = 0; i < attributes.length; i++) {
- if (attributes[i].tag==Constants.ATTR_SYNTHETIC) {
+ if (attributes[i].tag == Constants.ATTR_SYNTHETIC) {
return true;
}
}
@@ -84,9 +99,11 @@ public class AttributeUtils {
}
public static SourceFile getSourceFileAttribute(Attribute[] attributes) {
- for(int i=0; i < attributes.length; i++) {
- if (attributes[i].tag==Constants.ATTR_SOURCE_FILE) { return ((SourceFile)attributes[i]);}
- }
+ for (int i = 0; i < attributes.length; i++) {
+ if (attributes[i].tag == Constants.ATTR_SOURCE_FILE) {
+ return (SourceFile) attributes[i];
+ }
+ }
return null;
}