From: chiba Date: Thu, 31 Jul 2003 14:37:52 +0000 (+0000) Subject: added Expr#indexofBytecode. X-Git-Tag: rel_3_17_1_ga~576 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4fc98e20925d92a81cb8e2076886c841993af1c5;p=javassist.git added Expr#indexofBytecode. git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@31 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- diff --git a/Readme.html b/Readme.html index 4a5781c3..0f319d68 100644 --- a/Readme.html +++ b/Readme.html @@ -236,11 +236,12 @@ see javassist.Dump.

Changes

-

- version 2.6 in July, 2003. +

- version 2.6 in August, 2003.

- version 2.5.1 in May, 2003. diff --git a/src/main/javassist/bytecode/CodeIterator.java b/src/main/javassist/bytecode/CodeIterator.java index 637dfc99..40eb90d4 100644 --- a/src/main/javassist/bytecode/CodeIterator.java +++ b/src/main/javassist/bytecode/CodeIterator.java @@ -137,7 +137,7 @@ public class CodeIterator implements Opcode { /** * Returns the index of the next instruction - * (not the next opcode). + * (not the operand following the current opcode). * *

Note that the index is into the byte array returned by * get().getCode(). diff --git a/src/main/javassist/expr/Expr.java b/src/main/javassist/expr/Expr.java index b02d40e9..2764767d 100644 --- a/src/main/javassist/expr/Expr.java +++ b/src/main/javassist/expr/Expr.java @@ -35,7 +35,7 @@ public abstract class Expr implements Opcode { static final String javaLangObject = "java.lang.Object"; - Expr(int pos, CodeIterator i, CtClass declaring, MethodInfo m) { + protected Expr(int pos, CodeIterator i, CtClass declaring, MethodInfo m) { currentPos = pos; iterator = i; thisClass = declaring; @@ -124,6 +124,16 @@ public abstract class Expr implements Opcode { list.add(c); } + /** + * Returns the index of the bytecode corresponding to the + * expression. + * It is the index into the byte array containing the Java bytecode + * that implements the method. + */ + public int indexOfBytecode() { + return currentPos; + } + /** * Returns the line number of the source line containing the * expression.