Weirdness with jsr305 annotations [message #1828239] |
Thu, 04 June 2020 15:18 |
Henry Loenwind Messages: 1 Registered: June 2020 |
Junior Member |
|
|
I recently set up a fresh Eclipse install (2020-03) on a new laptop and found some weirdness in comparison to my old setup (Oxygen) on my main workstation.
I have package annotations:
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package crazypants.enderio.base.config.recipes.xml;
and in a class inside that package I have:
public @Nullable Ingredient getRecipeObject() {
return nullItem ? null : thing.asIngredient();
}
Now Eclipse give me a warning about "Null type mismatch: required '@Nonnull Ingredient' but the provided value is inferred as @Nullable" with a quick fix of "Change return type of 'getRecipeObject(..)' to '@Nullable'" (which obviously changes nothing).
Same goes for a whole library that is package-annotated that way; all explicit Nullable annotations are ignored.
So, did I mess up something when setting up the new workspace or was there something changed in Eclipse? And if it's the latter: What can I do about it? (I only have one package where I use package annotations, that's easy to change. But the whole 3rd-party framework is set up that way, that's not something I can change.)
--
Warnings setup: https://github.com/SleepyTrousers/EnderIO/tree/master/doc/eclicpse%20warnings%20settings
|
|
|
Powered by
FUDForum. Page generated in 0.02260 seconds