From 81e75232f4deaf5c9d45a4956d87a37f03722ca9 Mon Sep 17 00:00:00 2001 From: chiba Date: Sun, 14 Apr 2013 15:58:54 +0000 Subject: fixed JASSIST-185 git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@704 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- Readme.html | 4 ++-- javassist.jar | Bin 680010 -> 681159 bytes src/main/javassist/CtBehavior.java | 8 ++++++-- src/main/javassist/bytecode/CodeAttribute.java | 2 ++ src/test/javassist/JvstTest4.java | 8 ++++++++ src/test/test4/Lvtt.java | 11 +++++++++++ 6 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 src/test/test4/Lvtt.java diff --git a/Readme.html b/Readme.html index a123d0f5..25d15562 100644 --- a/Readme.html +++ b/Readme.html @@ -7,7 +7,7 @@

Javassist version 3

-

Copyright (C) 1999-2012 by Shigeru Chiba, All rights reserved.

+

Copyright (C) 1999-2013 by Shigeru Chiba, All rights reserved.


@@ -283,7 +283,7 @@ see javassist.Dump.

-version 3.18

-version 3.17.1 on December 3, 2012 diff --git a/javassist.jar b/javassist.jar index 8ff2f083..784fab0e 100644 Binary files a/javassist.jar and b/javassist.jar differ diff --git a/src/main/javassist/CtBehavior.java b/src/main/javassist/CtBehavior.java index 73ac277a..92513159 100644 --- a/src/main/javassist/CtBehavior.java +++ b/src/main/javassist/CtBehavior.java @@ -656,11 +656,15 @@ public abstract class CtBehavior extends CtMember { ca.insertLocalVar(where, size); LocalVariableAttribute va - = (LocalVariableAttribute) - ca.getAttribute(LocalVariableAttribute.tag); + = (LocalVariableAttribute)ca.getAttribute(LocalVariableAttribute.tag); if (va != null) va.shiftIndex(where, size); + LocalVariableTypeAttribute lvta + = (LocalVariableTypeAttribute)ca.getAttribute(LocalVariableTypeAttribute.tag); + if (lvta != null) + lvta.shiftIndex(where, size); + StackMapTable smt = (StackMapTable)ca.getAttribute(StackMapTable.tag); if (smt != null) smt.insertLocal(where, StackMapTable.typeTagOf(typeDesc), classInfo); diff --git a/src/main/javassist/bytecode/CodeAttribute.java b/src/main/javassist/bytecode/CodeAttribute.java index dbf714e7..090ae74d 100644 --- a/src/main/javassist/bytecode/CodeAttribute.java +++ b/src/main/javassist/bytecode/CodeAttribute.java @@ -465,6 +465,7 @@ public class CodeAttribute extends AttributeInfo implements Opcode { * Changes the index numbers of the local variables * to append a new parameter. * This method does not update LocalVariableAttribute, + * LocalVariableTypeAttribute, * StackMapTable, or StackMap. * These attributes must be explicitly updated. * @@ -472,6 +473,7 @@ public class CodeAttribute extends AttributeInfo implements Opcode { * @param size the type size of the new parameter (1 or 2). * * @see LocalVariableAttribute#shiftIndex(int, int) + * @see LocalVariableTypeAttribute#shiftIndex(int, int) * @see StackMapTable#insertLocal(int, int, int) * @see StackMap#insertLocal(int, int, int) */ diff --git a/src/test/javassist/JvstTest4.java b/src/test/javassist/JvstTest4.java index 7692d5bc..619b9e97 100644 --- a/src/test/javassist/JvstTest4.java +++ b/src/test/javassist/JvstTest4.java @@ -838,4 +838,12 @@ public class JvstTest4 extends JvstTestRoot { Object obj = make(cc.getName()); assertEquals(12, invoke(obj, "test1")); } + + public void testLocalVariableTypeTable() throws Exception { + CtClass cc = sloader.get("test4.Lvtt"); + CtMethod m = cc.getDeclaredMethod("run"); + m.addParameter(CtClass.intType); + cc.writeFile(); + Object obj = make(cc.getName()); + } } diff --git a/src/test/test4/Lvtt.java b/src/test/test4/Lvtt.java new file mode 100644 index 00000000..b9d72c53 --- /dev/null +++ b/src/test/test4/Lvtt.java @@ -0,0 +1,11 @@ +package test4; + +import java.util.ArrayList; +import java.util.List; + +public class Lvtt { + public void run() { + List s = new ArrayList(); + System.out.println(s); + } +} -- cgit v1.2.3