test/tools/javac/jvm/T8020689.java

Mon, 28 Jul 2014 07:23:55 -0700

author
tbell
date
Mon, 28 Jul 2014 07:23:55 -0700
changeset 2482
d63e99f71e83
parent 0
959103a6100f
permissions
-rw-r--r--

Added tag jdk8u20-b25 for changeset 9239118487df

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 }

mercurial