Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail if a workspace is disposed outside the manager #1532

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apitools/org.eclipse.pde.api.tools/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.pde.api.tools;singleton:=true
Bundle-Version: 1.3.600.qualifier
Bundle-Version: 1.3.700.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.29.0,4.0.0)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public final class ApiBaselineManager implements IApiBaselineManager, ISaveParti
/**
* The current workspace baseline
*/
private volatile IApiBaseline workspacebaseline;
private volatile WorkspaceBaseline workspacebaseline;

/**
* The default save location for persisting the cache from this manager.
Expand Down Expand Up @@ -548,7 +548,7 @@ public void stop() {
}
synchronized (this) {
if (workspacebaseline != null) {
workspacebaseline.dispose();
workspacebaseline.disposeInternal();
}
}
if (handlecache != null) {
Expand Down Expand Up @@ -620,12 +620,12 @@ public IApiBaseline getWorkspaceBaseline() {
* the next request.
*/
public void disposeWorkspaceBaseline() {
final IApiBaseline originalBaseline = workspacebaseline;
final WorkspaceBaseline originalBaseline = workspacebaseline;
if (originalBaseline == null) {
return;
}
IJobFunction runnable = m -> {
IApiBaseline oldBaseline = null;
WorkspaceBaseline oldBaseline = null;
synchronized (ApiBaselineManager.this) {
if (workspacebaseline != null && originalBaseline == workspacebaseline) {
if (ApiPlugin.DEBUG_BASELINE_MANAGER) {
Expand All @@ -637,7 +637,7 @@ public void disposeWorkspaceBaseline() {
}
}
if (oldBaseline != null) {
oldBaseline.dispose();
oldBaseline.disposeInternal();
}
return Status.OK_STATUS;
};
Expand Down Expand Up @@ -681,9 +681,9 @@ public boolean isConflicting(ISchedulingRule rule) {
*
* @return a new workspace {@link IApiBaseline} or <code>null</code>
*/
private IApiBaseline createWorkspaceBaseline() throws CoreException {
private WorkspaceBaseline createWorkspaceBaseline() throws CoreException {
long time = System.currentTimeMillis();
IApiBaseline baseline = new WorkspaceBaseline();
WorkspaceBaseline baseline = new WorkspaceBaseline();
try {
// populate it with only projects that are API aware
List<IPluginModelBase> models = Arrays.asList(PluginRegistry.getWorkspaceModels());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ public WorkspaceBaseline() {

@Override
public void dispose() {
throw new UnsupportedOperationException(
"ApiBaselineManager.disposeWorkspaceBaseline() must be used to dispose the workspace baseline"); //$NON-NLS-1$
}

/**
* <b>Only public for technical reasons</b> do not call directly!
*/
public void disposeInternal() {
doDispose();
mismatch.clear();
}
Expand Down
Loading