Do not resolve services in static initializers in IDEKotlinBinaryClassCache, KT-33973
This commit is contained in:
+11
-2
@@ -18,6 +18,8 @@ package org.jetbrains.kotlin.idea.core.formatter;
|
||||
|
||||
import com.intellij.application.options.CodeStyle;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.components.Service;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
@@ -33,8 +35,6 @@ import org.jetbrains.kotlin.idea.util.ReflectionUtil;
|
||||
import static com.intellij.util.ReflectionUtil.copyFields;
|
||||
|
||||
public class KotlinCodeStyleSettings extends CustomCodeStyleSettings {
|
||||
public static final KotlinCodeStyleSettings DEFAULT = new KotlinCodeStyleSettings(new CodeStyleSettings());
|
||||
|
||||
public final PackageEntryTable PACKAGES_TO_USE_STAR_IMPORTS = new PackageEntryTable();
|
||||
public boolean SPACE_AROUND_RANGE = false;
|
||||
public boolean SPACE_BEFORE_TYPE_COLON = false;
|
||||
@@ -180,4 +180,13 @@ public class KotlinCodeStyleSettings extends CustomCodeStyleSettings {
|
||||
copyFrom(settingsAgainstPreviousDefaults);
|
||||
}
|
||||
}
|
||||
|
||||
public static KotlinCodeStyleSettings defaultSettings() {
|
||||
return ServiceManager.getService(KotlinCodeStyleSettingsHolder.class).defaultSettings;
|
||||
}
|
||||
|
||||
@Service
|
||||
private static final class KotlinCodeStyleSettingsHolder {
|
||||
private final KotlinCodeStyleSettings defaultSettings = new KotlinCodeStyleSettings(new CodeStyleSettings());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,4 +16,4 @@ fun ASTBlock.requireNode() = node ?: error("ASTBlock.getNode() returned null")
|
||||
/**
|
||||
* Can be removed with all usages after moving master to 1.3 with new default code style settings.
|
||||
*/
|
||||
val isDefaultOfficialCodeStyle by lazy { !KotlinCodeStyleSettings.DEFAULT.CONTINUATION_INDENT_FOR_CHAINED_CALLS }
|
||||
val isDefaultOfficialCodeStyle by lazy { !KotlinCodeStyleSettings.defaultSettings().CONTINUATION_INDENT_FOR_CHAINED_CALLS }
|
||||
Reference in New Issue
Block a user