Sun, 28 Jul 2013 10:17:45 +0200
8020689: Missing LineNumberTable entries in compiled class files
Reviewed-by: ksrini, mcimadamore
src/share/classes/com/sun/tools/javac/jvm/Gen.java | file | annotate | diff | comparison | revisions | |
test/tools/javac/jvm/T8020689.java | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Gen.java Fri Jul 26 14:08:37 2013 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Gen.java Sun Jul 28 10:17:45 2013 +0200 1.3 @@ -1820,7 +1820,6 @@ 1.4 msym.externalType(types).getParameterTypes()); 1.5 if (!msym.isDynamic()) { 1.6 code.statBegin(tree.pos); 1.7 - code.markStatBegin(); 1.8 } 1.9 result = m.invoke(); 1.10 }
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/test/tools/javac/jvm/T8020689.java Sun Jul 28 10:17:45 2013 +0200 2.3 @@ -0,0 +1,36 @@ 2.4 +/* 2.5 + * @test /nodynamiccopyright/ 2.6 + * @bug 8020689 2.7 + * @summary Making sure the LineNumberTable entry is correctly generated for the leading method invocation in the else section 2.8 + * @compile T8020689.java 2.9 + * @run main T8020689 2.10 + */ 2.11 + 2.12 +public class T8020689 { 2.13 + 2.14 + public static void main(String... args) { 2.15 + if (args.length > 0) { 2.16 + a(); 2.17 + } else { 2.18 + b(); 2.19 + } 2.20 + } 2.21 + 2.22 + static void a() { 2.23 + } 2.24 + 2.25 + static void b() { 2.26 + assertLine(15); 2.27 + } 2.28 + 2.29 + public static void assertLine(int expectedline) { 2.30 + Exception e = new Exception("expected line#: " + expectedline); 2.31 + int myline = e.getStackTrace()[2].getLineNumber(); 2.32 + if( myline != expectedline) { 2.33 + throw new RuntimeException("Incorrect line number " + 2.34 + "expected: " + expectedline + 2.35 + ", got: " + myline, e); 2.36 + } 2.37 + System.out.format("Got expected line number %d correct %n", myline); 2.38 + } 2.39 +}