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

Quelle  BadAccess02.java

  Sprache: JAVA
 

/*
 * @test /nodynamiccopyright/
 * @bug 8003280
 * @summary Add lambda tests
 *  check lambda can access only effectively-final locals
 * @author  Maurizio Cimadamore
 * @compile/fail/ref=BadAccess02.out -XDrawDiagnostics BadAccess02.java
 */


public class BadAccess02 {

    interface SAM {
        int m(int h);
    }

    static void test1() {
        int l = 0//effectively final
        int j = 0//non-effectively final
        j = 2;
        final int L = 0;
        SAM s = (int h) -> { int k = 0return h + j + l + L; };
    }

    void test2() {
        int l = 0//effectively final
        int j = 0//non-effectively final
        j = 2;
        final int L = 0;
        SAM s = (int h) -> { int k = 0return h + k + j + l + L; };
    }
}

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

¤ Dauer der Verarbeitung: 0.9 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.