Disable indexing for restricted binary files - #5284
Conversation
Indexing for restricted files is so far disabled only for sources, not for binary files. This change ensures also restricted binary files are not indexed. Fixes: eclipse-jdt#4970
| String binaryIndexerMessage = "Could not index empty /IndexProject/src/p/TestBroken.class"; | ||
| List<IStatus> logs = this.logListener.getLogs(); | ||
| boolean unexpectedLog = logs.stream().map(IStatus::getMessage).anyMatch(m -> binaryIndexerMessage.equals(m)); | ||
| assertFalse("Expected no log from binary indexer", unexpectedLog); |
There was a problem hiding this comment.
Not the best and definitely not the most robust way to test this... but its simple. I can try to come up with something else, but it won't be simple getting a class file that has the expected matches.
|
|
||
| private boolean disabledForFile() { | ||
| if (JavaModelManager.disableRestrictedFileIndexing()) { | ||
| IFile file = getDocumentFile(this.document); |
There was a problem hiding this comment.
For binary indexer, in most cases the IFile will not exist, so on every file from a jar or jre it will throw exception, which is not OK.
|
Ideally we only check at places which indexer has "IFile" in hand, like:
So we don't need to reconstruct the |
My main reason for putting code directly in |
Indexing for restricted files is so far disabled only for sources, not for binary files. This change ensures also restricted binary files are not indexed.
Fixes: #4970