From 6251973cf7b644f5a1bac32d475eab771f588e28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=8A?= =?UTF-8?q?=D1=80=20=D0=9A=D1=83=D1=80=D1=82=D0=B0=D0=BA=D0=BE=D0=B2?= Date: Sat, 24 Feb 2024 10:21:28 +0200 Subject: [PATCH] Remove unused code --- .../tycho/p2maven/InstallableUnitSlicer.java | 25 ------------------- .../transport/Java11HttpTransportFactory.java | 2 -- .../apitools/ApiApplicationResolver.java | 6 ----- .../internal/HtmlComparator.java | 2 +- .../tycho/core/TychoProjectManager.java | 4 +-- .../maven/TychoMavenLifecycleParticipant.java | 2 -- .../osgi/framework/EclipseWorkspace.java | 7 +----- .../framework/EclipseWorkspaceManager.java | 4 +-- .../copiedfromp2/DirectorApplication.java | 14 +++++------ .../extras/pde/ListDependenciesMojo.java | 2 +- .../test/PackageFeatureMojoTest.java | 3 --- 11 files changed, 14 insertions(+), 57 deletions(-) diff --git a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/InstallableUnitSlicer.java b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/InstallableUnitSlicer.java index 0dae952a7b..d77bb0b09d 100644 --- a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/InstallableUnitSlicer.java +++ b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/InstallableUnitSlicer.java @@ -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; @@ -118,28 +117,4 @@ public Map> computeDirectDependencies return result; } - private final class TychoSlicer extends PermissiveSlicer { - private TychoSlicer(IQueryable 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); - } - } - } diff --git a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/transport/Java11HttpTransportFactory.java b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/transport/Java11HttpTransportFactory.java index 1d6ca5a0f7..dfffc4477c 100644 --- a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/transport/Java11HttpTransportFactory.java +++ b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/transport/Java11HttpTransportFactory.java @@ -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> DATE_PATTERNS = List.of(// diff --git a/tycho-apitools-plugin/src/main/java/org/eclipse/tycho/apitools/ApiApplicationResolver.java b/tycho-apitools-plugin/src/main/java/org/eclipse/tycho/apitools/ApiApplicationResolver.java index b0034964db..ddc2b1c6b7 100644 --- a/tycho-apitools-plugin/src/main/java/org/eclipse/tycho/apitools/ApiApplicationResolver.java +++ b/tycho-apitools-plugin/src/main/java/org/eclipse/tycho/apitools/ApiApplicationResolver.java @@ -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; @@ -40,7 +37,6 @@ 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 @@ -48,8 +44,6 @@ @Component(role = ApiApplicationResolver.class) public class ApiApplicationResolver { - private final Map cache = new ConcurrentHashMap<>(); - @Requirement private Logger logger; diff --git a/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/HtmlComparator.java b/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/HtmlComparator.java index 8e5752547a..f2a77a3a77 100644 --- a/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/HtmlComparator.java +++ b/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/HtmlComparator.java @@ -79,7 +79,7 @@ private void cleanJavaDoc(Element root) { headElement.removeChild(node); } } - if (node instanceof Comment comment) { + if (node instanceof Comment) { headElement.removeChild(node); } } diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/TychoProjectManager.java b/tycho-core/src/main/java/org/eclipse/tycho/core/TychoProjectManager.java index 779456ee5f..34b0b8db84 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/core/TychoProjectManager.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/core/TychoProjectManager.java @@ -273,7 +273,7 @@ public Optional 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 */ @@ -294,7 +294,7 @@ public Collection 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 list = cpc.getAdditionalClasspathEntries(project, Artifact.SCOPE_COMPILE); diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java b/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java index 74c3877ed9..3383a2a1cc 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java @@ -104,8 +104,6 @@ public class TychoMavenLifecycleParticipant extends AbstractMavenLifecyclePartic @Requirement TychoProjectManager projectManager; - private boolean warnedAboutTychoMode; - public TychoMavenLifecycleParticipant() { // needed for plexus } diff --git a/tycho-core/src/main/java/org/eclipse/tycho/osgi/framework/EclipseWorkspace.java b/tycho-core/src/main/java/org/eclipse/tycho/osgi/framework/EclipseWorkspace.java index fcc4669eed..44640b86e8 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/osgi/framework/EclipseWorkspace.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/osgi/framework/EclipseWorkspace.java @@ -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 @@ -28,14 +26,11 @@ public final class EclipseWorkspace { 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; } diff --git a/tycho-core/src/main/java/org/eclipse/tycho/osgi/framework/EclipseWorkspaceManager.java b/tycho-core/src/main/java/org/eclipse/tycho/osgi/framework/EclipseWorkspaceManager.java index 978a040341..21f35811bd 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/osgi/framework/EclipseWorkspaceManager.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/osgi/framework/EclipseWorkspaceManager.java @@ -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") @@ -48,7 +48,7 @@ public EclipseWorkspace getWorkspace(T key) { return (EclipseWorkspace) 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); diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2tools/copiedfromp2/DirectorApplication.java b/tycho-core/src/main/java/org/eclipse/tycho/p2tools/copiedfromp2/DirectorApplication.java index 7e0953a8f0..4cd19d9fed 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2tools/copiedfromp2/DirectorApplication.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2tools/copiedfromp2/DirectorApplication.java @@ -990,7 +990,7 @@ private void initializeServices() throws CoreException { * * @return the current default agent, never null * @throws CoreException - * when fetching the agent failed + * when fetching the agent failed */ protected IProvisioningAgent getDefaultAgent() throws CoreException { return defaultAgent; @@ -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 null * @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); @@ -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) { @@ -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 properties) { String[] propPairs = StringHelper.getArrayFromString(pairs, ','); diff --git a/tycho-extras/tycho-dependency-tools-plugin/src/main/java/org/eclipse/tycho/extras/pde/ListDependenciesMojo.java b/tycho-extras/tycho-dependency-tools-plugin/src/main/java/org/eclipse/tycho/extras/pde/ListDependenciesMojo.java index 1018c64e83..c254de7185 100644 --- a/tycho-extras/tycho-dependency-tools-plugin/src/main/java/org/eclipse/tycho/extras/pde/ListDependenciesMojo.java +++ b/tycho-extras/tycho-dependency-tools-plugin/src/main/java/org/eclipse/tycho/extras/pde/ListDependenciesMojo.java @@ -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 -> { diff --git a/tycho-packaging-plugin/src/test/java/org/eclipse/tycho/buildnumber/test/PackageFeatureMojoTest.java b/tycho-packaging-plugin/src/test/java/org/eclipse/tycho/buildnumber/test/PackageFeatureMojoTest.java index 9c256f7b5f..880236730c 100644 --- a/tycho-packaging-plugin/src/test/java/org/eclipse/tycho/buildnumber/test/PackageFeatureMojoTest.java +++ b/tycho-packaging-plugin/src/test/java/org/eclipse/tycho/buildnumber/test/PackageFeatureMojoTest.java @@ -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 projects = getSortedProjects(basedir, properties); MavenProject project = getProject(projects, "licenseFeature.feature"); @@ -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 projects = getSortedProjects(basedir, properties); MavenProject project = getProject(projects, "featureDefault"); @@ -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 projects = getSortedProjects(basedir, properties); MavenProject project = getProject(projects, "featureForcedToTrue");