diff options
author | Rich Bolen <rich.bolen@icg360.com> | 2019-08-20 10:52:01 -0400 |
---|---|---|
committer | Rich Bolen <rich.bolen@icg360.com> | 2019-08-20 10:52:01 -0400 |
commit | c08c21ebd2b636d6bc9e3543aaf980f9e4733a04 (patch) | |
tree | 1263c43bc116067b4968f3cc8eeedf26fca99045 /src/test/javassist/bytecode/BytecodeTest.java | |
parent | 8f4788e0907278cec2a094af179451824651a515 (diff) | |
download | javassist-c08c21ebd2b636d6bc9e3543aaf980f9e4733a04.tar.gz javassist-c08c21ebd2b636d6bc9e3543aaf980f9e4733a04.zip |
Add support for the new Dynamic constant (17) created in java 11
Diffstat (limited to 'src/test/javassist/bytecode/BytecodeTest.java')
-rw-r--r-- | src/test/javassist/bytecode/BytecodeTest.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/test/javassist/bytecode/BytecodeTest.java b/src/test/javassist/bytecode/BytecodeTest.java index 5ddf5d5b..ec754b56 100644 --- a/src/test/javassist/bytecode/BytecodeTest.java +++ b/src/test/javassist/bytecode/BytecodeTest.java @@ -827,6 +827,42 @@ 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); |