From f97bd765ee6cf724eb3fed1a9d0695d816ea2fcc Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Fri, 8 Jul 2016 01:42:52 +0200 Subject: [PATCH] new BidiRun[0] happens too often. Introduce EMPTY_ARRAY --- .../com/intellij/openapi/editor/impl/view/LineLayout.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/view/LineLayout.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/view/LineLayout.java index 547c9ad38289..d3e8a467a1e8 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/view/LineLayout.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/view/LineLayout.java @@ -266,7 +266,7 @@ abstract class LineLayout { assert startOffset <= endOffset; final BidiRun[] runs; if (startOffset == endOffset) { - runs = new BidiRun[0]; + runs = BidiRun.EMPTY_ARRAY; } else { List runList = new ArrayList(); @@ -338,7 +338,7 @@ abstract class LineLayout { } private BidiRun[] createRuns() { - if (myChunk == null) return new BidiRun[0]; + if (myChunk == null) return BidiRun.EMPTY_ARRAY; BidiRun run = new BidiRun(myChunk.endOffset); run.chunks = new Chunk[] {myChunk}; return new BidiRun[] {run}; @@ -474,6 +474,7 @@ abstract class LineLayout { } private static class BidiRun { + public static final BidiRun[] EMPTY_ARRAY = new BidiRun[0]; private static final int CHUNK_CHARACTERS = 1024; private final byte level;