langtools/test/tools/javac/foreach/7139681/T7139681neg.java
author mcimadamore
Thu, 06 Jun 2013 15:32:41 +0100
changeset 18379 8dd20756448c
permissions -rw-r--r--
7139681: Enhanced for loop: local variable scope inconsistent with JLS Summary: For-each loop variable is incorrectly visible from the for-each expression Reviewed-by: jjg, vromero

/*
 * @test /nodynamiccopyright/
 * @bug 7139681
 * @summary Enhanced for loop: local variable scope inconsistent with JLS
 *
 * @compile/fail/ref=T7139681neg.out -XDrawDiagnostics T7139681neg.java
 */
class T7139681neg {
    void testArray() {
        for (int a : a) { }
    }

    void testIterable() {
        for (Integer b : b) { }
    }
}