test/tools/javac/jvm/T7024096.java

Wed, 23 Jan 2013 20:57:40 +0000

author
vromero
date
Wed, 23 Jan 2013 20:57:40 +0000
changeset 1520
5c956be64b9e
parent 0
959103a6100f
permissions
-rw-r--r--

8006694: temporarily workaround combo tests are causing time out in several platforms
Reviewed-by: jjg
Contributed-by: maurizio.cimadamore@oracle.com

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 }

mercurial