checker/tests/nullness/java8/methodref/FromByteCode.java
raw| 1 | import org.checkerframework.checker.nullness.qual.*; |
| 2 | |
| 3 | interface FunctionBC<T extends @Nullable Object, R> { |
| 4 | R apply(T t); |
| 5 | } |
| 6 | |
| 7 | class FromByteCode { |
| 8 | |
| 9 | FunctionBC<String, String> f1 = String::toString; |
| 10 | |
| 11 | // Make sure there aren't any issues generating an error with a method from byte code |
| 12 | // :: error: (methodref.param.invalid) |
| 13 | FunctionBC<@Nullable String, String> f2 = String::new; |
| 14 | } |