From 2b7fc4cf83562b7fff5c64db85fcef30e574b377 Mon Sep 17 00:00:00 2001 From: Jaime Wren Date: Mon, 5 Jan 2026 00:54:46 -0800 Subject: [PATCH] Refactor FlutterConsoleLogManager to use SmartList usage patterns SmartList is a memory-efficient List implementation in the IntelliJ Platform, optimized for collections that typically contain 0 or 1 element. This change updates FlutterConsoleLogManager availability for list interface usage, preparing for DiagnosticsNode refactoring. --- .../logging/FlutterConsoleLogManager.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/io/flutter/logging/FlutterConsoleLogManager.java b/src/io/flutter/logging/FlutterConsoleLogManager.java index d50d19d1f..2372f6b62 100644 --- a/src/io/flutter/logging/FlutterConsoleLogManager.java +++ b/src/io/flutter/logging/FlutterConsoleLogManager.java @@ -43,8 +43,8 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.ArrayList; import java.util.Collections; +import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executors; @@ -186,7 +186,7 @@ public void flushFlutterErrorQueue() { private static final int errorSeparatorLength = 100; private static final String errorSeparatorChar = "="; - private static final ArrayList emptyList = new ArrayList<>(); + private static final List emptyList = Collections.emptyList(); /** * Pretty print the error using the available console syling attributes. @@ -257,8 +257,8 @@ private void printTerseNodeProperty(ConsoleView console, String indent, Diagnost skip = false; } else if (property.hasChildren()) { - final CompletableFuture> future = property.getChildren(); - final ArrayList children = future.getNow(emptyList); + final CompletableFuture> future = property.getChildren(); + final List children = future.getNow(emptyList); if (children.stream().noneMatch(DiagnosticsNode::hasChildren)) { skip = false; } @@ -292,8 +292,8 @@ else if (property.hasChildren()) { } if (property.hasChildren()) { - final CompletableFuture> future = property.getChildren(); - final ArrayList children = future.getNow(emptyList); + final CompletableFuture> future = property.getChildren(); + final List children = future.getNow(emptyList); for (DiagnosticsNode child : children) { printDiagnosticsNodeProperty(console, childIndent, child, contentType, false); @@ -342,8 +342,8 @@ private void printDiagnosticsNodeProperty(ConsoleView console, String indent, Di } if (property.hasChildren()) { - final CompletableFuture> future = property.getChildren(); - final ArrayList children = future.getNow(emptyList); + final CompletableFuture> future = property.getChildren(); + final List children = future.getNow(emptyList); // Don't collapse children if it's just a flat list of children. if (!isInChild && children.stream().noneMatch(DiagnosticsNode::hasChildren)) {