Bug 354366 - Codan QuickFix only sometimes shown when clicking on marker
Summary: Codan QuickFix only sometimes shown when clicking on marker
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-editor (show other bugs)
Version: 8.0   Edit
Hardware: PC Linux
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-10 08:07 EDT by Lukas Felber CLA
Modified: 2020-09-04 15:19 EDT (History)
3 users (show)

See Also:


Attachments
fix+test for this issue. (9.56 KB, patch)
2011-08-10 08:20 EDT, Lukas Felber CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas Felber CLA 2011-08-10 08:07:44 EDT
Build Identifier: M20100909-0800

Given a code line that uses an undeclared variable (e.g. "i = 7" in a function), after compiling, one gets two markers on this line. One says "Symbol 'i' could not be resolved" and the other "'i' was not declared in this scope". The first one's icon (codan marker) is on top. When clicking on the marker, one sometimes gets a list of completion-proposals (generated by the codan marker). Sometimes, one gets nothing.

Reproducible: Always

Steps to Reproduce:
1. create code file: ->codan-marker "Symbol 'i' could not be resolved will appear
int main() {
  i = 7 ;
}
2. build the project -> marker "'i' was not declared in this scope" apears on same line. 
3.click on marker. most of the times one gets no completion-proposals. Sometimes one gets "create local variable" and "create parameter".
Comment 1 Lukas Felber CLA 2011-08-10 08:20:01 EDT
Created attachment 201235 [details]
fix+test for this issue.

The problem here arises by the implementation of CSelectAnnotationRulerAction.findCAnnotation() when using AbstractMarkerAnnotationModel.getAnnotationIterator() which is based on a HashMap hence returning marker annotations in "random" order and the fact, that the codan marker as well as the one generated from the parser reside both on presentation layer 6 (see attribute "presentationLayer" of extension point "org.eclipse.ui.editors.markerAnnotationSpecification").

The attached patch (including test case) fixes the problem.
Comment 2 Nathan Ridge CLA 2015-12-15 20:46:20 EST
I think this may have been addressed by bug 473577.

However, your patch includes a nice test suite! Would you like to submit it for review via Gerrit?