From 659ad014653ac795f069e82977a53a805da63dc5 Mon Sep 17 00:00:00 2001 From: Joe Gallo Date: Tue, 19 Nov 2024 12:19:44 -0500 Subject: [PATCH] Collapse the condition into the assertion --- .../org/elasticsearch/ingest/PipelineConfiguration.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/ingest/PipelineConfiguration.java b/server/src/main/java/org/elasticsearch/ingest/PipelineConfiguration.java index 2d5655ea53465..64142caf4189d 100644 --- a/server/src/main/java/org/elasticsearch/ingest/PipelineConfiguration.java +++ b/server/src/main/java/org/elasticsearch/ingest/PipelineConfiguration.java @@ -136,12 +136,11 @@ private static Object innerDeepCopy(final Object value, final boolean unmodifiab copy.add(innerDeepCopy(itemValue, unmodifiable)); } return unmodifiable ? Collections.unmodifiableList(copy) : copy; - } else if (value == null || value instanceof String || value instanceof Number || value instanceof Boolean) { - return value; } else { - // if the previous list of expected value types ends up not being exhaustive, then we want to learn about that + // if this list of expected value types ends up not being exhaustive, then we want to learn about that // at development time, but it's probably better to err on the side of passing through the value at runtime - assert false : "unexpected value type [" + value.getClass() + "]"; + assert (value == null || value instanceof String || value instanceof Number || value instanceof Boolean) + : "unexpected value type [" + value.getClass() + "]"; return value; } }