Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Weirdness with jsr305 annotations(package overrules explicit annotation?)
Weirdness with jsr305 annotations [message #1828239] Thu, 04 June 2020 15:18
Henry Loenwind is currently offline Henry LoenwindFriend
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
Previous Topic:Tools and frameworks for the modern Java developer
Next Topic:Cannot connect to VM
Goto Forum:
  


Current Time: Sun Oct 25 14:52:01 GMT 2020

Powered by FUDForum. Page generated in 0.02130 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top