mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
8187443: Forest Consolidation: Move files to unified layout
Reviewed-by: darcy, ihse
This commit is contained in:
parent
270fe13182
commit
3789983e89
56923 changed files with 3 additions and 15727 deletions
67
test/langtools/tools/javac/lambda/MethodReference22.java
Normal file
67
test/langtools/tools/javac/lambda/MethodReference22.java
Normal file
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8003280
|
||||
* @summary Add lambda tests
|
||||
* check that pair of bound/non-bound method references checked correctly
|
||||
* @author Maurizio Cimadamore
|
||||
* @compile/fail/ref=MethodReference22.out -XDrawDiagnostics MethodReference22.java
|
||||
*/
|
||||
|
||||
class MethodReference22 {
|
||||
|
||||
void m1(String x) { }
|
||||
void m1(MethodReference22 rec, String x) { }
|
||||
|
||||
static void m2(String x) { }
|
||||
static void m2(MethodReference22 rec, String x) { }
|
||||
|
||||
static void m3(String x) { }
|
||||
void m3(MethodReference22 rec, String x) { }
|
||||
|
||||
void m4(String x) { }
|
||||
static void m4(MethodReference22 rec, String x) { }
|
||||
|
||||
interface SAM1 {
|
||||
void m(String x);
|
||||
}
|
||||
|
||||
interface SAM2 {
|
||||
void m(MethodReference22 rec, String x);
|
||||
}
|
||||
|
||||
static void call1(SAM1 s) { }
|
||||
|
||||
static void call2(SAM2 s) { }
|
||||
|
||||
static void call3(SAM1 s) { }
|
||||
static void call3(SAM2 s) { }
|
||||
|
||||
static void test1() {
|
||||
SAM1 s1 = MethodReference22::m1; //fail
|
||||
call1(MethodReference22::m1); //fail
|
||||
SAM1 s2 = MethodReference22::m2; //ok
|
||||
call1(MethodReference22::m2); //ok
|
||||
SAM1 s3 = MethodReference22::m3; //ok
|
||||
call1(MethodReference22::m3); //ok
|
||||
SAM1 s4 = MethodReference22::m4; //fail
|
||||
call1(MethodReference22::m4); //fail
|
||||
}
|
||||
|
||||
static void test2() {
|
||||
SAM2 s1 = MethodReference22::m1; //ok
|
||||
call2(MethodReference22::m1); //ok
|
||||
SAM2 s2 = MethodReference22::m2; //ok
|
||||
call2(MethodReference22::m2); //ok
|
||||
SAM2 s3 = MethodReference22::m3; //fail
|
||||
call2(MethodReference22::m3); //fail
|
||||
SAM2 s4 = MethodReference22::m4; //fail
|
||||
call2(MethodReference22::m4); //fail
|
||||
}
|
||||
|
||||
static void test3() {
|
||||
call3(MethodReference22::m1); //ok
|
||||
call3(MethodReference22::m2); //ambiguous
|
||||
call3(MethodReference22::m3); //ok
|
||||
call3(MethodReference22::m4); //fail
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue