mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
proper synchronisation, project leak in tests
+ light project were not property disposed after setProjectName()
This commit is contained in:
@@ -76,6 +76,7 @@ public class ProjectImpl extends PlatformComponentManagerImpl implements Project
|
||||
public boolean myOptimiseTestLoadSpeed;
|
||||
private String myName;
|
||||
private String myOldName;
|
||||
private final boolean myLight;
|
||||
|
||||
protected ProjectImpl(@NotNull ProjectManager projectManager,
|
||||
@NotNull String filePath,
|
||||
@@ -98,6 +99,9 @@ public class ProjectImpl extends PlatformComponentManagerImpl implements Project
|
||||
if (!isDefault() && projectName != null && getStateStore().getStorageScheme().equals(StorageScheme.DIRECTORY_BASED)) {
|
||||
myOldName = ""; // new project
|
||||
}
|
||||
|
||||
// light project may be changed later during test, so we need to remember its initial state
|
||||
myLight = ApplicationManager.getApplication().isUnitTestMode() && filePath.contains("light_temp_");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -105,6 +109,10 @@ public class ProjectImpl extends PlatformComponentManagerImpl implements Project
|
||||
return super.isDisposed() || temporarilyDisposed;
|
||||
}
|
||||
|
||||
public boolean isLight() {
|
||||
return myLight;
|
||||
}
|
||||
|
||||
private volatile boolean temporarilyDisposed;
|
||||
@TestOnly
|
||||
public void setTemporarilyDisposed(boolean disposed) {
|
||||
|
||||
+1
-1
@@ -862,7 +862,7 @@ public class ProjectManagerImpl extends ProjectManagerEx implements PersistentSt
|
||||
|
||||
@TestOnly
|
||||
public static boolean isLight(@NotNull Project project) {
|
||||
return ApplicationManager.getApplication().isUnitTestMode() && project.toString().contains("light_temp_");
|
||||
return project instanceof ProjectImpl && ((ProjectImpl)project).isLight();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user