Debian Codegraph @

framework/tests/all-systems/java8/memberref/Receivers.java

raw
1 /** BoundR and unbound constraints. */
2 interface UnboundR {
3 void consume(/*1*/ UnboundR this, /*2*/ MyClass my, String s);
4 }
5
6 interface BoundR {
7 void consume(/*4*/ BoundR this, String s);
8 }
9
10 interface SupplierR<R> {
11 R supply();
12 }
13
14 class MyClass {
15
16 void take(/*6*/ MyClass this, String s) {}
17
18 void context(/*7*/ MyClass my) {
19 /*8*/ UnboundR u1 = /*9*/ MyClass::take;
20 // 2 <: 6 -- like an override
21 // No relation to 1 or 2
22 // No relationship or check for 8 / 9?
23 // Need to check on this.
24
25 u1.consume(my, "");
26 // 7 <: 2
27 // 8 <: 1
28
29 /*10*/ BoundR b1 = /*11*/ my::take;
30 // 7 <: 6 -- like an invocation
31 // No Relationship for 10 / 11?
32
33 b1.consume("");
34 // 10 <: 4
35 }
36 }
37
38 /** Constraints for implicit inner constraints and super. */
39 @SuppressWarnings("lock")
40 class OuterR {
41 class Inner {
42 Inner(/*1*/ OuterR OuterR.this) {}
43
44 void context() {
45 SupplierR<String> o = OuterR.super::toString;
46 }
47 }
48
49 void context(/*2*/ OuterR this) {
50 // This one is unbound and needs an OuterR as a param
51 SupplierR</*3*/ Inner> f = /*4*/ Inner::new;
52 }
53 }