langtools/test/tools/javac/cast/6219964/T6219964.java
author hannesw
Tue, 22 Mar 2016 14:23:16 +0100
changeset 36690 06b714373aa4
parent 24796 f940af3221e2
child 39674 de3b0e52ca17
permissions -rw-r--r--
8151810: for-in iteration does not provide per-iteration scope Reviewed-by: attila, lagergren

/*
 * @test    /nodynamiccopyright/
 * @bug     6219964
 * @summary Compiler allows illegal cast of anonymous inner class
 * @compile/fail/ref=T6219964.out -XDrawDiagnostics  T6219964.java
 */

public class T6219964 {
    interface I { }
    void foo() {
        new Object() {
            I bar() {
                return (I)this;
            }
        };
    }
}