Community
Participate
Working Groups
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".
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.
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?