Skip to content

Commit

Permalink
4.x: Replace manual casts on pattern with instanceof in HoconConfigPa…
Browse files Browse the repository at this point in the history
…rser (#9209)
  • Loading branch information
Captain1653 authored Aug 28, 2024
1 parent 6ce7183 commit 3b5615c
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022 Oracle and/or its affiliates.
* Copyright (c) 2020, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -155,10 +155,10 @@ private static ObjectNode fromConfig(ConfigObject config) {
ObjectNode.Builder builder = ObjectNode.builder();
config.forEach((unescapedKey, value) -> {
String key = io.helidon.config.Config.Key.escapeName(unescapedKey);
if (value instanceof ConfigList) {
builder.addList(key, fromList((ConfigList) value));
} else if (value instanceof ConfigObject) {
builder.addObject(key, fromConfig((ConfigObject) value));
if (value instanceof ConfigList configList) {
builder.addList(key, fromList(configList));
} else if (value instanceof ConfigObject configObject) {
builder.addObject(key, fromConfig(configObject));
} else {
try {
Object unwrapped = value.unwrapped();
Expand All @@ -181,10 +181,10 @@ private static ObjectNode fromConfig(ConfigObject config) {
private static ListNode fromList(ConfigList list) {
ListNode.Builder builder = ListNode.builder();
list.forEach(value -> {
if (value instanceof ConfigList) {
builder.addList(fromList((ConfigList) value));
} else if (value instanceof ConfigObject) {
builder.addObject(fromConfig((ConfigObject) value));
if (value instanceof ConfigList configList) {
builder.addList(fromList(configList));
} else if (value instanceof ConfigObject configObject) {
builder.addObject(fromConfig(configObject));
} else {
try {
Object unwrapped = value.unwrapped();
Expand Down

0 comments on commit 3b5615c

Please sign in to comment.