langtools/test/tools/javac/lambda/LambdaConv27.java
author mcimadamore
Wed, 17 Jul 2013 14:04:01 +0100
changeset 18909 8f9fc5d876e4
parent 16308 a0658c36f717
permissions -rw-r--r--
8012242: Lambda compatibility and checked exceptions Summary: Inference variables in 'throws' clause with no constraints should be inferred as RuntimeException Reviewed-by: jjg, vromero
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16308
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
     1
/*
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
     4
 *
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
     7
 * published by the Free Software Foundation.
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
     8
 *
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    13
 * accompanied this code).
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    14
 *
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    18
 *
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    21
 * questions.
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    22
 */
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    23
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    24
/*
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    25
 * @test
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    26
 * @bug 8008227
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    27
 * @summary Mixing lambdas with anonymous classes leads to NPE thrown by compiler
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    28
 * @run main LambdaConv27
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    29
 */
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    30
public class LambdaConv27 {
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    31
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    32
     public static void main(String[] args) {
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    33
         SAM s = ()-> { SAM s2 = ()->{ new Object() { }; }; s2.m(); };
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    34
         s.m();
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    35
     }
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    36
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    37
     interface SAM {
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    38
         void m();
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    39
     }
a0658c36f717 8008227: Mixing lambdas with anonymous classes leads to NPE thrown by compiler
mcimadamore
parents:
diff changeset
    40
}