[jboss-cvs] javassist SVN: r572 - in trunk: src/main/javassist/expr and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Sep 9 13:27:33 EDT 2010


Author: chiba
Date: 2010-09-09 13:27:32 -0400 (Thu, 09 Sep 2010)
New Revision: 572

Modified:
   trunk/src/main/javassist/bytecode/stackmap/Tracer.java
   trunk/src/main/javassist/expr/Cast.java
   trunk/src/main/javassist/expr/Expr.java
   trunk/src/main/javassist/expr/FieldAccess.java
   trunk/src/main/javassist/expr/Handler.java
   trunk/src/main/javassist/expr/Instanceof.java
   trunk/src/main/javassist/expr/MethodCall.java
   trunk/src/main/javassist/expr/NewArray.java
   trunk/src/main/javassist/expr/NewExpr.java
   trunk/tutorial/tutorial2.html
Log:
fixed JASSIST-132

Modified: trunk/src/main/javassist/bytecode/stackmap/Tracer.java
===================================================================
--- trunk/src/main/javassist/bytecode/stackmap/Tracer.java	2010-08-28 14:41:09 UTC (rev 571)
+++ trunk/src/main/javassist/bytecode/stackmap/Tracer.java	2010-09-09 17:27:32 UTC (rev 572)
@@ -88,17 +88,22 @@
      * @return      the size of the instruction at POS.
      */
     protected int doOpcode(int pos, byte[] code) throws BadBytecode {
-        int op = code[pos] & 0xff;
-        if (op < 96)
-            if (op < 54)
-                return doOpcode0_53(pos, code, op);
+        try {
+            int op = code[pos] & 0xff;
+            if (op < 96)
+                if (op < 54)
+                    return doOpcode0_53(pos, code, op);
+                else
+                    return doOpcode54_95(pos, code, op);
             else
-                return doOpcode54_95(pos, code, op);
-        else
-            if (op < 148)
-                return doOpcode96_147(pos, code, op);
-            else
-                return doOpcode148_201(pos, code, op);
+                if (op < 148)
+                    return doOpcode96_147(pos, code, op);
+                else
+                    return doOpcode148_201(pos, code, op);
+        }
+        catch (ArrayIndexOutOfBoundsException e) {
+            throw new BadBytecode("inconsistent stack height " + e.getMessage());
+        }
     }
 
     protected void visitBranch(int pos, byte[] code, int offset) throws BadBytecode {}

Modified: trunk/src/main/javassist/expr/Cast.java
===================================================================
--- trunk/src/main/javassist/expr/Cast.java	2010-08-28 14:41:09 UTC (rev 571)
+++ trunk/src/main/javassist/expr/Cast.java	2010-09-09 17:27:32 UTC (rev 572)
@@ -84,7 +84,7 @@
      *
      * <p>$0 is available but the value is <code>null</code>.
      *
-     * @param statement         a Java statement.
+     * @param statement         a Java statement except try-catch.
      */
     public void replace(String statement) throws CannotCompileException {
         thisClass.getClassFile();   // to call checkModify().

Modified: trunk/src/main/javassist/expr/Expr.java
===================================================================
--- trunk/src/main/javassist/expr/Expr.java	2010-08-28 14:41:09 UTC (rev 571)
+++ trunk/src/main/javassist/expr/Expr.java	2010-09-09 17:27:32 UTC (rev 572)
@@ -264,7 +264,7 @@
      * Replaces this expression with the bytecode derived from
      * the given source text.
      *
-     * @param statement         a Java statement.
+     * @param statement         a Java statement except try-catch.
      */
     public abstract void replace(String statement) throws CannotCompileException;
 
@@ -272,7 +272,7 @@
      * Replaces this expression with the bytecode derived from
      * the given source text and <code>ExprEditor</code>.
      *
-     * @param statement         a Java statement.
+     * @param statement         a Java statement except try-catch.
      * @param recursive         if not null, the substituted bytecode
      *                          is recursively processed by the given
      *                          <code>ExprEditor</code>.

Modified: trunk/src/main/javassist/expr/FieldAccess.java
===================================================================
--- trunk/src/main/javassist/expr/FieldAccess.java	2010-08-28 14:41:09 UTC (rev 571)
+++ trunk/src/main/javassist/expr/FieldAccess.java	2010-09-09 17:27:32 UTC (rev 572)
@@ -144,7 +144,7 @@
      * If the field access is writing, $_ is available but the value
      * of $_ is ignored.
      *
-     * @param statement         a Java statement.
+     * @param statement         a Java statement except try-catch.
      */
     public void replace(String statement) throws CannotCompileException {
         thisClass.getClassFile();   // to call checkModify().

Modified: trunk/src/main/javassist/expr/Handler.java
===================================================================
--- trunk/src/main/javassist/expr/Handler.java	2010-08-28 14:41:09 UTC (rev 571)
+++ trunk/src/main/javassist/expr/Handler.java	2010-09-09 17:27:32 UTC (rev 572)
@@ -92,7 +92,7 @@
     /**
      * This method has not been implemented yet.
      *
-     * @param statement         a Java statement.
+     * @param statement         a Java statement except try-catch.
      */
     public void replace(String statement) throws CannotCompileException {
         throw new RuntimeException("not implemented yet");

Modified: trunk/src/main/javassist/expr/Instanceof.java
===================================================================
--- trunk/src/main/javassist/expr/Instanceof.java	2010-08-28 14:41:09 UTC (rev 571)
+++ trunk/src/main/javassist/expr/Instanceof.java	2010-09-09 17:27:32 UTC (rev 572)
@@ -87,7 +87,7 @@
      *
      * <p>$0 is available but the value is <code>null</code>.
      *
-     * @param statement         a Java statement.
+     * @param statement         a Java statement except try-catch.
      */
     public void replace(String statement) throws CannotCompileException {
         thisClass.getClassFile();   // to call checkModify().

Modified: trunk/src/main/javassist/expr/MethodCall.java
===================================================================
--- trunk/src/main/javassist/expr/MethodCall.java	2010-08-28 14:41:09 UTC (rev 571)
+++ trunk/src/main/javassist/expr/MethodCall.java	2010-09-09 17:27:32 UTC (rev 572)
@@ -173,7 +173,7 @@
      *
      * <p>$0 is available even if the called method is static.
      *
-     * @param statement         a Java statement.
+     * @param statement         a Java statement except try-catch.
      */
     public void replace(String statement) throws CannotCompileException {
         thisClass.getClassFile();   // to call checkModify().

Modified: trunk/src/main/javassist/expr/NewArray.java
===================================================================
--- trunk/src/main/javassist/expr/NewArray.java	2010-08-28 14:41:09 UTC (rev 571)
+++ trunk/src/main/javassist/expr/NewArray.java	2010-09-09 17:27:32 UTC (rev 572)
@@ -153,7 +153,7 @@
      * If the field access is writing, $_ is available but the value
      * of $_ is ignored.
      *
-     * @param statement         a Java statement.
+     * @param statement         a Java statement except try-catch.
      */
     public void replace(String statement) throws CannotCompileException {
         try {

Modified: trunk/src/main/javassist/expr/NewExpr.java
===================================================================
--- trunk/src/main/javassist/expr/NewExpr.java	2010-08-28 14:41:09 UTC (rev 571)
+++ trunk/src/main/javassist/expr/NewExpr.java	2010-09-09 17:27:32 UTC (rev 572)
@@ -156,7 +156,7 @@
      *
      * <p>$0 is available but the value is null.
      *
-     * @param statement         a Java statement.
+     * @param statement         a Java statement except try-catch.
      */
     public void replace(String statement) throws CannotCompileException {
         thisClass.getClassFile();   // to call checkModify().

Modified: trunk/tutorial/tutorial2.html
===================================================================
--- trunk/tutorial/tutorial2.html	2010-08-28 14:41:09 UTC (rev 571)
+++ trunk/tutorial/tutorial2.html	2010-09-09 17:27:32 UTC (rev 572)
@@ -664,7 +664,7 @@
 
 <p>so that the first parameter to <code>move()</code> is always 0.
 Note that the substituted code is not an expression but
-a statement or a block.
+a statement or a block.  It cannot be or contain a try-catch statement.
 
 <p>The method <code>instrument()</code> searches a method body.
 If it finds an expression such as a method call, field access, and object



More information about the jboss-cvs-commits mailing list