test/langtools/tools/javac/T8207320/IntersectionOrderTest2.java
author vromero
Wed, 15 Aug 2018 13:39:32 -0700
changeset 51416 8c2faee50bc4
permissions -rw-r--r--
8207320: Wrong type order for intersection lambdas with multiple abstract methods Reviewed-by: mcimadamore
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
51416
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
     1
/*
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
     2
 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
     4
 *
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
     7
 * published by the Free Software Foundation.
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
     8
 *
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    13
 * accompanied this code).
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    14
 *
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    18
 *
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    21
 * questions.
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    22
 */
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    23
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    24
/*
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    25
 * @test 8207320
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    26
 * @summary Wrong type order for intersection lambdas with multiple abstract methods
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    27
 */
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    28
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    29
public class IntersectionOrderTest2 {
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    30
    interface A {
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    31
        void a();
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    32
    }
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    33
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    34
    interface B {
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    35
        void b();
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    36
    }
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    37
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    38
    interface C {
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    39
        void c();
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    40
    }
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    41
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    42
    interface AB extends A, B {
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    43
        @Override
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    44
        default void a() {
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    45
            System.out.println("A");
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    46
        }
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    47
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    48
        @Override
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    49
        default void b() {
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    50
            System.out.println("B");
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    51
        }
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    52
    }
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    53
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    54
    public static void main(String[] args) {
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    55
        Runnable a = ((A & B & AB & C) () -> System.out.println("Called"))::b;
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    56
        a.run();
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    57
    }
8c2faee50bc4 8207320: Wrong type order for intersection lambdas with multiple abstract methods
vromero
parents:
diff changeset
    58
}