Bug 405086 - [quick fix] don't propose null annotations when those are disabled
Summary: [quick fix] don't propose null annotations when those are disabled
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.3   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.3 M7   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-06 15:49 EDT by Stephan Herrmann CLA
Modified: 2013-04-24 10:54 EDT (History)
1 user (show)

See Also:


Attachments
proposed fix (9.89 KB, patch)
2013-04-06 19:04 EDT, Stephan Herrmann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Herrmann CLA 2013-04-06 15:49:43 EDT
Looking at QuickFixProcessor.process() two kinds of problems could actually
trigger insertion of null annotations while annotation-based null analysis
is disabled:

 IProblem.NonNullLocalVariableComparisonYieldsFalse

 IProblem.RedundantNullCheckOnNonNullLocalVariable

Checks should be inserted to prevent bogus proposals.

Even if null annotations are enabled, some proposals offered on this route
don't make much sense, I'm afraid.


I'll investigate.
Comment 1 Stephan Herrmann CLA 2013-04-06 19:04:21 EDT
Created attachment 229402 [details]
proposed fix

Proposed solution in two small steps:

- check enablement of annotation-based null analysis (the original issue)

- migrate from the two mentions IProblems to their newer counter-parts
  since bug 365859, which already ensure that a null annotation was the
  reason behind the problem

Included tests & another tiny logic bug.

Note, that this patch was created on top of the patch in bug 400668.
Comment 2 Dani Megert CLA 2013-04-24 10:54:49 EDT
Thanks for the patch.

Committed with http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=17c7783177bc359beb03a7575237fd347cc3ba49 together with other fixes.