Skip to content

SC: invalid method reference produces NPE #1191

@eric-milles

Description

@eric-milles

Consider the following:

void m(java.util.function.Function<String, Integer> f) {
}
@groovy.transform.CompileStatic
void test() {
  m(Object::sleep)
}

The method reference Object::sleep is not a match for the functional interface Function<String,Integer>. The compiler currently throws NPE within StaticTypesMethodReferenceExpressionWriter for this case.

image

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions