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

Remove unused code #3525

Merged
merged 1 commit into from
Feb 25, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -118,28 +117,4 @@ public Map<IRequirement, Collection<IInstallableUnit>> computeDirectDependencies
return result;
}

private final class TychoSlicer extends PermissiveSlicer {
private TychoSlicer(IQueryable<IInstallableUnit> input) {
super(input, new HashMap<>(), //
true, // includeOptionalDependencies
true, // everythingGreedy
true, // evalFilterTo
false, // considerOnlyStrictDependency
false // onlyFilteredRequirements
);
}

@Override
protected boolean isApplicable(IInstallableUnit unit, IRequirement requirement) {
if (requirement.isMatch(unit)) {
// a bundle might import its exported packages, in such a case we ignore the
// requirement
log.debug("The requirement " + requirement + " is already satisfied by the unit " + unit
+ " itself, ignoring it.");
return false;
}
return super.isApplicable(unit, requirement);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ public class Java11HttpTransportFactory implements HttpTransportFactory, Initial
private static final int MAX_DISCARD = 1024 * 10;
private static final byte[] DUMMY_BUFFER = new byte[MAX_DISCARD];

private static final String LAST_MODIFIED_HEADER = "Last-Modified";

// see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3
// per RFC there are three different formats:
private static final List<ThreadLocal<DateFormat>> DATE_PATTERNS = List.of(//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@
*******************************************************************************/
package org.eclipse.tycho.apitools;

import java.net.URI;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
Expand All @@ -40,16 +37,13 @@
import org.eclipse.tycho.osgi.framework.Features;
import org.osgi.framework.BundleException;
import org.osgi.service.log.LogEntry;

/**
* Component that resolves the bundles that make up the ApiApplication from a
* given URI
*/
@Component(role = ApiApplicationResolver.class)
public class ApiApplicationResolver {

private final Map<URI, EclipseApplication> cache = new ConcurrentHashMap<>();

@Requirement
private Logger logger;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private void cleanJavaDoc(Element root) {
headElement.removeChild(node);
}
}
if (node instanceof Comment comment) {
if (node instanceof Comment) {
headElement.removeChild(node);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public Optional<Processor> getBndTychoProject(MavenProject project) {
* Determine the list of dependencies for a given project as a collection of path items
*
* @param project
* the project to use to determine the dependencies
* the project to use to determine the dependencies
* @return a Collection of pathes describing the project dependencies
* @throws Exception
*/
Expand All @@ -294,7 +294,7 @@ public Collection<Path> getProjectDependencies(MavenProject project) throws Exce
writeLocation(reactorProject.getArtifact(descriptor.getClassifier()), dependencySet);
}
}
if (tychoProject instanceof OsgiBundleProject bundleProject) {
if (tychoProject instanceof OsgiBundleProject) {
MavenSession session = getMavenSession();
pluginRealmHelper.visitPluginExtensions(project, session, ClasspathContributor.class, cpc -> {
List<ClasspathEntry> list = cpc.getAdditionalClasspathEntries(project, Artifact.SCOPE_COMPILE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ public class TychoMavenLifecycleParticipant extends AbstractMavenLifecyclePartic
@Requirement
TychoProjectManager projectManager;

private boolean warnedAboutTychoMode;

public TychoMavenLifecycleParticipant() {
// needed for plexus
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

import java.nio.file.Path;

import org.codehaus.plexus.logging.Logger;

/**
* A generic representation of a workspace that is only initialized once and carries a cache key,
* belonging to a thread so it can be used in a threadsafe manner
Expand All @@ -28,14 +26,11 @@ public final class EclipseWorkspace<T> {

private T key;

private Logger logger;

private Thread thread;

EclipseWorkspace(Path workDir, T key, Logger logger, Thread thread) {
EclipseWorkspace(Path workDir, T key, Thread thread) {
this.workDir = workDir;
this.key = key;
this.logger = logger;
this.thread = thread;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class EclipseWorkspaceManager implements Disposable {

/**
* @param key
* the key to use
* the key to use
* @return a workspace directory that can be used by the current thread.
*/
@SuppressWarnings("unchecked")
Expand All @@ -48,7 +48,7 @@ public <T> EclipseWorkspace<T> getWorkspace(T key) {
return (EclipseWorkspace<T>) cache.computeIfAbsent(currentThread, t -> new ConcurrentHashMap<>())
.computeIfAbsent(key, x -> {
try {
return new EclipseWorkspace<>(Files.createTempDirectory("eclipseWorkspace"), key, logger,
return new EclipseWorkspace<>(Files.createTempDirectory("eclipseWorkspace"), key,
currentThread);
} catch (IOException e) {
throw new IllegalStateException("can't create a temporary directory for the workspace!", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ private void initializeServices() throws CoreException {
*
* @return the current default agent, never <code>null</code>
* @throws CoreException
* when fetching the agent failed
* when fetching the agent failed
*/
protected IProvisioningAgent getDefaultAgent() throws CoreException {
return defaultAgent;
Expand All @@ -1000,10 +1000,10 @@ protected IProvisioningAgent getDefaultAgent() throws CoreException {
* Creates a new agent for the given data area
*
* @param p2DataArea
* the data area to create a new agent
* the data area to create a new agent
* @return the new agent, never <code>null</code>
* @throws CoreException
* if creation of the agent for the given location failed
* if creation of the agent for the given location failed
*/
protected IProvisioningAgent createAgent(URI p2DataArea) throws CoreException {
IProvisioningAgent agent = provisioningAgentProvider.createAgent(p2DataArea);
Expand All @@ -1013,8 +1013,8 @@ protected IProvisioningAgent createAgent(URI p2DataArea) throws CoreException {

/*
* See bug: https://bugs.eclipse.org/340971 Using the event bus to detect whether or not a
* repository was added in a touchpoint action. If it was, then (if it exists) remove it from
* our list of repos to remove after we complete our install.
* repository was added in a touchpoint action. If it was, then (if it exists) remove it from our
* list of repos to remove after we complete our install.
*/
@Override
public void notify(EventObject o) {
Expand Down Expand Up @@ -1412,9 +1412,9 @@ else if (!printHelpInfo && !printIUList && !printRootIUList && !printTags && !pu

/**
* @param pairs
* a comma separated list of tag=value pairs
* a comma separated list of tag=value pairs
* @param properties
* the collection into which the pairs are put
* the collection into which the pairs are put
*/
private void putProperties(String pairs, Map<String, String> properties) {
String[] propPairs = StringHelper.getArrayFromString(pairs, ',');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
}
}
TychoProject projectType = projectTypes.get(project.getPackaging());
if (projectType instanceof OsgiBundleProject bundleProject) {
if (projectType instanceof OsgiBundleProject) {

try {
pluginRealmHelper.visitPluginExtensions(project, session, ClasspathContributor.class, cpc -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public PackageFeatureMojoTest() {

public void testLicenseFeature() throws Exception {
File basedir = new File(getBasedir("projects/licenseFeature"), "feature");
File platform = new File("src/test/resources/projects/licenseFeature/eclipse");
List<MavenProject> projects = getSortedProjects(basedir, properties);

MavenProject project = getProject(projects, "licenseFeature.feature");
Expand Down Expand Up @@ -84,7 +83,6 @@ public void testLicenseFeature() throws Exception {

public void testAddMavenDescriptorNotAddedPerDefault() throws Exception {
File basedir = getBasedir("projects/addMavenDescriptor/featureDefault/");
File platform = new File("src/test/resources/eclipse");
List<MavenProject> projects = getSortedProjects(basedir, properties);

MavenProject project = getProject(projects, "featureDefault");
Expand All @@ -107,7 +105,6 @@ public void testAddMavenDescriptorNotAddedPerDefault() throws Exception {

public void testAddMavenDescriptorSetToTrue() throws Exception {
File basedir = getBasedir("projects/addMavenDescriptor/featureForcedToTrue");
File platform = new File("src/test/resources/eclipse");
List<MavenProject> projects = getSortedProjects(basedir, properties);

MavenProject project = getProject(projects, "featureForcedToTrue");
Expand Down
Loading