langtools/test/tools/javac/lambda/MethodReference26.java
author mcimadamore
Tue, 12 Mar 2013 16:02:13 +0000
changeset 16340 3c0af3413e0f
parent 15374 fb8f6acf09cc
child 22448 a85fbad9d687
permissions -rw-r--r--
8008540: Constructor reference to non-reifiable array should be rejected 8008539: Spurious error when constructor reference mention an interface type 8008538: Constructor reference accepts wildcard parameterized types Summary: Overhaul of Check.checkConstructorRefType Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14547
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     1
/*
15374
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
     2
 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
     4
 *
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
     7
 * published by the Free Software Foundation.
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
     8
 *
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
    13
 * accompanied this code).
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
    14
 *
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
    18
 *
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
    21
 * questions.
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
    22
 */
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
    23
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
    24
/*
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
    25
 * @test
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
    26
 * @summary check strict method conversion allows loose method reference conversion
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
    27
 * @compile MethodReference26.java
14547
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    28
 */
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    29
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    30
class MethodReference26 {
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    31
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    32
    static void m(Integer i) { }
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    33
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    34
    interface SAM {
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    35
        void m(int x);
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    36
    }
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    37
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    38
    static void call(int i, SAM s) {   }
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    39
    static void call(Integer i, SAM s) {   }
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    40
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    41
    static void test() {
15374
fb8f6acf09cc 8005244: Implement overload resolution as per latest spec EDR
mcimadamore
parents: 14547
diff changeset
    42
        call(1, MethodReference26::m); //ok
14547
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    43
    }
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    44
}