don't load BootstrapBundle and CoreBundle without a reason
authorVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Mon, 21 Sep 2020 18:54:41 +0000 (20:54 +0200)
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>
Mon, 21 Sep 2020 19:09:01 +0000 (19:09 +0000)
GitOrigin-RevId: 64212426282496c00cd83d69a62679151800fbf1

platform/bootstrap/src/com/intellij/ide/BootstrapBundle.java
platform/core-api/src/com/intellij/core/CoreBundle.java
platform/core-impl/src/com/intellij/ide/plugins/IdeaPluginDescriptorImpl.java
platform/editor-ui-api/src/com/intellij/ide/ui/AntialiasingType.java
platform/platform-api/src/com/intellij/ide/ui/LafManager.java
platform/platform-impl/src/com/intellij/idea/StartupUtil.java

index 000a6b549f0a5eb5897a1ed0ee00e040489fe306..67a30b90f2bc24e81e904718ec791d599f5415c9 100644 (file)
@@ -7,10 +7,11 @@ import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 import org.jetbrains.annotations.PropertyKey;
 
-public class BootstrapBundle extends AbstractBundle {
+public final class BootstrapBundle extends AbstractBundle {
   private static final String BUNDLE = "messages.BootstrapBundle";
 
   private static final @Nullable BootstrapBundle INSTANCE;
+
   static {
     BootstrapBundle instance = null;
     try {
index 46f0f06e26ca248652174e146054a4b26d1420fa..491bb1fdcbb03ff8c22665c45692d6acc4580abb 100644 (file)
@@ -8,7 +8,7 @@ import java.util.function.Supplier;
 
 public final class CoreBundle extends DynamicBundle {
   @NonNls private static final String BUNDLE = "messages.CoreBundle";
-  private static final CoreBundle INSTANCE = new CoreBundle();
+  public static final CoreBundle INSTANCE = new CoreBundle();
 
   private CoreBundle() {
     super(BUNDLE);
index c65fc99e8df21e27bc0660b4d9577b3549b92e1d..efce155fe9649a9a05235baf99f33cae313666ed 100644 (file)
@@ -366,7 +366,9 @@ public final class IdeaPluginDescriptorImpl implements IdeaPluginDescriptor {
     // context.isPluginIncomplete must be not checked here as another version of plugin maybe supplied later from another source
     if (context.isPluginDisabled(dependencyId)) {
       if (!isOptional) {
-        markAsIncomplete(context, CoreBundle.messagePointer("plugin.loading.error.short.depends.on.disabled.plugin", dependencyId), dependencyId);
+        markAsIncomplete(context, () -> {
+          return CoreBundle.message("plugin.loading.error.short.depends.on.disabled.plugin", dependencyId);
+        }, dependencyId);
       }
 
       isDisabledOrBroken = true;
index d1af0e24b6d5b8facf9209f8873b1e7e1444d2eb..89f81e5e3e93d3ea3648131fa6d2925a2cf661f9 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
+// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
 package com.intellij.ide.ui;
 
 import com.intellij.openapi.editor.PlatformEditorBundle;
@@ -14,9 +14,9 @@ import java.util.function.Supplier;
 import static org.jetbrains.annotations.Nls.Capitalization.Sentence;
 
 public enum AntialiasingType {
-  SUBPIXEL(PlatformEditorBundle.messagePointer("settings.editor.antialiasing.subpixel"), RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB, true),
-  GREYSCALE(PlatformEditorBundle.messagePointer("settings.editor.antialiasing.greyscale"), RenderingHints.VALUE_TEXT_ANTIALIAS_ON, true),
-  OFF(PlatformEditorBundle.messagePointer("settings.editor.antialiasing.no.antialiasing"), RenderingHints.VALUE_TEXT_ANTIALIAS_OFF, false);
+  SUBPIXEL(() -> PlatformEditorBundle.message("settings.editor.antialiasing.subpixel"), RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB, true),
+  GREYSCALE(() ->  PlatformEditorBundle.message("settings.editor.antialiasing.greyscale"), RenderingHints.VALUE_TEXT_ANTIALIAS_ON, true),
+  OFF(() -> PlatformEditorBundle.message("settings.editor.antialiasing.no.antialiasing"), RenderingHints.VALUE_TEXT_ANTIALIAS_OFF, false);
 
   public static Object getAAHintForSwingComponent() {
     UISettings uiSettings = UISettings.getInstanceOrNull();
index 3716baec47fd88ab111e2c78e790b3ad2bd2402b..83e6a00c7efdf8910e5703a4674e89743f092641 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
+// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
 package com.intellij.ide.ui;
 
 import com.intellij.ide.IdeBundle;
@@ -71,7 +71,7 @@ public abstract class LafManager {
   @Deprecated
   public abstract void removeLafManagerListener(@NotNull LafManagerListener listener);
 
-  public static class LafReference {
+  public static final class LafReference {
     public static final LafReference SYNC_OS = new LafReference(IdeBundle.message("preferred.theme.autodetect.selector"), null, null);
 
     private final String name;
index 203da6e36fce6c5d4f84d323ffff94b456aa1f52..5690dcfd3b65d765ebfaa1bf82823d9e67a4707f 100644 (file)
@@ -45,7 +45,10 @@ import org.apache.log4j.ConsoleAppender;
 import org.apache.log4j.Level;
 import org.apache.log4j.PatternLayout;
 import org.apache.log4j.helpers.LogLog;
-import org.jetbrains.annotations.*;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.annotations.TestOnly;
 import org.jetbrains.io.BuiltInServer;
 
 import javax.swing.*;
@@ -483,35 +486,36 @@ public final class StartupUtil {
   }
 
   private static boolean checkDirectory(@NotNull Path directory, String kind, String property, boolean checkWrite, boolean checkLock, boolean checkExec) {
-    @Nls String problem = null, reason = null;
+    String problem = null;
+    String reason = null;
     Path tempFile = null;
 
     try {
-      problem = BootstrapBundle.message("bootstrap.error.message.check.ide.directory.problem.cannot.create.the.directory");
-      reason = BootstrapBundle.message("bootstrap.error.message.check.ide.directory.possible.reason.path.is.incorrect");
+      problem = "bootstrap.error.message.check.ide.directory.problem.cannot.create.the.directory";
+      reason = "bootstrap.error.message.check.ide.directory.possible.reason.path.is.incorrect";
       if (!Files.isDirectory(directory)) {
-        problem = BootstrapBundle.message("bootstrap.error.message.check.ide.directory.problem.cannot.create.the.directory");
-        reason = BootstrapBundle.message("bootstrap.error.message.check.ide.directory.possible.reason.directory.is.read.only.or.the.user.lacks.necessary.permissions");
+        problem = "bootstrap.error.message.check.ide.directory.problem.cannot.create.the.directory";
+        reason = "bootstrap.error.message.check.ide.directory.possible.reason.directory.is.read.only.or.the.user.lacks.necessary.permissions";
         Files.createDirectories(directory);
       }
 
       if (checkWrite || checkLock || checkExec) {
-        problem = BootstrapBundle.message("bootstrap.error.message.check.ide.directory.problem.the.ide.cannot.create.a.temporary.file.in.the.directory");
-        reason = BootstrapBundle.message("bootstrap.error.message.check.ide.directory.possible.reason.directory.is.read.only.or.the.user.lacks.necessary.permissions");
+        problem = "bootstrap.error.message.check.ide.directory.problem.the.ide.cannot.create.a.temporary.file.in.the.directory";
+        reason = "bootstrap.error.message.check.ide.directory.possible.reason.directory.is.read.only.or.the.user.lacks.necessary.permissions";
         tempFile = directory.resolve("ij" + new Random().nextInt(Integer.MAX_VALUE) + ".tmp");
         OpenOption[] options = {StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE};
         Files.write(tempFile, "#!/bin/sh\nexit 0".getBytes(StandardCharsets.UTF_8), options);
 
         if (checkLock) {
-          problem = BootstrapBundle.message("bootstrap.error.message.check.ide.directory.problem.the.ide.cannot.create.a.lock.in.directory");
-          reason = BootstrapBundle.message("bootstrap.error.message.check.ide.directory.possible.reason.the.directory.is.located.on.a.network.disk");
+          problem = "bootstrap.error.message.check.ide.directory.problem.the.ide.cannot.create.a.lock.in.directory";
+          reason = "bootstrap.error.message.check.ide.directory.possible.reason.the.directory.is.located.on.a.network.disk";
           try (FileChannel channel = FileChannel.open(tempFile, StandardOpenOption.WRITE); FileLock lock = channel.tryLock()) {
             if (lock == null) throw new IOException("File is locked");
           }
         }
         else if (checkExec) {
-          problem = BootstrapBundle.message("bootstrap.error.message.check.ide.directory.problem.the.ide.cannot.execute.test.script");
-          reason = BootstrapBundle.message("bootstrap.error.message.check.ide.directory.possible.reason.partition.is.mounted.with.no.exec.option");
+          problem = "bootstrap.error.message.check.ide.directory.problem.the.ide.cannot.execute.test.script";
+          reason = "bootstrap.error.message.check.ide.directory.possible.reason.partition.is.mounted.with.no.exec.option";
           Files.getFileAttributeView(tempFile, PosixFileAttributeView.class).setPermissions(EnumSet.of(OWNER_READ, OWNER_WRITE, OWNER_EXECUTE));
           int ec = new ProcessBuilder(tempFile.toAbsolutePath().toString()).start().waitFor();
           if (ec != 0) {
@@ -528,7 +532,7 @@ public final class StartupUtil {
                       ? BootstrapBundle.message("bootstrap.error.message.invalid.ide.directory.trans.located.macos.directory.advice")
                       : BootstrapBundle.message("bootstrap.error.message.invalid.ide.directory.ensure.the.modified.property.0.is.correct", property);
       String message = BootstrapBundle.message("bootstrap.error.message.invalid.ide.directory.problem.0.possible.reason.1.advice.2.location.3.exception.class.4.exception.message.5",
-                                               problem, reason, advice, directory, e.getClass().getName(), e.getMessage());
+                                               BootstrapBundle.message(problem), BootstrapBundle.message(reason), advice, directory, e.getClass().getName(), e.getMessage());
       Main.showMessage(title, message, true);
       return false;
     }