Closed wborn closed 2 months ago
Version 2.4.0 release: https://github.com/lastnpe/eclipse-null-eea-augments/releases/tag/v2.4.0 Isn't this allready upgraded?
Well, i'm no maintainer, but i would suggest we upgrade this as part of 4.0.0? Especially because binding codeowners might refactor their bindings to move to java 17. A good moment to also check these null annotations
Can we somehow prevent lastnpe to check 3rdparty libs?
\bundles\org.openhab.binding.smsmodem\src\3rdparty\java\org\smslib\driver\AbstractModemDriver.java:[66,42] Null type mismatch: required 'java.io.@NonNull InputStream' but the provided value is inferred as @org.eclipse.jdt.annotation.Nullable
Can we somehow prevent lastnpe to check 3rdparty libs?
It's a compilation error generated by the compiler and AFAIK you can't disable these for certain dirs/files or use some annotation to suppress them.
There is a new release we should upgrade to:
https://github.com/lastnpe/eclipse-null-eea-augments/releases/tag/v2.3.0
I already upgraded to this version in the other repos. For the add-ons it is a bit more work.
The reason is that the new version fixes that
Optional.orElse
can returnnull
values (based on the parameter). There is quite some code usingOptional.orElse
expecting the result to be non-null.One way could be to use a workaround like enclosing such statements with
Objects.requireNonNull(..)
.Another fix could be to rewrite such code to not use optionals. IMHO we should use only one way to prevent NPEs (the annotations) and use
Optional
s only where they make sense such as withStream
s.WDYT @openhab/add-ons-maintainers?