Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Inherit null annotations not working for external annotations?
Inherit null annotations not working for external annotations? [message #1741422] Wed, 24 August 2016 20:06 Go to next message
Eclipse UserFriend
Hallo Stephan,

Is this a bug or am I dumb and just using it wrong:

It seems to me that Inherit null annotations are not working for external annotations?

In a @NonNullByDefault package (via package-info.java), for equals(Object obj) in https://github.com/vorburger/eclipse-null-eea-augments/blob/master/examples/eclipse/hello/src/main/java/ch/vorburger/nulls/examples/hello/Hello.java, I'm getting a "The default '@NonNull' conflicts with the inherited '@Nullable' annotation in the overridden method from Object", despite having a working external annotation for java.lang.Object#equals() in https://github.com/vorburger/eclipse-null-eea-augments/blob/master/libraries/java/java/lang/Object.eea, and org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled in https://github.com/vorburger/eclipse-null-eea-augments/blob/master/examples/eclipse/hello/.settings/org.eclipse.jdt.core.prefs#L2

If I change equals(Object obj) to equals(@Nullable Object obj) then the error goes away, of course - but I shouldn't have to, right?

I'm pretty certain that it's not just some sort of basic setup issue, because when I Ctrl-Space to auto-insert equals (after removing it), it proposes it with @Nullable - so JDT clearly knows about the external annotation. In fact, that it proposes @Nullable is another (more minor) bug as well I guess - I'd like my code to be the least cluttered possible, so when Inherit null annotations is on, it shouldn't add @Nullable if not required, agreed?

Shall I open a bugzilla about this (these; want one or two) ?

Regards,
M.
Re: Inherit null annotations not working for external annotations? [message #1745594 is a reply to message #1741422] Wed, 12 October 2016 16:46 Go to previous messageGo to next message
Eclipse UserFriend
I've just bumped into this again, and dug a bit more.. this (of course) has actually nothing at all too do with either package-info.java or EEA anntoation - I can reproduce the same root problem described above with a simple custom interface with a method with a @Nullable argument and a @NonNullByDefault class implementing it ... now opened https://bugs.eclipse.org/bugs/show_bug.cgi?id=505828 about this.
Re: Inherit null annotations not working for external annotations? [message #1746108 is a reply to message #1745594] Fri, 21 October 2016 22:58 Go to previous message
Eclipse UserFriend
> In fact, that it proposes @Nullable is another (more minor) bug as well I guess - I'd like my code to be the least cluttered possible, so when Inherit null annotations is on, it shouldn't add @Nullable if not required, agreed?

==> https://bugs.eclipse.org/bugs/show_bug.cgi?id=443146
Previous Topic:Liferay IDE
Next Topic:Launching JUNIT ... Variable references empty selection
Goto Forum:
  


Current Time: Sat May 17 06:08:26 EDT 2025

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

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

Back to the top