Problem with module search scopes

I need to use module search scope with dependencies and libraries to search some stuff from file based index, so I use module.getModuleWithDependenciesAndLibrariesScope. Now it looks like in IDEA 13 (IU-135.1306) something not working properly, example:

//module which depends on module X //file - virtual file from module X module.getModuleContentWithDependenciesScope().contains(file); //true module.getModuleWithDependenciesAndLibrariesScope(false).contains(file); //false - should be true? module.getModuleWithDependenciesAndLibrariesScope(true).contains(file); //false - should be true? module.getModuleWithLibrariesScope().contains(file); //false module.getModuleWithDependenciesScope().contains(file); //false - should be true?


It is a bug?

0
3 comments

Ok, it looks like getModuleContentWithDependenciesScope method includes all directories and files from given module, but all other mentioned methods uses just content roots of this module, am I right?
So if this file is in module X, but not in marked content root, so I need to make some module content union with dependencies and libraries scope of this module like this:

  module.getModuleWithDependenciesAndLibrariesScope(false).uniteWith(module.getModuleContentWithDependenciesScope());


Or maybe there is a simpler/better way?

0

I'm not sure which difference you see between "all directories and files from given module" and "just content roots of this module". The only contents of a module is the contents of its content roots. A file cannot be in a module but not under one of its content roots.

0

For example Maven module has following structure:

  • pom.xml in root directory of module
  • src/main/java marked as source root
  • src/main/resources as source resources root
  • src/test/java marked as test root
  • src/test/resources as test resources root

If there is another directory, let say src/main/X, this may not be marked as source root, so only module.getModuleContent...Scope() will include this folder content in serach scope, but this also does not include dependencies and libraries together. Basically I need to build search scope from root directory of module with its dependencies and libraries.

0

Please sign in to leave a comment.