Skip to content

Commit 6b32767

Browse files
wenytang-msCopilot
andcommitted
Exclude Map.Entry from lazy loading to show key:value inline
Map.Entry objects were incorrectly treated as lazy-loading candidates because they are included in COLLECTION_TYPES. This caused the debugger to display entries as 'HashMap$Node@id' instead of showing the actual key:value details inline. Map.Entry's details computation (getKey + getValue) is lightweight, so eager evaluation is safe and significantly improves UX when debugging large Maps. Fixes microsoft/vscode-java-debug#1605 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent b35f033 commit 6b32767

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/variables/VariableDetailUtils.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,13 @@ public static boolean isLazyLoadingSupported(Value value) {
163163
return false;
164164
}
165165
String inheritedType = findInheritedType(value, COLLECTION_TYPES);
166+
// Map.Entry should not use lazy loading because its details computation
167+
// (getKey + getValue) is lightweight and showing "key:value" inline
168+
// significantly improves UX for large Maps. See
169+
// https://github.com/microsoft/vscode-java-debug/issues/1605
170+
if (Objects.equals(inheritedType, ENTRY_TYPE)) {
171+
return false;
172+
}
166173
if (inheritedType == null && !containsToStringMethod((ObjectReference) value)) {
167174
return false;
168175
}

0 commit comments

Comments
 (0)