Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undetected @Nullable annotation in a method reference #1128

Open
sdeleuze opened this issue Jan 13, 2025 · 0 comments
Open

Undetected @Nullable annotation in a method reference #1128

sdeleuze opened this issue Jan 13, 2025 · 0 comments

Comments

@sdeleuze
Copy link

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
@sdeleuze sdeleuze changed the title Undetected @Nullable annotation in a default method reference Undetected @Nullable annotation in a method reference Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant