lazy get logger, Disposer.isDebugMode() is useless in this place because not yet initialized

GitOrigin-RevId: 4962986e0c139a1d5603840fe881b2a3069ef09b
This commit is contained in:
Vladimir Krivosheev
2019-05-29 21:09:12 +03:00
committed by intellij-monorepo-bot
parent 75a82a2d60
commit b5726b5a26
2 changed files with 12 additions and 22 deletions
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// 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.
package com.intellij.openapi.util.objectTree;
import com.intellij.openapi.Disposable;
@@ -34,8 +20,6 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
public final class ObjectTree<T extends Disposable> {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.util.objectTree.ObjectTree");
private static final ThreadLocal<Throwable> ourTopmostDisposeTrace = new ThreadLocal<>();
private final List<ObjectTreeListener> myListeners = ContainerUtil.createLockFreeCopyOnWriteList();
@@ -179,7 +163,7 @@ public final class ObjectTree<T extends Disposable> {
if (!exceptions.isEmpty()) {
for (Throwable exception : exceptions) {
if (!(exception instanceof ProcessCanceledException)) {
LOG.error(exception);
getLogger().error(exception);
}
}
@@ -259,11 +243,16 @@ public final class ObjectTree<T extends Disposable> {
if (throwError) {
throw exception;
}
LOG.error(exception);
getLogger().error(exception);
}
}
}
@NotNull
private static Logger getLogger() {
return Logger.getInstance("#com.intellij.openapi.util.objectTree.ObjectTree");
}
@TestOnly
public boolean isEmpty() {
synchronized (treeLock) {
@@ -3,7 +3,6 @@ package com.intellij.util.ui;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.registry.Registry;
@@ -289,7 +288,9 @@ public class JBUI {
// Downgrading user scale below 1.0 may be uncomfortable (tiny icons),
// whereas some users prefer font size slightly below normal which is ok.
if (!Disposer.isDebugMode() && scale < 1 && sysScale() >= 1) scale = 1;
if (scale < 1 && sysScale() >= 1) {
scale = 1;
}
// Ignore the correction when UIUtil.DEF_SYSTEM_FONT_SIZE is overridden, see UIUtil.initSystemFontData.
if (SystemInfo.isLinux && scale == 1.25f && UIUtil.DEF_SYSTEM_FONT_SIZE == 12) {