Skip to content

Undetected @Nullable annotation in a method reference #1128

Open
@sdeleuze

Description

With the JSpecify mode enabled, I have this interface:

public interface WebFluxConfigurer {

	default @Nullable WebSocketService getWebSocketService() {
		return null;
	}
}

And:

	public @Nullable WebSocketService getWebSocketService() {
		return createSingleBean(WebFluxConfigurer::getWebSocketService, WebSocketService.class);
	}

	private <T> @Nullable T createSingleBean(Function<WebFluxConfigurer, @Nullable T> factory, Class<T> beanType) {
		// ...
	}

I get the following IMO invalid error:

error: [NullAway] Cannot pass parameter of type Function<WebFluxConfigurer, WebSocketService>, as formal parameter has type Function<WebFluxConfigurer, @org.jspecify.annotations.Nullable T>, which has mismatched type parameter nullability

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions