Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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] Thu, 25 August 2016 00:06 Go to next message
Michael Vorburger is currently offline Michael VorburgerFriend
Messages: 103
Registered: July 2009
Senior Member
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 20:46 Go to previous messageGo to next message
Michael Vorburger is currently offline Michael VorburgerFriend
Messages: 103
Registered: July 2009
Senior Member
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] Sat, 22 October 2016 02:58 Go to previous message
Michael Vorburger is currently offline Michael VorburgerFriend
Messages: 103
Registered: July 2009
Senior Member
> 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 Oct 12 03:35:23 GMT 2024

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

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

Back to the top