8020689: Missing LineNumberTable entries in compiled class files
authorjlahoda
Sun, 28 Jul 2013 10:17:45 +0200
changeset 19131 519fa466d8ba
parent 19130 d14e77dc1e0a
child 19132 e2349c075315
8020689: Missing LineNumberTable entries in compiled class files Reviewed-by: ksrini, mcimadamore
langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java
langtools/test/tools/javac/jvm/T8020689.java
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Fri Jul 26 14:08:37 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Sun Jul 28 10:17:45 2013 +0200
@@ -1820,7 +1820,6 @@
                 msym.externalType(types).getParameterTypes());
         if (!msym.isDynamic()) {
             code.statBegin(tree.pos);
-            code.markStatBegin();
         }
         result = m.invoke();
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/jvm/T8020689.java	Sun Jul 28 10:17:45 2013 +0200
@@ -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);
+    }
+}