| 1 |
import org.checkerframework.checker.nullness.qual.*; |
| 2 |
|
| 3 |
// The return of a lambda is a lambda |
| 4 |
|
| 5 |
interface ConsumerSupplier { |
| 6 |
ConsumerR get(); |
| 7 |
} |
| 8 |
|
| 9 |
interface ConsumerR { |
| 10 |
void method(@Nullable String s); |
| 11 |
} |
| 12 |
|
| 13 |
interface SupplierSupplier { |
| 14 |
SupplierRe get(); |
| 15 |
} |
| 16 |
|
| 17 |
interface SupplierRe { |
| 18 |
@NonNull String method(); |
| 19 |
} |
| 20 |
|
| 21 |
class MetaReturn { |
| 22 |
|
| 23 |
// :: error: (dereference.of.nullable) |
| 24 |
ConsumerSupplier t1 = () -> (s) -> s.toString(); |
| 25 |
ConsumerSupplier t2 = |
| 26 |
() -> { |
| 27 |
return (String s) -> { |
| 28 |
// :: error: (dereference.of.nullable) |
| 29 |
s.toString(); |
| 30 |
}; |
| 31 |
}; |
| 32 |
|
| 33 |
SupplierSupplier t3 = |
| 34 |
() -> { |
| 35 |
// :: error: (return.type.incompatible) |
| 36 |
return () -> null; |
| 37 |
}; |
| 38 |
|
| 39 |
SupplierSupplier t4 = |
| 40 |
() -> { |
| 41 |
return ""::toString; |
| 42 |
}; |
| 43 |
} |