ProjectData (@NotNull ProjectData oldData, @NotNull String oldPath, @NotNull VirtualFile contentRoot) { final ProjectData newData = new ProjectData(); oldData.getClasses().forEach((name, oldClass) -> { String relPath = StringUtil.substringAfter(name, oldPath); String newPath = name; if (relPath != null) { VirtualFile targetFile = contentRoot.findFileByRelativePath(relPath); if (targetFile != null) { newPath = targetFile.getCanonicalPath(); } else { newPath = contentRoot.getPath() + relPath; } } final ClassData newClass = newData.getOrCreateClassData(newPath); newClass.setLines((LineData[])oldClass.getLines()); }); return newData; }