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