diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacConfiguration.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacConfiguration.java index 8e5fed0c29f6..71712296c635 100755 --- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacConfiguration.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacConfiguration.java @@ -1,10 +1,7 @@ // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.compiler.impl.javaCompiler.javac; -import com.intellij.openapi.components.PathMacroManager; -import com.intellij.openapi.components.PersistentStateComponent; -import com.intellij.openapi.components.State; -import com.intellij.openapi.components.Storage; +import com.intellij.openapi.components.*; import com.intellij.openapi.project.Project; import com.intellij.util.xmlb.XmlSerializerUtil; import org.jetbrains.annotations.NotNull; @@ -13,7 +10,7 @@ import org.jetbrains.jps.model.java.compiler.JpsJavaCompilerOptions; import java.util.HashMap; import java.util.Map; -@SuppressWarnings("LightServiceMigrationCode") +@Service(Service.Level.PROJECT) @State(name = "JavacSettings", storages = @Storage("compiler.xml")) public final class JavacConfiguration implements PersistentStateComponent { private final JpsJavaCompilerOptions mySettings = new JpsJavaCompilerOptions(); @@ -27,7 +24,8 @@ public final class JavacConfiguration implements PersistentStateComponent(state.ADDITIONAL_OPTIONS_OVERRIDE); // copyBean copies by reference, we need a map clone here + // `copyBean` copies by reference, we need a map clone here + state.ADDITIONAL_OPTIONS_OVERRIDE = new HashMap<>(state.ADDITIONAL_OPTIONS_OVERRIDE); final PathMacroManager macros = PathMacroManager.getInstance(project); state.ADDITIONAL_OPTIONS_STRING = macros.collapsePathsRecursively(state.ADDITIONAL_OPTIONS_STRING); for (Map.Entry entry : state.ADDITIONAL_OPTIONS_OVERRIDE.entrySet()) { @@ -41,7 +39,8 @@ public final class JavacConfiguration implements PersistentStateComponent aClass) { + // we cannot change the signature of this method to preserve backward compatibility + public static JpsJavaCompilerOptions getOptions(Project project, @SuppressWarnings("TypeParameterExtendsFinalClass") Class aClass) { JavacConfiguration configuration = project.getService(aClass); return configuration.mySettings; } diff --git a/java/java-impl/resources/META-INF/JavaPlugin.xml b/java/java-impl/resources/META-INF/JavaPlugin.xml index aa61daa8a28a..49991bcb87cc 100644 --- a/java/java-impl/resources/META-INF/JavaPlugin.xml +++ b/java/java-impl/resources/META-INF/JavaPlugin.xml @@ -542,7 +542,6 @@ serviceImplementation="com.intellij.openapi.vcs.impl.ModuleVcsPathPresenter" overrides="true"/> -