Community
Participate
Working Groups
Build Identifier: Given two C++ projects "XYLib" (Library Project) and "XY" where XY references the active configuration of "XYLib" (enabled in "XY->Properties->C++ General->Paths and Symbols->References"), the index of XY does not returns the IIndexFile for a given IndexFileLocation (FullPath "/XYLib/A.h", A.h exists in XYLib). I can see that the IndexFile exists by calling index.getAllFiles(). The IndexFile is not added to the results list in IIndex.getFiles() because the"candidate.hasContent()" check returns false. The candidate is considered to have no content because the getTimestamp() returns -1. I think this isn't correct? Reproducible: Always Steps to Reproduce: 1. Create static library project "XYLib" 2. Create Class A in "XYLib" (results in A.cpp and A.h) 3. Create runnalbe project "XY" 4. Create main.cpp 5. Go to "XY->Properties->C++ General->Paths and Symbols->References" and enable reference to "XYLib". 6. call index.getFiles(IndexLocationFactory.getIFLExpensive(cproject, filePath))
The content of the file in question is manged by the library project. Therefore, to find the file you need to create an index that spans both projects.
(In reply to comment #1) Why then can I access the file with index.getAllFiles()? According to your explanation, it should not be there. Creating a spawnd index does not seem to be the right thing in my opinion because I want the index to (only) know about the stuff that is known in the current project (XY) which includes headers that are known through references to other projects. This would make sence because other external stuff (e.g. "vector") is also external and referenced and I get IndexFiles for it.
(In reply to comment #2) > (In reply to comment #1) > Why then can I access the file with index.getAllFiles()? According to your > explanation, it should not be there. The java-doc has to clarify how the method shall behave. > Creating a spawnd index does not seem to be the right thing in my opinion > because I want the index to (only) know about the stuff that is known in the > current project (XY) which includes headers that are known through references > to other projects. This would make sence because other external stuff (e.g. > "vector") is also external and referenced and I get IndexFiles for it. You don't have an option here, in your scenario the content of the headers is not stored in the index of 'XY'. (Even if you do get access to the IIndexFile object, it will not have any content.) If the project 'XY' does not have a project reference to 'XYLib', then the index of 'XY' will manage the headers included from 'XYLib' independently.
I understand your argumentation (though I'm not very happy about it, I can live with it). I try to find out if a spawned index brings problems in our cases. Thanks for your help anyway. Do you want to adapt java-doc before closing this ticket?
(In reply to comment #4) > I understand your argumentation (though I'm not very happy about it, I can live > with it). I try to find out if a spawned index brings problems in our cases. > Thanks for your help anyway. Do you want to adapt java-doc before closing this > ticket? I'll take the action to clarify what index.getAllFiles() shall do. I am not entirly sure whether it shall return files without content or not.
I changed IIndex.getAllFiles(), such that it no longer returns the empty IIndexFiles that serve as reference to other PDOMs. This is consistent with the other methods that can be used to get IIndexFile objects from an index.