Skip to content

Commit 3b5615c

Browse files
authored
4.x: Replace manual casts on pattern with instanceof in HoconConfigParser (#9209)
1 parent 6ce7183 commit 3b5615c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

config/hocon/src/main/java/io/helidon/config/hocon/HoconConfigParser.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020, 2022 Oracle and/or its affiliates.
2+
* Copyright (c) 2020, 2024 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -155,10 +155,10 @@ private static ObjectNode fromConfig(ConfigObject config) {
155155
ObjectNode.Builder builder = ObjectNode.builder();
156156
config.forEach((unescapedKey, value) -> {
157157
String key = io.helidon.config.Config.Key.escapeName(unescapedKey);
158-
if (value instanceof ConfigList) {
159-
builder.addList(key, fromList((ConfigList) value));
160-
} else if (value instanceof ConfigObject) {
161-
builder.addObject(key, fromConfig((ConfigObject) value));
158+
if (value instanceof ConfigList configList) {
159+
builder.addList(key, fromList(configList));
160+
} else if (value instanceof ConfigObject configObject) {
161+
builder.addObject(key, fromConfig(configObject));
162162
} else {
163163
try {
164164
Object unwrapped = value.unwrapped();
@@ -181,10 +181,10 @@ private static ObjectNode fromConfig(ConfigObject config) {
181181
private static ListNode fromList(ConfigList list) {
182182
ListNode.Builder builder = ListNode.builder();
183183
list.forEach(value -> {
184-
if (value instanceof ConfigList) {
185-
builder.addList(fromList((ConfigList) value));
186-
} else if (value instanceof ConfigObject) {
187-
builder.addObject(fromConfig((ConfigObject) value));
184+
if (value instanceof ConfigList configList) {
185+
builder.addList(fromList(configList));
186+
} else if (value instanceof ConfigObject configObject) {
187+
builder.addObject(fromConfig(configObject));
188188
} else {
189189
try {
190190
Object unwrapped = value.unwrapped();

0 commit comments

Comments
 (0)