langtools/test/tools/javac/lambda/MethodReferenceStaticNotAccessibleTest.java
author vromero
Wed, 09 Dec 2015 12:50:41 -0800
changeset 34566 071e47e4ae75
permissions -rw-r--r--
8136809: Javac fails compiling Collectors.reducing with method reference combiner Reviewed-by: mcimadamore
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34566
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
     1
/*
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
     4
 *
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
     7
 * published by the Free Software Foundation.
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
     8
 *
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    13
 * accompanied this code).
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    14
 *
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    18
 *
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    21
 * questions.
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    22
 */
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    23
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    24
/*
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    25
 * @test
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    26
 * @bug 8136809
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    27
 * @summary Javac fails compiling Collectors.reducing with method reference combiner
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    28
 * @compile MethodReferenceStaticNotAccessibleTest.java
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    29
 */
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    30
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    31
import java.util.function.BinaryOperator;
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    32
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    33
class MethodReferenceStaticNotAccessibleTest_Foo {
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    34
    MethodReferenceStaticNotAccessibleTest_Foo m(MethodReferenceStaticNotAccessibleTest_Foo foo) { return null; }
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    35
    private static void m(MethodReferenceStaticNotAccessibleTest_Foo foo1, MethodReferenceStaticNotAccessibleTest_Foo foo2) {}
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    36
}
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    37
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    38
public class MethodReferenceStaticNotAccessibleTest {
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    39
    <T> void m(T t, BinaryOperator<T> binop) {}
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    40
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    41
    void test(MethodReferenceStaticNotAccessibleTest_Foo foo) {
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    42
        m(foo, MethodReferenceStaticNotAccessibleTest_Foo::m);
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    43
    }
071e47e4ae75 8136809: Javac fails compiling Collectors.reducing with method reference combiner
vromero
parents:
diff changeset
    44
}