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 7024096 |
aoqi@0 | 4 | * @summary Stack trace has invalid line numbers |
aoqi@0 | 5 | * @author Bruce Chapman |
aoqi@0 | 6 | * @compile T7024096.java |
aoqi@0 | 7 | * @run main T7024096 |
aoqi@0 | 8 | */ |
aoqi@0 | 9 | |
aoqi@0 | 10 | public class T7024096 { |
aoqi@0 | 11 | private static final int START = 14; // starting line number for the test |
aoqi@0 | 12 | public static void main(String[] args) { |
aoqi@0 | 13 | T7024096 m = new T7024096(); |
aoqi@0 | 14 | m.nest(START); |
aoqi@0 | 15 | m.nest(START + 1, m.nest(START + 1), m.nest(START + 1), |
aoqi@0 | 16 | m.nest(START + 2), |
aoqi@0 | 17 | m.nest(START + 3, m.nest(START + 3))); |
aoqi@0 | 18 | } |
aoqi@0 | 19 | |
aoqi@0 | 20 | public T7024096 nest(int expectedline, T7024096... args) { |
aoqi@0 | 21 | Exception e = new Exception("expected line#: " + expectedline); |
aoqi@0 | 22 | int myline = e.getStackTrace()[1].getLineNumber(); |
aoqi@0 | 23 | if( myline != expectedline) { |
aoqi@0 | 24 | throw new RuntimeException("Incorrect line number " + |
aoqi@0 | 25 | "expected: " + expectedline + |
aoqi@0 | 26 | ", got: " + myline, e); |
aoqi@0 | 27 | } |
aoqi@0 | 28 | System.out.format("Got expected line number %d correct %n", myline); |
aoqi@0 | 29 | return null; |
aoqi@0 | 30 | } |
aoqi@0 | 31 | } |