diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/CodeFragmentFactoryContextWrapper.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/CodeFragmentFactoryContextWrapper.java index f790a0bf68ce..1012a7f2a793 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/CodeFragmentFactoryContextWrapper.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/CodeFragmentFactoryContextWrapper.java @@ -26,6 +26,7 @@ import com.intellij.psi.JavaRecursiveElementVisitor; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiLocalVariable; import com.intellij.util.StringBuilderSpinAllocator; +import com.intellij.util.containers.ContainerUtil; import com.intellij.xdebugger.XDebugSession; import com.intellij.xdebugger.XDebuggerManager; import com.intellij.xdebugger.impl.XDebugSessionImpl; @@ -87,7 +88,7 @@ public class CodeFragmentFactoryContextWrapper extends CodeFragmentFactory { XValueMarkers markers = ((XDebugSessionImpl)session).getValueMarkers(); Map markupMap = markers != null ? markers.getAllMarkers() : null; //final Map markupMap = ValueDescriptorImpl.getMarkupMap(process); - if (markupMap != null && markupMap.size() > 0) { + if (ContainerUtil.isEmpty(markupMap)) { final Pair> markupVariables = createMarkupVariablesText(markupMap); int offset = markupVariables.getFirst().length() - 1; final TextWithImportsImpl textWithImports = new TextWithImportsImpl(CodeFragmentKind.CODE_BLOCK, markupVariables.getFirst(), "", myDelegate.getFileType()); diff --git a/platform/util/src/com/intellij/util/containers/ContainerUtil.java b/platform/util/src/com/intellij/util/containers/ContainerUtil.java index 364df20afe67..2f1ac417c375 100644 --- a/platform/util/src/com/intellij/util/containers/ContainerUtil.java +++ b/platform/util/src/com/intellij/util/containers/ContainerUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -2702,6 +2702,11 @@ public class ContainerUtil extends ContainerUtilRt { return collection == null || collection.isEmpty(); } + @Contract(value = "null -> true", pure = true) + public static boolean isEmpty(Map map) { + return map == null || map.isEmpty(); + } + @NotNull @Contract(pure=true) public static List notNullize(@Nullable List list) {