eclipse-null-eea-augments
eclipse-null-eea-augments copied to clipboard
Test illustrating usage of @SuppressWarnings("null")
The @SuppressWarnings("null") should work, based on: https://help.eclipse.org/oxygen/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-suppress_warnings.htm
However currently both on the mvn CLI and in Eclipse IDE UI Photon Milestone 2 (4.8.0M2) this appears to be completely ignored. Even @SuppressWarnings("all") is ignored:
Null type mismatch: required '@NonNull Object' but the provided value is null
This is, I'm guessing, because here we've intentionally configured it to be an Error, not a Warning - which is what we would want for production code. However, one may still want to write a test for it - and suppress it there. Currently this appears to be impossible.
@ctron @maggu2810 @kaikreuzer @sylvainlaurent @kwin anyone got any smart ideas how to do this?
No, you can create a method that returns an as non-null marked null, but this is a workaround around the whole nullness check.
I had already seen this problem with eclipse but have no solution :-( I suggest you add some comment to your HelloTest class to explain the situation you are reproducing.
I don't understand why Travis CI fails: it seems it tries to build the wrong commit??
OK, I understood : Travis performs a temp merge with master and builds the result... And the build fails because of what @vorburger shows: the compiler produces an error despite the SuppressWarnings... my bad...
@vorburger what do you want to do with this PR. is it still relevant? it currently fails because passing a null value triggers a compiler error not a warning and thus cannot be suppressed by @SuppressWarnings("null")