Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 338467 - Codan calls "before" and "after" even for checkers that are not supposed to run in a launch mode
Summary: Codan calls "before" and "after" even for checkers that are not supposed to r...
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-codan (show other bugs)
Version: 8.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 8.0   Edit
Assignee: Sergey Prigogin CLA
QA Contact: Elena Laskavaia CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-28 15:54 EST by Alex Ruiz CLA
Modified: 2012-05-22 14:56 EDT (History)
3 users (show)

See Also:


Attachments
Proposed patch (1.94 KB, text/plain)
2011-02-28 15:55 EST, Alex Ruiz CLA
no flags Details
Improved version of patch submitted earlier (1.93 KB, patch)
2011-03-04 18:14 EST, Alex Ruiz CLA
eclipse.sprigogin: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Ruiz CLA 2011-02-28 15:54:39 EST
Build Identifier: 20110204-0611

When processing an IResource (method processResource(IResource, IProgressMonitor, Object, CheckerLaunchMode)) CodanBuilder currently checks:
1. that the checker is enabled for a context (i.e. the IResource)
2. asks the CheckersRegistry if a checker is enabled for a launch mode

The problem is #2. This check only verifies that the IProblems a checker provides are enabled for a particular launch mode, without checking that the checker itself supports such launch mode.

For example, an IProblem may be enabled for "run in editor," but if the checker that defines return 'false' in "runWithEditor" or if the checker is not an instance of IRunnableEditorChecker, the checker should not be considered for processing the resource.

My use case is the following:
1. I have a custom Checker that is not supposed to "run in editor" (it does not implement IRunnableEditorChecker.
2. I enable the problems from my checker to "run in editor"
3. When I change a C++ file, my checker is not called, by the markers it provided the previous time are removed, because CodanBuilder called the checker's "before" and "after" methods.

The solution is to check first if the checker is enabled for a launch mode, and then check if the problems the checker defines are also enabled for a launch mode.

Reproducible: Always

Steps to Reproduce:
This is not possible to reproduce outside my environment, since my checker is tightly tied to proprietary infrastructure. I'm attaching a patch with a solution though.
Comment 1 Alex Ruiz CLA 2011-02-28 15:55:38 EST
Created attachment 189996 [details]
Proposed patch

Patch with a proposed solution.
Comment 2 Alex Ruiz CLA 2011-03-04 18:14:19 EST
Created attachment 190458 [details]
Improved version of patch submitted earlier

Removed double-check for launch mode support in checker. Renamed method "isCheckerEnabledForLaunchMode" to "checkerSupportsLaunchMode".
Comment 3 Sergey Prigogin CLA 2011-03-04 18:26:26 EST
Patch committed.
Comment 4 CDT Genie CLA 2011-03-04 19:23:08 EST
*** cdt cvs genie on behalf of sprigogin ***
Bug 338467 - Codan calls "before" and "after" even for checkers that are not supposed to run in a launch mode. Patch by Alex Ruiz.

[*] CodanBuilder.java 1.18 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanBuilder.java?root=Tools_Project&r1=1.17&r2=1.18