ScriptTemplatesClassRootsIndex: inc version and minor fixes

Content was changed, so we should force reindex.

Minor changes:
- There is no need to save a string, we can just save nothing
 by using the Unit value (see UnitKey.save and UnitKey.read)
- Unit can be shared between all indexes, so we can extract UnitKey object
- It would be good to extract abstract class FileListIndex:
  - for better readability: separate the logic of the specific index from the common FileListIndex implementation
  - someone can use it also
- mapOf (Unit to null) will create singletonMap itself and more readable
- ScriptTemplatesClassRootsIndex.KEY perhaps better to call NAME
This commit is contained in:
Sergey Rostov
2020-07-08 11:02:01 +03:00
parent 1f52c0e0d4
commit e48d2b9b83
3 changed files with 27 additions and 36 deletions
@@ -78,8 +78,8 @@ abstract class AbstractScriptTemplatesFromDependenciesTest : HeavyPlatformTestCa
}
val roots: Collection<VirtualFile> = FileBasedIndex.getInstance().getContainingFiles(
ScriptTemplatesClassRootsIndex.KEY,
ScriptTemplatesClassRootsIndex.VALUE,
ScriptTemplatesClassRootsIndex.NAME,
Unit,
GlobalSearchScope.allScope(project)
)