Bug 482220 - [compiler][null] NP analysis doesn't work if NP annotation types do not match
Summary: [compiler][null] NP analysis doesn't work if NP annotation types do not match
Status: CLOSED DUPLICATE of bug 369079
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.6   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-15 11:03 EST by Andrey Loskutov CLA
Modified: 2015-11-16 19:41 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Loskutov CLA 2015-11-15 11:03:30 EST
Project using different NP annotations as the project it depends on does not see any NP violations coming from the parent project.

JGit decided to use it's own Nullable annotation but EGit already used JDT version. So annotating classes in JGit with their own version of Nullable has no effect on code in EGit. EGit code which uses the "Nullable" return values from JGit without NP checks is not marked with any NP error markers from JDT.

Example: clone jgit & egit repositories.

https://git.eclipse.org/r/jgit/jgit.git
https://git.eclipse.org/r/egit/egit.git

Annotate method Ref getRef(String) as Nullable in JGit (org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java:912).

There are few errors reported in JGit (on commit 070bf8d15f8659cb5f6a039b070b19909dd2f49f) but no errors reported in EGit (on commit 1b519b6544b4ba4fc1bb31a68d0ad2edbf18e380). Checkout next commit which changed EGit Nullable to be the same as in JGit (commit b3596711ae6533669dcd948a24cad252728103d9 in EGit), do a full compile on org.eclipse.egit.ui, et voila: there are NP errors!

This is pretty bad issue, because every one assumes there are safety net but there  is no one and also no errors are reported.

I'm using 4.6 Build id: I20151110-0800 on Java 8.
Comment 1 Stephan Herrmann CLA 2015-11-16 19:41:45 EST
You're asking for an option to configure several sets of null annotations, right?

*** This bug has been marked as a duplicate of bug 369079 ***