|
Java example source code file (T8020689.java)
The T8020689.java Java example source code/* * @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); } } Other Java examples (source code examples)Here is a short list of links related to this Java T8020689.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.