Add caching by project to decompiled data

This commit is contained in:
Pavel V. Talanov
2013-08-26 17:07:13 +04:00
parent 78818e7a31
commit e70d6bbf71
@@ -54,7 +54,9 @@ public class JetDecompiledData {
@NotNull
public static JetDecompiledData getDecompiledData(@NotNull VirtualFile virtualFile, @NotNull Project project) {
synchronized (LOCK) {
if (virtualFile.getUserData(USER_DATA_KEY) == null) {
JetDecompiledData cachedData = virtualFile.getUserData(USER_DATA_KEY);
//TODO: use cached value that keeps modification tracking for this virtual file
if (cachedData == null || cachedData.getProject() != project) {
virtualFile.putUserData(USER_DATA_KEY, DecompiledDataFactory.createDecompiledData(virtualFile, project));
}
JetDecompiledData decompiledData = virtualFile.getUserData(USER_DATA_KEY);
@@ -89,4 +91,9 @@ public class JetDecompiledData {
public JetFile getFile() {
return file;
}
@NotNull
public Project getProject() {
return file.getProject();
}
}