AryanPatel226 commented on code in PR #3805:
URL: https://github.com/apache/polaris/pull/3805#discussion_r2821227787
##########
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:
@nandorKollar
Good suggestion, but I think this compiles with --release 17, and switch
pattern matching requires Java 21+. So we probably need to keep the if-else.
But let me know if you have some suggestion.
Thank you!!
--
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]