Community
Participate
Working Groups
While adding an IJavaCompletionProposal of my own I discovered an issue with org.eclipse.jdt.ui.text.java.CompletionProposalComparator#compare. I want my proposal to show up below the "normal" Java and spelling-correction proposals but above the spelling-correction "meta-proposals" like 'disable spell checking', 'add word', etc. I hence picked a relevance of IProposalRelevance.DISABLE_SPELL_CHECKING + 1. Unfortunately, this sometimes causes my proposal to be shown *above* the normal Java proposals and sometimes below. The problem is this snippet from CompletionProposalComparator#compare: int r1= getRelevance(p1); int r2= getRelevance(p2); int relevanceDif= r2 - r1; if (relevanceDif != 0) { return relevanceDif; } Taking the difference is prone to overflow/underflow. The implementation should probably just use Integer#compare (available since Java 1.7). I think this issue went unnoticed because Java and spelling-correction proposals are normally not shown simultaneously, but that's just a guess. Also, the Javadoc of IJavaCompletionProposal#getRelevance really should not advocate an interval of [0, 1000] anymore as JDT itself doesn't adhere to it anymore (cf. IProposalRelevance's constants).
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.