Skip to content

Commit

Permalink
Remove (almost) unused method from provisional IApiBaselineManager
Browse files Browse the repository at this point in the history
The IApiBaselineManager contains a helper method
IApiBaselineManager#getWorkspaceComponent that is only used in one test.
The method has the drawback that one can't distinguish the case if no
baseline is set or the component is not found additionally it might
later depend on a disposed component.

Because of that the method is now removed and the single reference
changed accordingly.
  • Loading branch information
laeubi committed Dec 27, 2024
1 parent 0b123e0 commit 9d1d770
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import org.eclipse.pde.api.tools.internal.provisional.ApiPlugin;
import org.eclipse.pde.api.tools.internal.provisional.IApiBaselineManager;
import org.eclipse.pde.api.tools.internal.provisional.IApiMarkerConstants;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiBaseline;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent;
import org.eclipse.pde.api.tools.internal.provisional.problems.IApiProblemTypes;
import org.eclipse.pde.api.tools.internal.util.Util;
Expand Down Expand Up @@ -1199,7 +1200,9 @@ protected static void exportProjects(IApiBaselineManager manager, IProject[] pro

private static void exportComponent(IApiBaselineManager manager, IPath baselineLocation, IProject currentProject,
int retry) throws Exception {
IApiComponent component = manager.getWorkspaceComponent(currentProject.getName());
IApiBaseline bl = manager.getWorkspaceBaseline();
assertNotNull("No Workspace baseline set", bl); //$NON-NLS-1$
IApiComponent component = bl.getApiComponent(currentProject.getName());
assertNotNull("The project was not found in the workspace baseline: " + currentProject.getName(), //$NON-NLS-1$
component);
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -706,12 +706,4 @@ private IApiBaseline createWorkspaceBaseline() throws CoreException {
return baseline;
}

@Override
public IApiComponent getWorkspaceComponent(String symbolicName) {
IApiBaseline baseline = getWorkspaceBaseline();
if (baseline != null) {
return baseline.getApiComponent(symbolicName);
}
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
package org.eclipse.pde.api.tools.internal.provisional;

import org.eclipse.pde.api.tools.internal.provisional.model.IApiBaseline;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent;

/**
* Interface describing the {@link IApiBaselineManager}
Expand Down Expand Up @@ -98,12 +97,4 @@ public interface IApiBaselineManager {
*/
public IApiBaseline getWorkspaceBaseline();

/**
* Returns the API component the workspace baseline with the given symbolic
* name or <code>null</code> if none.
*
* @param symbolicName bundle symbolic name
* @return API component from the workspace baseline or <code>null</code>
*/
public IApiComponent getWorkspaceComponent(String symbolicName);
}

0 comments on commit 9d1d770

Please sign in to comment.