jdk
1/*
2* @test /nodynamiccopyright/
3* @bug 8020689
4* @summary Making sure the LineNumberTable entry is correctly generated for the leading method invocation in the else section
5* @compile T8020689.java
6* @run main T8020689
7*/
8
9public class T8020689 {10
11public static void main(String... args) {12if (args.length > 0) {13a();14} else {15b();16}17}18
19static void a() {20}21
22static void b() {23assertLine(15);24}25
26public static void assertLine(int expectedline) {27Exception e = new Exception("expected line#: " + expectedline);28int myline = e.getStackTrace()[2].getLineNumber();29if( myline != expectedline) {30throw new RuntimeException("Incorrect line number " +31"expected: " + expectedline +32", got: " + myline, e);33}34System.out.format("Got expected line number %d correct %n", myline);35}36}
37