aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/javassist/bytecode/stackmap/BasicBlock.java
diff options
context:
space:
mode:
authorchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2012-11-15 15:06:33 +0000
committerchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2012-11-15 15:06:33 +0000
commit226a8f53e5d26d8a4a5aefcfd09340bbc9caf7ce (patch)
treecc37a3cbb8524ff7cee6acb4fcf366c78bb4bdc8 /src/main/javassist/bytecode/stackmap/BasicBlock.java
parentc135586d0914166b9ec51eef0e5dea07be8c7e95 (diff)
downloadjavassist-226a8f53e5d26d8a4a5aefcfd09340bbc9caf7ce.tar.gz
javassist-226a8f53e5d26d8a4a5aefcfd09340bbc9caf7ce.zip
fixed JASSIST-177
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@686 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main/javassist/bytecode/stackmap/BasicBlock.java')
-rw-r--r--src/main/javassist/bytecode/stackmap/BasicBlock.java20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/main/javassist/bytecode/stackmap/BasicBlock.java b/src/main/javassist/bytecode/stackmap/BasicBlock.java
index 9afe1a3a..6213e22a 100644
--- a/src/main/javassist/bytecode/stackmap/BasicBlock.java
+++ b/src/main/javassist/bytecode/stackmap/BasicBlock.java
@@ -23,10 +23,14 @@ import java.util.ArrayList;
/**
* A basic block is a sequence of bytecode that does not contain jump/branch
* instructions except at the last bytecode.
- * Since Java6 or later does not allow JSR, this class deals with JSR as a
- * non-branch instruction.
+ * Since Java7 or later does not allow JSR, this class throws an exception when
+ * it finds JSR.
*/
public class BasicBlock {
+ static class JsrBytecode extends BadBytecode {
+ JsrBytecode() { super("JSR"); }
+ }
+
protected int position, length;
protected int incoming; // the number of incoming branches.
protected BasicBlock[] exit; // null if the block is a leaf.
@@ -294,16 +298,18 @@ public class BasicBlock {
makeMark(marks, pos, jumps, size, true);
}
- /**
- * We ignore JSR since Java 6 or later does not allow it.
- */
- protected void makeJsr(HashMap marks, int pos, int target, int size) {
/*
+ * We could ignore JSR since Java 7 or later does not allow it.
+ * See The JVM Spec. Sec. 4.10.2.5.
+ */
+ protected void makeJsr(HashMap marks, int pos, int target, int size) throws BadBytecode {
+ /*
Mark to = makeMark(marks, target);
Mark next = makeMark(marks, pos + size);
BasicBlock[] jumps = makeArray(to.block, next.block);
makeMark(marks, pos, jumps, size, false);
- */
+ */
+ throw new JsrBytecode();
}
private BasicBlock[] makeBlocks(HashMap markTable) {