aboutsummaryrefslogtreecommitdiffstats
path: root/bcel-builder
diff options
context:
space:
mode:
authoraclement <aclement>2008-08-28 00:05:29 +0000
committeraclement <aclement>2008-08-28 00:05:29 +0000
commitc6b7ed7054ee71a55ce721c3b00cec0ba64a924b (patch)
tree178ded26960caa97c7cbaaefdc2d7d9104da0b5b /bcel-builder
parent29b24ec583efc887faee58767964049554ca2661 (diff)
downloadaspectj-c6b7ed7054ee71a55ce721c3b00cec0ba64a924b.tar.gz
aspectj-c6b7ed7054ee71a55ce721c3b00cec0ba64a924b.zip
chewed by formatter
Diffstat (limited to 'bcel-builder')
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/generic/LOOKUPSWITCH.java86
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/generic/TABLESWITCH.java146
2 files changed, 117 insertions, 115 deletions
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LOOKUPSWITCH.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LOOKUPSWITCH.java
index 889bbbc6d..b04921ddb 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/generic/LOOKUPSWITCH.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LOOKUPSWITCH.java
@@ -53,63 +53,63 @@ package org.aspectj.apache.bcel.generic;
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
-import java.io.*;
+import java.io.DataOutputStream;
+import java.io.IOException;
import org.aspectj.apache.bcel.Constants;
import org.aspectj.apache.bcel.util.ByteSequence;
-/**
+import com.sun.org.apache.bcel.internal.generic.SWITCH;
+
+/**
* LOOKUPSWITCH - Switch with unordered set of values
- *
- * @version $Id: LOOKUPSWITCH.java,v 1.3 2008/05/28 23:52:57 aclement Exp $
- * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
+ *
+ * @version $Id: LOOKUPSWITCH.java,v 1.4 2008/08/28 00:05:29 aclement Exp $
+ * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see SWITCH
*/
public class LOOKUPSWITCH extends InstructionSelect {
+ public LOOKUPSWITCH(int[] match, InstructionHandle[] targets, InstructionHandle target) {
+ super(LOOKUPSWITCH, match, targets, target);
+ // Alignment remainer assumed 0 here, until dump time
+ length = (short) (9 + matchLength * 8);
+ fixedLength = length;
+ }
- public LOOKUPSWITCH(int[] match, InstructionHandle[] targets,
- InstructionHandle target) {
- super(org.aspectj.apache.bcel.Constants.LOOKUPSWITCH, match, targets, target);
-
- length = (short)(9 + matchLength * 8); /* alignment remainder assumed
- * 0 here, until dump time. */
- fixedLength = length;
- }
+ /**
+ * Dump instruction as byte code to stream out.
+ *
+ * @param out Output stream
+ */
+ public void dump(DataOutputStream out) throws IOException {
+ super.dump(out);
+ out.writeInt(matchLength); // npairs
- /**
- * Dump instruction as byte code to stream out.
- * @param out Output stream
- */
- public void dump(DataOutputStream out) throws IOException {
- super.dump(out);
- out.writeInt(matchLength); // npairs
+ for (int i = 0; i < matchLength; i++) {
+ out.writeInt(match[i]); // match-offset pairs
+ out.writeInt(indices[i] = getTargetOffset(targets[i]));
+ }
+ }
- for(int i=0; i < matchLength; i++) {
- out.writeInt(match[i]); // match-offset pairs
- out.writeInt(indices[i] = getTargetOffset(targets[i]));
- }
- }
+ /**
+ * Read needed data (e.g. index) from file.
+ */
+ public LOOKUPSWITCH(ByteSequence bytes) throws IOException {
+ super(Constants.LOOKUPSWITCH, bytes); // reads padding
- /**
- * Read needed data (e.g. index) from file.
- */
- public LOOKUPSWITCH(ByteSequence bytes) throws IOException
- {
- super(Constants.LOOKUPSWITCH,bytes); // reads padding
+ matchLength = bytes.readInt();
+ fixedLength = (short) (9 + matchLength * 8);
+ length = (short) (fixedLength + padding);
- matchLength = bytes.readInt();
- fixedLength = (short)(9 + matchLength * 8);
- length = (short)(fixedLength + padding);
-
- match = new int[matchLength];
- indices = new int[matchLength];
- targets = new InstructionHandle[matchLength];
+ match = new int[matchLength];
+ indices = new int[matchLength];
+ targets = new InstructionHandle[matchLength];
- for(int i=0; i < matchLength; i++) {
- match[i] = bytes.readInt();
- indices[i] = bytes.readInt();
- }
- }
+ for (int i = 0; i < matchLength; i++) {
+ match[i] = bytes.readInt();
+ indices[i] = bytes.readInt();
+ }
+ }
}
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/TABLESWITCH.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/TABLESWITCH.java
index 9769db4b0..5dc26346b 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/generic/TABLESWITCH.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/TABLESWITCH.java
@@ -1,5 +1,3 @@
-package org.aspectj.apache.bcel.generic;
-
/* ====================================================================
* The Apache Software License, Version 1.1
*
@@ -53,84 +51,88 @@ package org.aspectj.apache.bcel.generic;
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
-import java.io.*;
+package org.aspectj.apache.bcel.generic;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
import org.aspectj.apache.bcel.Constants;
import org.aspectj.apache.bcel.util.ByteSequence;
-/**
+import com.sun.org.apache.bcel.internal.generic.SWITCH;
+
+/**
* TABLESWITCH - Switch within given range of values, i.e., low..high
- *
- * @version $Id: TABLESWITCH.java,v 1.4 2008/05/28 23:52:54 aclement Exp $
- * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
+ *
+ * @version $Id: TABLESWITCH.java,v 1.5 2008/08/28 00:05:29 aclement Exp $
+ * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see SWITCH
*/
public class TABLESWITCH extends InstructionSelect {
-
- /**
- * @param match sorted array of match values, match[0] must be low value,
- * match[match_length - 1] high value
- * @param targets where to branch for matched values
- * @param target default branch
- */
- public TABLESWITCH(int[] match, InstructionHandle[] targets,
- InstructionHandle target) {
- super(org.aspectj.apache.bcel.Constants.TABLESWITCH, match, targets, target);
-
-// if (match_length==0) {
-// throw new RuntimeException("A tableswitch with no targets should be represented as a LOOKUPSWITCH");
-// }
-
- length = (short)(13 + matchLength * 4); /* Alignment remainder assumed
- * 0 here, until dump time */
- fixedLength = length;
- }
-
- /**
- * Dump instruction as byte code to stream out.
- * @param out Output stream
- */
- public void dump(DataOutputStream out) throws IOException {
- super.dump(out);
-
- int low = (matchLength > 0)? match[0] : 0;
- out.writeInt(low);
-
- int high = (matchLength > 0)? match[matchLength - 1] : 0;
- out.writeInt(high);
-
-// See aj bug pr104720
-// if (match_length==0) out.writeInt(0); // following the switch you need to supply "HIGH-LOW+1" entries
-
- for(int i=0; i < matchLength; i++) // jump offsets
- out.writeInt(indices[i] = getTargetOffset(targets[i]));
- }
-
- /**
- * Read needed data (e.g. index) from file.
- */
- public TABLESWITCH(ByteSequence bytes) throws IOException
- {
- super(Constants.TABLESWITCH,bytes);
-
- int low = bytes.readInt();
- int high = bytes.readInt();
-
- matchLength = high - low + 1;
- fixedLength = (short)(13 + matchLength * 4);
- length = (short)(fixedLength + padding);
-
- match = new int[matchLength];
- indices = new int[matchLength];
- targets = new InstructionHandle[matchLength];
-
- for(int i=low; i <= high; i++)
- match[i - low] = i;
-
- for(int i=0; i < matchLength; i++) {
- indices[i] = bytes.readInt();
- }
- }
+ /**
+ * @param match sorted array of match values, match[0] must be low value, match[match_length - 1] high value
+ * @param targets where to branch for matched values
+ * @param target default branch
+ */
+ public TABLESWITCH(int[] match, InstructionHandle[] targets, InstructionHandle target) {
+ super(org.aspectj.apache.bcel.Constants.TABLESWITCH, match, targets, target);
+
+ // if (match_length==0) {
+ // throw new RuntimeException("A tableswitch with no targets should be represented as a LOOKUPSWITCH");
+ // }
+
+ // Alignment remainder assumed 0 here, until dump time
+ length = (short) (13 + matchLength * 4);
+ fixedLength = length;
+ }
+
+ /**
+ * Dump instruction as byte code to stream out.
+ *
+ * @param out Output stream
+ */
+ public void dump(DataOutputStream out) throws IOException {
+ super.dump(out);
+
+ int low = matchLength > 0 ? match[0] : 0;
+ out.writeInt(low);
+
+ int high = matchLength > 0 ? match[matchLength - 1] : 0;
+ out.writeInt(high);
+
+ // See aj bug pr104720
+ // if (match_length==0) out.writeInt(0); // following the switch you need to supply "HIGH-LOW+1" entries
+
+ for (int i = 0; i < matchLength; i++) {
+ out.writeInt(indices[i] = getTargetOffset(targets[i]));
+ }
+ }
+
+ /**
+ * Read needed data (e.g. index) from file.
+ */
+ public TABLESWITCH(ByteSequence bytes) throws IOException {
+ super(Constants.TABLESWITCH, bytes);
+
+ int low = bytes.readInt();
+ int high = bytes.readInt();
+
+ matchLength = high - low + 1;
+ fixedLength = (short) (13 + matchLength * 4);
+ length = (short) (fixedLength + padding);
+
+ match = new int[matchLength];
+ indices = new int[matchLength];
+ targets = new InstructionHandle[matchLength];
+
+ for (int i = low; i <= high; i++) {
+ match[i - low] = i;
+ }
+
+ for (int i = 0; i < matchLength; i++) {
+ indices[i] = bytes.readInt();
+ }
+ }
}