| Summary: | A poblem can happen with ResourceLookupTree adding resource approach | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | John Liu <john_ws_liu> | ||||||
| Component: | cdt-core | Assignee: | Markus Schorn <mschorn.eclipse> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | Doug Schaefer <cdtdoug> | ||||||
| Severity: | normal | ||||||||
| Priority: | P3 | ||||||||
| Version: | 7.0 | ||||||||
| Target Milestone: | 7.0.1 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
John Liu
Created attachment 177477 [details]
a proposed patch applied to cdt_7_0 branch
Propose a fix patch for discussion.
The fix just adds an extension relevant check to cdt default extension list(fDefaultExtensions) for the incoming resource in the function:
private void add(IResource res)
Actually do we still need to check the inverse extension list fCurrentExtensions? I believe the inverse extension list is much bigger than the default extension list. So why we pick a longer list to search?
Created attachment 177499 [details] more elegant solution (In reply to comment #1) > The fix just adds an extension relevant check to cdt default extension > list(fDefaultExtensions) for the incoming resource ... A more elegant solution is to make sure that the default-extensions are part of the cdt-project-extensions, see my patch. > Actually do we still need to check the inverse extension list > fCurrentExtensions? I believe the inverse extension list is much bigger than > the default extension list. So why we pick a longer list to search? The inverse list is motivated by the fact that in c/c++ you can include files with any extension or files without extension. Therefore in a CDT project the relevant files are the ones that are known c/c++ files (*.c, ...) plus the ones that have an unknown or no extension. If I read the source code correctly, the problem can occur only when you have a content type that does not derive from one of the cdt-content types and contains *.c as a file pattern. Is that actually the case? (In reply to comment #2) > Created an attachment (id=177499) [details] > more elegant solution > (In reply to comment #1) > > The fix just adds an extension relevant check to cdt default extension > > list(fDefaultExtensions) for the incoming resource ... > A more elegant solution is to make sure that the default-extensions are part > of the cdt-project-extensions, see my patch. > > Actually do we still need to check the inverse extension list > > fCurrentExtensions? I believe the inverse extension list is much bigger than > > the default extension list. So why we pick a longer list to search? > The inverse list is motivated by the fact that in c/c++ you can include files > with any extension or files without extension. Therefore in a CDT project the > relevant files are the ones that are known c/c++ files (*.c, ...) plus the ones > that have an unknown or no extension. > If I read the source code correctly, the problem can occur only when you have a > content type that does not derive from one of the cdt-content types and > contains *.c as a file pattern. Is that actually the case? Thanks, Markus for your quick fix. Yes. That is the case when another content type also has C like extensions. I agree your fix is more closing to the original logic and it works too. When can you check in your patch to cdt_7_0 stream and head? (In reply to comment #3) > Yes. That is the case when another content type also has C like extensions. ok. > ... > When can you check in your patch to cdt_7_0 stream and head? Fixed in 7.0.1 and 8.0 > 20100826. *** cdt cvs genie on behalf of mschorn *** Bug 323659: Resource lookup with overlapping content types. [*] ResourceLookupTree.java 1.6 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/resources/ResourceLookupTree.java?root=Tools_Project&r1=1.5&r2=1.6 [*] ResourceLookupTree.java 1.5.2.1 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/resources/ResourceLookupTree.java?root=Tools_Project&r1=1.5&r2=1.5.2.1 |