FileSystemLocation (Class<?> clazz) { String classRootPath = PathManager.getJarPathForClass(clazz); if (classRootPath == null) { throw new IllegalStateException("Cannot find root directory for " + clazz); } File root = new File(classRootPath); if (!root.exists()) { throw new IllegalStateException("Classes root " + root + " doesn't exist"); } if (!root.isDirectory()) { //this means that clazz is located in a library; perhaps we should throw exception here return FileSystemLocation.ULTIMATE; } String moduleName = root.getName(); return getCommunityModules().contains(moduleName) ? FileSystemLocation.COMMUNITY : FileSystemLocation.ULTIMATE; }