diff options
-rw-r--r-- | src/main/javassist/bytecode/Bytecode.java | 19 | ||||
-rw-r--r-- | src/main/javassist/bytecode/ClassFileWriter.java | 18 | ||||
-rw-r--r-- | src/main/javassist/bytecode/ConstPool.java | 2 | ||||
-rw-r--r-- | src/test/javassist/bytecode/BytecodeTest.java | 36 |
4 files changed, 1 insertions, 74 deletions
diff --git a/src/main/javassist/bytecode/Bytecode.java b/src/main/javassist/bytecode/Bytecode.java index 193e3f8a..37a6d127 100644 --- a/src/main/javassist/bytecode/Bytecode.java +++ b/src/main/javassist/bytecode/Bytecode.java @@ -1241,25 +1241,6 @@ public class Bytecode extends ByteVector implements Cloneable, Opcode { } /** - * Appends DYNAMIC. - * - * @param bootstrap an index into the <code>bootstrap_methods</code> array - * of the bootstrap method table. - * @param name the method name. - * @param desc the method descriptor. - * @see Descriptor#ofMethod(CtClass,CtClass[]) - * @since 3.17 - */ - public void addDynamic(int bootstrap, String name, String desc) { - int nt = constPool.addNameAndTypeInfo(name, desc); - int dyn = constPool.addDynamicInfo(bootstrap, nt); - add(INVOKEDYNAMIC); - addIndex(dyn); - add(0, 0); - growStack(Descriptor.dataSize(desc)); // assume ConstPool#REF_invokeStatic - } - - /** * Appends LDC or LDC_W. The pushed item is a <code>String</code> * object. * diff --git a/src/main/javassist/bytecode/ClassFileWriter.java b/src/main/javassist/bytecode/ClassFileWriter.java index 03650b75..966767af 100644 --- a/src/main/javassist/bytecode/ClassFileWriter.java +++ b/src/main/javassist/bytecode/ClassFileWriter.java @@ -701,24 +701,6 @@ public class ClassFileWriter { } /** - * Adds a new <code>CONSTANT_InvokeDynamic_info</code> - * structure. - * - * @param bootstrap <code>bootstrap_method_attr_index</code>. - * @param nameAndTypeInfo <code>name_and_type_index</code>. - * @return the index of the added entry. - * - * @since 3.17.1 - */ - public int addDynamicInfo(int bootstrap, - int nameAndTypeInfo) { - output.write(DynamicInfo.tag); - output.writeShort(bootstrap); - output.writeShort(nameAndTypeInfo); - return num++; - } - - /** * Adds a new <code>CONSTANT_String_info</code> * structure. * diff --git a/src/main/javassist/bytecode/ConstPool.java b/src/main/javassist/bytecode/ConstPool.java index 08985089..bd521001 100644 --- a/src/main/javassist/bytecode/ConstPool.java +++ b/src/main/javassist/bytecode/ConstPool.java @@ -1242,7 +1242,7 @@ public final class ConstPool } /** - * Adds a new <code>CONSTANT_InvokeDynamic_info</code> structure. + * Adds a new <code>CONSTANT_Dynamic_info</code> structure. * * @param bootstrap <code>bootstrap_method_attr_index</code>. * @param nameAndType <code>name_and_type_index</code>. diff --git a/src/test/javassist/bytecode/BytecodeTest.java b/src/test/javassist/bytecode/BytecodeTest.java index ec754b56..5ddf5d5b 100644 --- a/src/test/javassist/bytecode/BytecodeTest.java +++ b/src/test/javassist/bytecode/BytecodeTest.java @@ -827,42 +827,6 @@ public class BytecodeTest extends TestCase { assertEquals("(I)V", cPool2.getUtf8Info(cPool2.getMethodTypeInfo(mtIndex))); } -// public void testDynamicInfo() throws Exception { -// ClassFile cf = new ClassFile(false, "test4.Dyn", null); -// cf.setInterfaces(new String[] { "java.lang.Cloneable" }); -// ConstPool cp = cf.getConstPool(); -// -// Bytecode code = new Bytecode(cp, 0, 1); -// code.addAload(0); -// code.addIconst(9); -// code.addLdc("nine"); -// code.addDynamic(0, "call", "I"); -// code.addOpcode(Opcode.SWAP); -// code.addOpcode(Opcode.POP); -// code.addOpcode(Opcode.IRETURN); -// -// FieldInfo fieldInfo = new FieldInfo(cp, "test", "S"); -// fieldInfo.setAccessFlags(AccessFlag.PUBLIC); -// cf.addField(fieldInfo); -// -// String desc -// = "(Ljava/lang/String;)I"; -// int mri = cp.addMethodrefInfo(cp.addClassInfo("Dyn"), "boot", desc); -// int mhi = cp.addMethodHandleInfo(ConstPool.REF_invokeStatic, mri); -// int[] args = new int[0]; -// BootstrapMethodsAttribute.BootstrapMethod[] bms -// = new BootstrapMethodsAttribute.BootstrapMethod[1]; -// bms[0] = new BootstrapMethodsAttribute.BootstrapMethod(mhi, args); -// -// cf.addAttribute(new BootstrapMethodsAttribute(cp, bms)); -// -// cf.write(new DataOutputStream(new FileOutputStream("test4/Dyn.class"))); -// -// Object obj = make(cf.getName()); -// -// assertNotNull(obj); -// } - public static Test suite() { TestSuite suite = new TestSuite("Bytecode Tests"); suite.addTestSuite(BytecodeTest.class); |