I've discovered some weird behaviour which I canno...
# intellij
k
I've discovered some weird behaviour which I cannot wrap my head around. Semanthically the code doesn't make much sense, I just came across it accidentally, so I d like to know an explanation for this behaviour. IDEA complains about the following method not implementing the method from the implemented interface and it is suggesting me to change the parameter to be nun-nullable. But it still compiles.. And when I copy that spring interface into my own class keeping it exactly the same, just different name then it doesn't complain and it is the oposite - it complains when I make the parameter non-nullable, it suggestes to make it nullable then
Copy code
@FunctionalInterface
public interface ApplicationListener<E extends ApplicationEvent> extends EventListener {

	void onApplicationEvent(E event);

	static <T> ApplicationListener<PayloadApplicationEvent<T>> forPayload(Consumer<T> consumer) {
		return event -> consumer.accept(event.getPayload());
	}

}
technically, using
ApplicationEvent?
as the type parameter for
E
doesn't make much sense because it is a super type of
ApplicationEvent
not a subtype.. but it is possible because of the java interoperability and it compiles, it is really just IDEA complaining and just for this original Spring interface, I m not able to reproduce it with handcrafted interface O.o