mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-150675 Lambda objects are rendered in an incomprehensive way
This commit is contained in:
@@ -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.
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.intellij.debugger.engine;
|
||||
|
||||
import com.sun.jdi.ReferenceType;
|
||||
import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.sun.jdi.TypeComponent;
|
||||
import com.sun.jdi.VirtualMachine;
|
||||
|
||||
@@ -30,8 +30,7 @@ public class DefaultSyntheticProvider implements SyntheticTypeComponentProvider
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
ReferenceType type = typeComponent.declaringType();
|
||||
if (type.name().contains("$$Lambda$")) {
|
||||
if (DebuggerUtilsEx.isLambdaClassName(typeComponent.declaringType().name())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -808,6 +808,15 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isLambdaClassName(String typeName) {
|
||||
return getLambdaBaseClassName(typeName) != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getLambdaBaseClassName(String typeName) {
|
||||
return StringUtil.substringBefore(typeName, "$$Lambda$");
|
||||
}
|
||||
|
||||
public static List<PsiLambdaExpression> collectLambdas(@NotNull SourcePosition position, final boolean onlyOnTheLine) {
|
||||
ApplicationManager.getApplication().assertReadAccessAllowed();
|
||||
PsiFile file = position.getFile();
|
||||
|
||||
@@ -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.
|
||||
@@ -22,6 +22,7 @@ import com.intellij.debugger.engine.DebuggerUtils;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContext;
|
||||
import com.intellij.debugger.engine.jdi.StackFrameProxy;
|
||||
import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.intellij.debugger.ui.impl.watch.FieldDescriptorImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.MessageDescriptor;
|
||||
import com.intellij.debugger.ui.impl.watch.NodeManagerImpl;
|
||||
@@ -80,6 +81,11 @@ public class ClassRenderer extends NodeRendererImpl{
|
||||
if (SHOW_FQ_TYPE_NAMES) {
|
||||
return typeName;
|
||||
}
|
||||
String baseLambdaClassName = DebuggerUtilsEx.getLambdaBaseClassName(typeName);
|
||||
if (baseLambdaClassName != null) {
|
||||
return renderTypeName(baseLambdaClassName) + "$lambda";
|
||||
}
|
||||
|
||||
final int dotIndex = typeName.lastIndexOf('.');
|
||||
if (dotIndex > 0) {
|
||||
return typeName.substring(dotIndex + 1);
|
||||
|
||||
Reference in New Issue
Block a user