8020689: Missing LineNumberTable entries in compiled class files

Reviewed-by: ksrini, mcimadamore
This commit is contained in:
Jan Lahoda 2013-07-28 10:17:45 +02:00
parent f5da332e66
commit 21ab6d5558
2 changed files with 36 additions and 1 deletions

View file

@ -1820,7 +1820,6 @@ public class Gen extends JCTree.Visitor {
msym.externalType(types).getParameterTypes()); msym.externalType(types).getParameterTypes());
if (!msym.isDynamic()) { if (!msym.isDynamic()) {
code.statBegin(tree.pos); code.statBegin(tree.pos);
code.markStatBegin();
} }
result = m.invoke(); result = m.invoke();
} }

View file

@ -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);
}
}