Fri, 02 Sep 2011 07:54:16 -0700
7024096: Stack trace has invalid line numbers
Reviewed-by: jjg, darcy
Contributed-by: bruce.chapman.nz@gmail.com
src/share/classes/com/sun/tools/javac/jvm/Gen.java | file | annotate | diff | comparison | revisions | |
test/tools/javac/jvm/T7024096.java | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Gen.java Thu Sep 01 14:35:59 2011 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Gen.java Fri Sep 02 07:54:16 2011 -0700 1.3 @@ -1689,6 +1689,8 @@ 1.4 // outer instance of a super(...) call appears as first parameter). 1.5 genArgs(tree.args, 1.6 TreeInfo.symbol(tree.meth).externalType(types).getParameterTypes()); 1.7 + code.statBegin(tree.pos); 1.8 + code.markStatBegin(); 1.9 result = m.invoke(); 1.10 } 1.11
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/test/tools/javac/jvm/T7024096.java Fri Sep 02 07:54:16 2011 -0700 2.3 @@ -0,0 +1,31 @@ 2.4 +/* 2.5 + * @test /nodynamiccopyright/ 2.6 + * @bug 7024096 2.7 + * @summary Stack trace has invalid line numbers 2.8 + * @author Bruce Chapman 2.9 + * @compile T7024096.java 2.10 + * @run main T7024096 2.11 + */ 2.12 + 2.13 +public class T7024096 { 2.14 + private static final int START = 14; // starting line number for the test 2.15 + public static void main(String[] args) { 2.16 + T7024096 m = new T7024096(); 2.17 + m.nest(START); 2.18 + m.nest(START + 1, m.nest(START + 1), m.nest(START + 1), 2.19 + m.nest(START + 2), 2.20 + m.nest(START + 3, m.nest(START + 3))); 2.21 + } 2.22 + 2.23 + public T7024096 nest(int expectedline, T7024096... args) { 2.24 + Exception e = new Exception("expected line#: " + expectedline); 2.25 + int myline = e.getStackTrace()[1].getLineNumber(); 2.26 + if( myline != expectedline) { 2.27 + throw new RuntimeException("Incorrect line number " + 2.28 + "expected: " + expectedline + 2.29 + ", got: " + myline, e); 2.30 + } 2.31 + System.out.format("Got expected line number %d correct %n", myline); 2.32 + return null; 2.33 + } 2.34 +}