diff options
author | akuznetsov <akuznetsov@tradingview.com> | 2023-10-04 14:22:28 +0400 |
---|---|---|
committer | akuznetsov <akuznetsov@tradingview.com> | 2023-10-04 14:22:28 +0400 |
commit | 15d56cfb702000400ff7d888e6084da72530221e (patch) | |
tree | ba9a83625af43ec9ce0be18f49fcb01a148108df /src/test | |
parent | d5a7881381080fa4953b24c069675ca435598b95 (diff) | |
download | javassist-15d56cfb702000400ff7d888e6084da72530221e.tar.gz javassist-15d56cfb702000400ff7d888e6084da72530221e.zip |
save line number count though all methods/ctors
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/javassist/bytecode/BytecodeTest.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/javassist/bytecode/BytecodeTest.java b/src/test/javassist/bytecode/BytecodeTest.java index b7ab1f33..cc02801d 100644 --- a/src/test/javassist/bytecode/BytecodeTest.java +++ b/src/test/javassist/bytecode/BytecodeTest.java @@ -317,6 +317,31 @@ public class BytecodeTest extends TestCase { fail("should not happen"); } + public void testLineNumberCompiler2() { + CtClass testClass = loader.makeClass("javassist.bytecode.LineNumberCompilerClass2"); + String ctor = String.join("\n", + "public LineNumberCompilerClass2() {", + " super();", + "}"); + String run = String.join("\n", + "public void run() {", + " return;", + "}"); + String run2 = String.join("\n", + "public void run2() {", + " run()", + "}"); + try { + testClass.addConstructor(CtNewConstructor.make(ctor, testClass)); + testClass.addMethod(CtMethod.make(run, testClass)); + testClass.addMethod(CtMethod.make(run2, testClass)); + } catch (CannotCompileException e) { + assertEquals("line 9: ; is missing", e.getCause().getMessage()); + return; + } + fail("should not happen"); + } + public void testLineNumberException() { CtClass testClass = loader.makeClass("javassist.bytecode.LineNumberExceptionClass"); String run = String.join("\n", |