nandorKollar commented on code in PR #3805:
URL: https://github.com/apache/polaris/pull/3805#discussion_r2820813143


##########
polaris-core/src/main/java/org/apache/polaris/core/config/PolarisConfiguration.java:
##########
@@ -173,17 +173,24 @@ public T resolveValue(
       return defaultValue();
     }
 
-    if (defaultValue() instanceof Boolean) {
+    Object defaultValue = defaultValue();
+
+    // If value is already the same type as the default, no conversion needed
+    if (defaultValue.getClass().isInstance(value)) {
+      return cast(value);
+    }
+
+    if (defaultValue instanceof Boolean) {

Review Comment:
   nit: Would it make sense to turn this `if-else if` to switch expression, 
something like this:
   ```
       return switch (defaultValue()) {
             case Boolean ignored -> 
cast(Boolean.valueOf(String.valueOf(value)));
             case Integer ignored -> 
cast(Integer.valueOf(String.valueOf(value)));
             case Long ignored -> cast(Long.valueOf(String.valueOf(value)));
             case Double ignored -> cast(Double.valueOf(String.valueOf(value)));
             case Float ignored -> cast(Float.valueOf(String.valueOf(value)));
             case List<?> ignored -> cast(new ArrayList<>((List<?>) value));
             case null, default -> cast(value);
         };
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to