Skip to content

Commit

Permalink
3.x: Replace manual casts on pattern with instanceof in HoconConfigPa…
Browse files Browse the repository at this point in the history
…rser (helidon-io#9217)
  • Loading branch information
Captain1653 authored Aug 29, 2024
1 parent 7b8dc43 commit 6628b98
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 @@ -159,10 +159,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 @@ -185,10 +185,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 6628b98

Please sign in to comment.