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

Quelle  BadAccess.java

  Sprache: JAVA
 

/*
 * @test /nodynamiccopyright/
 * @bug 8003280
 * @summary Add lambda tests
 *  check that non-static variables are not accessible from static lambdas
 * @author  Maurizio Cimadamore
 * @compile/fail/ref=BadAccess.out -XDrawDiagnostics BadAccess.java
 */


public class BadAccess {

    int i;
    static int I;

    interface SAM {
        int m();
    }

    static void test1() {
        int l = 0//effectively final
        final int L = 0;
        SAM s = ()-> i + I + l + L;
    }

    void test2() {
        int l = 0//effectively final
        final int L = 0;
        SAM s = ()-> i + I + l + L;
    }
}

Messung V0.5 in Prozent
C=88 H=93 G=90

¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet am  2026-06-10) ¤

*© 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.