File: T8020689.java

package info (click to toggle)
libnb-javaparser-java 9%2B2018-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 65,172 kB
  • sloc: java: 440,096; xml: 6,359; sh: 865; makefile: 314
file content (36 lines) | stat: -rw-r--r-- 960 bytes parent folder | download | duplicates (18)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
 * @test  /nodynamiccopyright/
 * @bug 8020689
 * @summary Making sure the LineNumberTable entry is correctly generated for the leading method invocation in the else section
 * @compile T8020689.java
 * @run main T8020689
 */

public class T8020689 {

    public static void main(String... args) {
        if (args.length > 0) {
            a();
        } else {
            b();
        }
    }

    static void a() {
    }

    static void b() {
        assertLine(15);
    }

    public static void assertLine(int expectedline) {
        Exception e = new Exception("expected line#: " + expectedline);
        int myline = e.getStackTrace()[2].getLineNumber();
        if( myline != expectedline) {
            throw new RuntimeException("Incorrect line number " +
                    "expected: " + expectedline +
                    ", got: " + myline, e);
        }
        System.out.format("Got expected line number %d correct %n", myline);
    }
}