From 8d566906e01445d830e9c8ec57ea8d5847e1da65 Mon Sep 17 00:00:00 2001 From: Egor Ushakov Date: Tue, 27 Aug 2024 11:01:21 +0200 Subject: [PATCH] IDEA-358202 toString() on array works incorrectly in debugger GitOrigin-RevId: a54e56b18d7491bd1810ef39e85e10d73e9a87c3 --- .../intellij/debugger/engine/DebuggerUtils.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/java/debugger/openapi/src/com/intellij/debugger/engine/DebuggerUtils.java b/java/debugger/openapi/src/com/intellij/debugger/engine/DebuggerUtils.java index 7f2c3d1155d8..e484c510eb94 100644 --- a/java/debugger/openapi/src/com/intellij/debugger/engine/DebuggerUtils.java +++ b/java/debugger/openapi/src/com/intellij/debugger/engine/DebuggerUtils.java @@ -1,4 +1,4 @@ -// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.debugger.engine; import com.intellij.debugger.DebuggerContext; @@ -95,13 +95,14 @@ public abstract class DebuggerUtils { return String.valueOf(((PrimitiveValue)value).charValue()); } if (value instanceof ObjectReference objRef) { - if (value instanceof ArrayReference arrayRef) { - final StringJoiner joiner = new StringJoiner(",", "[", "]"); - for (final Value element : arrayRef.getValues()) { - joiner.add(getValueAsString(evaluationContext, element)); - } - return joiner.toString(); - } + // We can not pretty print arrays here, otherwise evaluation may fail unexpectedly, check IDEA-358202 + //if (value instanceof ArrayReference arrayRef) { + // final StringJoiner joiner = new StringJoiner(",", "[", "]"); + // for (final Value element : arrayRef.getValues()) { + // joiner.add(getValueAsString(evaluationContext, element)); + // } + // return joiner.toString(); + //} final DebugProcess debugProcess = evaluationContext.getDebugProcess(); Method toStringMethod = debugProcess.getUserData(TO_STRING_METHOD_KEY);