When I run ‘mvn validate’ on openhab-core, I get warnings like this:
[WARNING] /home/steve/Projects/openhab/openhab-core/bundles/org.openhab.core/src/main/java/org/eclipse/smarthome/core/common/registry/AbstractProvider.java:[75,2517] Null type mismatch (type annotations): 'null' is not compatible to the free type variable 'E'
In AbstractProvider.java there are two functions like this
private void notifyListeners(E oldElement, E element, EventType eventType) {
…
}
and
private void notifyListeners(E element, EventType eventType) {
notifyListeners(null, element, eventType);
}
So I guessed that somewhere type E has been declared @Nonnullable. I tried to fix this by changing the 1st function to:
private void notifyListeners(@nullable E oldElement, E element, EventType eventType) {
which turned the warning into this INFO msg
[INFO] /home/steve/Projects/openhab/openhab-core/bundles/org.openhab.core/src/main/java/org/eclipse/smarthome/core/internal/scheduler/DelegatedSchedulerImpl.java:[55,2011] Unsafe interpretation of method return type as '@NonNull' based on the receiver type 'Iterator<@NonNull ScheduledCompletableFuture<?>>'. Type 'Iterator<E>' doesn't seem to be designed with null type annotations in mind
and eventually an error:
[ERROR] /home/steve/Projects/openhab/openhab-core/bundles/org.openhab.core/src/main/java/org/eclipse/smarthome/core/common/registry/AbstractProvider.java:[51,1500] nullable cannot be resolved to a type
So what is the “correct” way to get rid of the warnings? This is just one example out of many.
I’m a java novice so go easy on me:
Steve