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

Quelle  LambdaExpr19.java

  Sprache: JAVA
 

/*
 * @test /nodynamiccopyright/
 * @bug 8003280
 * @summary Add lambda tests
 *  check that inner scopes are left after a lambda check exception has been thrown
 * @compile/fail/ref=LambdaExpr19.out -XDrawDiagnostics LambdaExpr19.java
 */

class LambdaExpr19 {

    interface SAM {
        String m();
    }

    void m(SAM s) { }

    void testTry() {
        m(() -> {
                try { return 1; }
                catch (Exception e) { }
            });
    }

    void testTryWithResources() {
        m(() -> {
                try (AutoCloseable c = null) { return 1; }
                catch (Exception e) { }
            });
    }

    void testSwitch() {
        m(() -> {
                switch (1) {
                    defaultreturn 1;
                }
            });
    }

    void testFor() {
        m(() -> {
                for (;;) {
                    return 1;
                }
            });
    }

    void testForeach() {
        m(() -> {
                for (Object o : new Object[] { null , null }) {
                    return 1;
                }
            });
    }
}

Messung V0.5 in Prozent
C=96 H=96 G=95

¤ Dauer der Verarbeitung: 0.0 Sekunden  (vorverarbeitet am  2026-06-05) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

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.