diff --git a/org.sonarlint.eclipse.core.tests/src/test/java/org/sonarlint/eclipse/core/internal/resources/SonarLintProjectConfigurationManagerTest.java b/org.sonarlint.eclipse.core.tests/src/test/java/org/sonarlint/eclipse/core/internal/resources/SonarLintProjectConfigurationManagerTest.java index fff55ffc5..1ddd02bc2 100644 --- a/org.sonarlint.eclipse.core.tests/src/test/java/org/sonarlint/eclipse/core/internal/resources/SonarLintProjectConfigurationManagerTest.java +++ b/org.sonarlint.eclipse.core.tests/src/test/java/org/sonarlint/eclipse/core/internal/resources/SonarLintProjectConfigurationManagerTest.java @@ -36,8 +36,6 @@ import static org.assertj.core.api.Assertions.assertThat; public class SonarLintProjectConfigurationManagerTest extends SonarTestCase { - - private static final String PROJECT_WITH_DEPRECATED_SETTINGS = "DeprecatedModuleBinding"; private final List infos = new ArrayList<>(); private final List errors = new ArrayList<>(); @@ -65,15 +63,6 @@ public void traceIdeMessage(@Nullable String msg) { }); } - @Test - public void load_deprecated_project_config() throws IOException, CoreException, InterruptedException { - var project = importEclipseProject(PROJECT_WITH_DEPRECATED_SETTINGS); - // Configure the project - var configuration = SonarLintCorePlugin.getInstance().getProjectConfigManager().load(new ProjectScope(project), PROJECT_WITH_DEPRECATED_SETTINGS); - assertThat(configuration.getProjectBinding()).isEmpty(); - assertThat(infos).contains("Binding configuration of project '" + PROJECT_WITH_DEPRECATED_SETTINGS + "' is outdated. Please rebind this project."); - } - @Test public void settings_are_written_to_disk() throws IOException, CoreException, InterruptedException { var project = importEclipseProject("SimpleProject"); diff --git a/org.sonarlint.eclipse.core.tests/testdata/DeprecatedModuleBinding/.classpath b/org.sonarlint.eclipse.core.tests/testdata/DeprecatedModuleBinding/.classpath deleted file mode 100644 index 710294f91..000000000 --- a/org.sonarlint.eclipse.core.tests/testdata/DeprecatedModuleBinding/.classpath +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/org.sonarlint.eclipse.core.tests/testdata/DeprecatedModuleBinding/.project b/org.sonarlint.eclipse.core.tests/testdata/DeprecatedModuleBinding/.project deleted file mode 100644 index baa584fc7..000000000 --- a/org.sonarlint.eclipse.core.tests/testdata/DeprecatedModuleBinding/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - SimpleProject - - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.wst.common.project.facet.core.nature - - diff --git a/org.sonarlint.eclipse.core.tests/testdata/DeprecatedModuleBinding/.settings/org.sonarlint.eclipse.core.prefs b/org.sonarlint.eclipse.core.tests/testdata/DeprecatedModuleBinding/.settings/org.sonarlint.eclipse.core.prefs deleted file mode 100644 index 9d9f25316..000000000 --- a/org.sonarlint.eclipse.core.tests/testdata/DeprecatedModuleBinding/.settings/org.sonarlint.eclipse.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -autoEnabled=true -eclipse.preferences.version=1 -extraProperties= -fileExclusions= -idePrefixKey= -moduleKey=org.sonarsource.sonarlint.eclipse\:sonarlint-eclipse-parent -serverId=dory -sqPrefixKey= diff --git a/org.sonarlint.eclipse.core/META-INF/MANIFEST.MF b/org.sonarlint.eclipse.core/META-INF/MANIFEST.MF index 0812a65ff..fa8e1363f 100644 --- a/org.sonarlint.eclipse.core/META-INF/MANIFEST.MF +++ b/org.sonarlint.eclipse.core/META-INF/MANIFEST.MF @@ -9,7 +9,6 @@ Bundle-Vendor: %bundle_vendor Bundle-Localization: OSGI-INF/l10n/bundle Export-Package: org.sonarlint.eclipse.core, org.sonarlint.eclipse.core.analysis, - org.sonarlint.eclipse.core.configurator, org.sonarlint.eclipse.core.documentation, org.sonarlint.eclipse.core.internal;x-friends:="org.sonarlint.eclipse.core.tests,org.sonarlint.eclipse.ui", org.sonarlint.eclipse.core.internal.adapter;x-friends:="org.sonarlint.eclipse.ui", diff --git a/org.sonarlint.eclipse.core/plugin.xml b/org.sonarlint.eclipse.core/plugin.xml index 019ce0791..e68371de3 100644 --- a/org.sonarlint.eclipse.core/plugin.xml +++ b/org.sonarlint.eclipse.core/plugin.xml @@ -1,7 +1,6 @@ - diff --git a/org.sonarlint.eclipse.core/schema/projectConfigurators.exsd b/org.sonarlint.eclipse.core/schema/projectConfigurators.exsd deleted file mode 100644 index 5a5161aa4..000000000 --- a/org.sonarlint.eclipse.core/schema/projectConfigurators.exsd +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Project configurator - - - - - - - Configurator implementation - - - - - - - - - - - - - - - diff --git a/org.sonarlint.eclipse.core/src/org/sonarlint/eclipse/core/configurator/ProjectConfigurationRequest.java b/org.sonarlint.eclipse.core/src/org/sonarlint/eclipse/core/configurator/ProjectConfigurationRequest.java deleted file mode 100644 index fb2a93d96..000000000 --- a/org.sonarlint.eclipse.core/src/org/sonarlint/eclipse/core/configurator/ProjectConfigurationRequest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SonarLint for Eclipse - * Copyright (C) 2015-2025 SonarSource SA - * sonarlint@sonarsource.com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonarlint.eclipse.core.configurator; - -import java.util.Collection; -import java.util.Map; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.sonarlint.eclipse.core.analysis.IAnalysisConfigurator; - -/** - * @deprecated since 3.0 use {@link IAnalysisConfigurator} - */ -@Deprecated -public class ProjectConfigurationRequest { - - private final IProject project; - private final Map sonarProjectProperties; - private final Collection filesToAnalyze; - - public ProjectConfigurationRequest(IProject eclipseProject, Collection filesToAnalyze, Map sonarProjectProperties) { - this.project = eclipseProject; - this.sonarProjectProperties = sonarProjectProperties; - this.filesToAnalyze = filesToAnalyze; - } - - public IProject getProject() { - return project; - } - - /** - * Analysis properties. Can be modified by the configurator. - */ - public Map getSonarProjectProperties() { - return sonarProjectProperties; - } - - /** - * List of files to analyze. The project configurator can decide to exclude some of them, or replace virtual files with real files. - */ - public Collection getFilesToAnalyze() { - return filesToAnalyze; - } - -} diff --git a/org.sonarlint.eclipse.core/src/org/sonarlint/eclipse/core/configurator/ProjectConfigurator.java b/org.sonarlint.eclipse.core/src/org/sonarlint/eclipse/core/configurator/ProjectConfigurator.java deleted file mode 100644 index 98a32d73c..000000000 --- a/org.sonarlint.eclipse.core/src/org/sonarlint/eclipse/core/configurator/ProjectConfigurator.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * SonarLint for Eclipse - * Copyright (C) 2015-2025 SonarSource SA - * sonarlint@sonarsource.com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonarlint.eclipse.core.configurator; - -import java.util.Collection; -import java.util.Map; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.sonarlint.eclipse.core.analysis.IAnalysisConfigurator; -import org.sonarlint.eclipse.core.internal.utils.StringUtils; - -/** - * Implemented by components that configure the analysis on certain environments. - * For example, we have configurators for C/C++ projects in Eclipse CDT and for Java projects. - * - * Other products also use this interface, so it should be kept stable. - * @deprecated since 3.0 replaced by {@link IAnalysisConfigurator} - */ -@Deprecated -public abstract class ProjectConfigurator { - - public static final String SEPARATOR = ","; - - /** - * Tell if this project configurator can configure the given project. - */ - public abstract boolean canConfigure(IProject project); - - /** - * Configures SonarLint analysis, using information from Eclipse project. - */ - public abstract void configure(ProjectConfigurationRequest request, IProgressMonitor monitor); - - /** - * This method is called after analysis is finished - * @param analysisProperties Properties used during the analysis - */ - public void analysisComplete(Map analysisProperties, IProgressMonitor monitor) { - // Do nothing by default - } - - @Override - public String toString() { - return getClass().getName(); - } - - public static void appendProperty(Map properties, String key, String value) { - if (value == null) { - return; - } - var newValue = properties.get(key); - if (newValue != null) { - newValue += SEPARATOR + value; - } else { - newValue = value; - } - properties.put(key, newValue); - } - - public static void setPropertyList(Map properties, String key, Collection values) { - properties.put(key, StringUtils.joinWithCommaSkipNull(values)); - } - - public static void appendPropertyList(Map properties, String key, Collection values) { - appendProperty(properties, key, StringUtils.joinWithCommaSkipNull(values)); - } - -} diff --git a/org.sonarlint.eclipse.core/src/org/sonarlint/eclipse/core/configurator/package-info.java b/org.sonarlint.eclipse.core/src/org/sonarlint/eclipse/core/configurator/package-info.java deleted file mode 100644 index 2b1add5f4..000000000 --- a/org.sonarlint.eclipse.core/src/org/sonarlint/eclipse/core/configurator/package-info.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * SonarLint for Eclipse - * Copyright (C) 2015-2025 SonarSource SA - * sonarlint@sonarsource.com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -@org.eclipse.jdt.annotation.NonNullByDefault -package org.sonarlint.eclipse.core.configurator; diff --git a/org.sonarlint.eclipse.core/src/org/sonarlint/eclipse/core/internal/extension/SonarLintExtensionTracker.java b/org.sonarlint.eclipse.core/src/org/sonarlint/eclipse/core/internal/extension/SonarLintExtensionTracker.java index 748edeb06..cac495d93 100644 --- a/org.sonarlint.eclipse.core/src/org/sonarlint/eclipse/core/internal/extension/SonarLintExtensionTracker.java +++ b/org.sonarlint.eclipse.core/src/org/sonarlint/eclipse/core/internal/extension/SonarLintExtensionTracker.java @@ -24,7 +24,6 @@ import org.sonarlint.eclipse.core.analysis.IAnalysisConfigurator; import org.sonarlint.eclipse.core.analysis.IFileLanguageProvider; import org.sonarlint.eclipse.core.analysis.IFileTypeProvider; -import org.sonarlint.eclipse.core.configurator.ProjectConfigurator; import org.sonarlint.eclipse.core.resource.IProjectScopeProvider; import org.sonarlint.eclipse.core.resource.ISonarLintFileAdapterParticipant; import org.sonarlint.eclipse.core.resource.ISonarLintProjectAdapterParticipant; @@ -35,7 +34,6 @@ public class SonarLintExtensionTracker extends AbstractSonarLintExtensionTracker private static SonarLintExtensionTracker singleInstance = null; - private final SonarLintEP configuratorEp = new SonarLintEP<>("org.sonarlint.eclipse.core.projectConfigurators"); //$NON-NLS-1$ private final SonarLintEP analysisEp = new SonarLintEP<>("org.sonarlint.eclipse.core.analysisConfigurator"); //$NON-NLS-1$ private final SonarLintEP projectsProviderEp = new SonarLintEP<>("org.sonarlint.eclipse.core.projectsProvider"); //$NON-NLS-1$ private final SonarLintEP fileAdapterParticipantEp = new SonarLintEP<>("org.sonarlint.eclipse.core.fileAdapterParticipant"); //$NON-NLS-1$ @@ -48,7 +46,7 @@ public class SonarLintExtensionTracker extends AbstractSonarLintExtensionTracker private final SonarLintEP projectScopeProviderEP = new SonarLintEP<>( "org.sonarlint.eclipse.core.projectScopeProvider"); //$NON-NLS-1$ - private final Collection> allEps = List.of(configuratorEp, analysisEp, projectsProviderEp, + private final Collection> allEps = List.of(analysisEp, projectsProviderEp, fileAdapterParticipantEp, projectAdapterParticipantEp, languageEp, typeEp, projectHierarchyProviderEP, projectScopeProviderEP); @@ -69,10 +67,6 @@ public static void close() { } } - public Collection getConfigurators() { - return configuratorEp.getInstances(); - } - public Collection getAnalysisConfigurators() { return analysisEp.getInstances(); } diff --git a/org.sonarlint.eclipse.core/src/org/sonarlint/eclipse/core/internal/jobs/AnalyzeProjectJob.java b/org.sonarlint.eclipse.core/src/org/sonarlint/eclipse/core/internal/jobs/AnalyzeProjectJob.java index 3d39c00a0..e0ce94a3c 100644 --- a/org.sonarlint.eclipse.core/src/org/sonarlint/eclipse/core/internal/jobs/AnalyzeProjectJob.java +++ b/org.sonarlint.eclipse.core/src/org/sonarlint/eclipse/core/internal/jobs/AnalyzeProjectJob.java @@ -28,12 +28,9 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; @@ -45,8 +42,6 @@ import org.sonarlint.eclipse.core.SonarLintNotifications; import org.sonarlint.eclipse.core.analysis.IAnalysisConfigurator; import org.sonarlint.eclipse.core.analysis.IPostAnalysisContext; -import org.sonarlint.eclipse.core.configurator.ProjectConfigurationRequest; -import org.sonarlint.eclipse.core.configurator.ProjectConfigurator; import org.sonarlint.eclipse.core.documentation.SonarLintDocumentation; import org.sonarlint.eclipse.core.internal.SonarLintCorePlugin; import org.sonarlint.eclipse.core.internal.TriggerType; @@ -139,7 +134,6 @@ protected IStatus doRun(final IProgressMonitor monitor) { SonarLintLogger.get().info(this.getName() + "..."); // Configure var mergedExtraProps = new LinkedHashMap(); - var usedDeprecatedConfigurators = configureDeprecated(getProject(), filesToAnalyzeMap.keySet(), mergedExtraProps, monitor); analysisWorkDir = Files.createTempDirectory(getProject().getWorkingDir(), "sonarlint"); var inputFiles = buildInputFiles(analysisWorkDir, filesToAnalyzeMap); @@ -182,7 +176,7 @@ protected IStatus doRun(final IProgressMonitor monitor) { var result = run(filesToAnalyzeMap.keySet(), mergedExtraProps, start, monitor); } - analysisCompleted(usedDeprecatedConfigurators, usedConfigurators, mergedExtraProps, monitor); + analysisCompleted(usedConfigurators, mergedExtraProps, monitor); SonarLintLogger.get().debug(String.format("Done in %d ms", System.currentTimeMillis() - startTime)); } catch (CanceledException e) { return Status.CANCEL_STATUS; @@ -244,29 +238,6 @@ private static List buildInputFiles(Path tempDirectory, final return inputFiles; } - private static Collection configureDeprecated(final ISonarLintProject project, Collection filesToAnalyze, - final Map extraProperties, - final IProgressMonitor monitor) { - var usedConfigurators = new ArrayList(); - if (project.getResource() instanceof IProject) { - var configuratorRequest = new ProjectConfigurationRequest((IProject) project.getResource(), - filesToAnalyze.stream() - .map(f -> (f.getResource() instanceof IFile) ? (IFile) f.getResource() : null) - .filter(Objects::nonNull) - .collect(Collectors.toList()), - extraProperties); - var configurators = SonarLintExtensionTracker.getInstance().getConfigurators(); - for (var configurator : configurators) { - if (configurator.canConfigure((IProject) project.getResource())) { - configurator.configure(configuratorRequest, monitor); - usedConfigurators.add(configurator); - } - } - } - - return usedConfigurators; - } - private static Collection configure(final ISonarLintProject project, List filesToAnalyze, final Map extraProperties, Path tempDir, final IProgressMonitor monitor) { var usedConfigurators = new ArrayList(); @@ -282,14 +253,11 @@ private static Collection configure(final ISonarLintProje return usedConfigurators; } - private static void analysisCompleted(Collection usedDeprecatedConfigurators, Collection usedConfigurators, + private static void analysisCompleted(Collection usedConfigurators, Map properties, final IProgressMonitor monitor) { var unmodifiableMap = Collections.unmodifiableMap(properties); - for (var p : usedDeprecatedConfigurators) { - p.analysisComplete(unmodifiableMap, monitor); - } - var context = new IPostAnalysisContext() { + var context = new IPostAnalysisContext() { @Override public ISonarLintProject getProject() { return getProject(); diff --git a/org.sonarlint.eclipse.core/src/org/sonarlint/eclipse/core/internal/preferences/SonarLintProjectConfigurationManager.java b/org.sonarlint.eclipse.core/src/org/sonarlint/eclipse/core/internal/preferences/SonarLintProjectConfigurationManager.java index cdcf37c1e..b9073ecde 100644 --- a/org.sonarlint.eclipse.core/src/org/sonarlint/eclipse/core/internal/preferences/SonarLintProjectConfigurationManager.java +++ b/org.sonarlint.eclipse.core/src/org/sonarlint/eclipse/core/internal/preferences/SonarLintProjectConfigurationManager.java @@ -29,7 +29,6 @@ import org.sonarlint.eclipse.core.resource.ISonarLintProject; import static java.util.Optional.ofNullable; -import static org.sonarlint.eclipse.core.internal.utils.StringUtils.isBlank; import static org.sonarlint.eclipse.core.internal.utils.StringUtils.isNotBlank; public class SonarLintProjectConfigurationManager { @@ -49,11 +48,6 @@ public class SonarLintProjectConfigurationManager { */ @Deprecated(since = "10.0") private static final String P_IDE_PREFIX_KEY = "idePrefixKey"; - /** - * @deprecated since 3.7 - */ - @Deprecated(since = "3.7") - private static final String P_MODULE_KEY = "moduleKey"; private static final String P_AUTO_ENABLED_KEY = "autoEnabled"; public static final String P_BINDING_SUGGESTIONS_DISABLED_KEY = "bindingSuggestionsDisabled"; public static final String P_INDEXING_BASED_ON_ECLIPSE_PLUGINS = "indexingBasedOnEclipsePlugIns"; @@ -86,11 +80,6 @@ public SonarLintProjectConfiguration load(IScopeContext projectScope, String pro projectConfig.getExtraProperties().addAll(sonarProperties); projectConfig.getFileExclusions().addAll(fileExclusions); var projectKey = projectNode.get(P_PROJECT_KEY, ""); - var moduleKey = projectNode.get(P_MODULE_KEY, ""); - if (isBlank(projectKey) && isNotBlank(moduleKey)) { - SonarLintLogger.get().info("Binding configuration of project '" + projectName + "' is outdated. Please rebind this project."); - } - projectNode.remove(P_MODULE_KEY); var connectionId = projectNode.get(P_CONNECTION_ID, ""); if (isNotBlank(connectionId) && isNotBlank(projectKey)) { projectConfig.setProjectBinding(new EclipseProjectBinding(connectionId, projectKey));