From 208b11e450099ca9cef17908536192b983066e11 Mon Sep 17 00:00:00 2001 From: jlahoda Date: Sun, 28 Jul 2013 10:17:45 +0200 Subject: [PATCH] 8020689: Missing LineNumberTable entries in compiled class files Reviewed-by: ksrini, mcimadamore --- .../classes/com/sun/tools/javac/jvm/Gen.java | 1 - test/tools/javac/jvm/T8020689.java | 36 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 test/tools/javac/jvm/T8020689.java diff --git a/src/share/classes/com/sun/tools/javac/jvm/Gen.java b/src/share/classes/com/sun/tools/javac/jvm/Gen.java index 241845ec..3f0fc861 100644 --- a/src/share/classes/com/sun/tools/javac/jvm/Gen.java +++ b/src/share/classes/com/sun/tools/javac/jvm/Gen.java @@ -1820,7 +1820,6 @@ public class Gen extends JCTree.Visitor { msym.externalType(types).getParameterTypes()); if (!msym.isDynamic()) { code.statBegin(tree.pos); - code.markStatBegin(); } result = m.invoke(); } diff --git a/test/tools/javac/jvm/T8020689.java b/test/tools/javac/jvm/T8020689.java new file mode 100644 index 00000000..ce8bcb6a --- /dev/null +++ b/test/tools/javac/jvm/T8020689.java @@ -0,0 +1,36 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8020689 + * @summary Making sure the LineNumberTable entry is correctly generated for the leading method invocation in the else section + * @compile T8020689.java + * @run main T8020689 + */ + +public class T8020689 { + + public static void main(String... args) { + if (args.length > 0) { + a(); + } else { + b(); + } + } + + static void a() { + } + + static void b() { + assertLine(15); + } + + public static void assertLine(int expectedline) { + Exception e = new Exception("expected line#: " + expectedline); + int myline = e.getStackTrace()[2].getLineNumber(); + if( myline != expectedline) { + throw new RuntimeException("Incorrect line number " + + "expected: " + expectedline + + ", got: " + myline, e); + } + System.out.format("Got expected line number %d correct %n", myline); + } +} -- GitLab