Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Java/Openjdk/test/langtools/tools/javac/jvm/   (Sun/Oracle ©)  Datei vom 13.11.2022 mit Größe 1 kB image not shown  

Quelle  T7024096.java   Sprache: JAVA

 
/*
 * @test  /nodynamiccopyright/
 * @bug 7024096
 * @summary Stack trace has invalid line numbers
 * @author Bruce Chapman
 * @compile T7024096.java
 * @run main T7024096
 */


public class T7024096 {
    private static final int START = 14; // starting line number for the test
    public static void main(String[] args) {
        T7024096 m = new T7024096();
        m.nest(START);
        m.nest(START + 1, m.nest(START + 1), m.nest(START + 1),
            m.nest(START + 2),
            m.nest(START + 3, m.nest(START + 3)));
    }

    public T7024096 nest(int expectedline, T7024096... args) {
        Exception e = new Exception("expected line#: " + expectedline);
        int myline = e.getStackTrace()[1].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);
        return null;
    }
}

Messung V0.5
C=90 H=92 G=90

¤ Dauer der Verarbeitung: 0.15 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.