synchronized void addChanged()

in src/main/java/org/jetbrains/plugins/spotbugs/core/Changes.java [73:107]


	synchronized void addChanged(@NotNull final Collection<File> paths) {
		final LocalFileSystem lfs = LocalFileSystem.getInstance();
		VirtualFile vf;
		List<VirtualFile> vfs = null;
		for (File f : paths) {
			vf = lfs.findFileByIoFile(f);
			if (vf != null && vf.isValid() && !vf.isDirectory() && IdeaUtilImpl.isValidFileType(vf.getFileType())) {
				if (vfs == null) {
          vfs = new ArrayList<>();
				}
				vfs.add(vf);
			}
		}

		if (vfs != null) {
			ProjectFileIndex index;
			Set<VirtualFile> changesPerProject;
			for (Project project : _listeners) {
				index = ProjectFileIndex.getInstance( project );
				changesPerProject = null;
				for (VirtualFile f : vfs) {
					if (index.isInSource(f)) {
						if (changesPerProject == null) {
							changesPerProject = _changed.get(project);
							if (changesPerProject == null) {
								changesPerProject = new THashSet<>();
								_changed.put(project, changesPerProject);
							}
						}
						changesPerProject.add(f);
					}
				}
			}
		}
	}