You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "bowsii (via GitHub)" <gi...@apache.org> on 2026/06/13 15:32:45 UTC

[PR] Refactor static map initializations to use Map.ofEntries [polaris]

bowsii opened a new pull request, #4745:
URL: https://github.com/apache/polaris/pull/4745

   Fixes#4744
   
   ## What changes were proposed?
   
   Refactor eligible static map initializations from mutable `HashMap` and `LinkedHashMap` constructions with immediate `put()` calls to `Map.ofEntries()`.
   
   Only locations where maps are created locally, populated immediately, and never modified afterward were updated.
   
   ## Why are the changes needed?
   
   `Map.ofEntries()` provides a more concise and readable way to define immutable maps and better communicates intent by avoiding unnecessary mutable map construction.
   
   ## Does this change introduce any user-facing behavior?
   
   No. This is a refactoring-only change with no intended functional impact.
   
   ## Additional Notes
   
   During verification, several unsafe conversions were identified and reverted:
   
   * Maps requiring downstream mutation
   * Order-sensitive test fixtures
   * Iceberg namespace property maps that rely on mutable map behavior
   
   Only safe immutable-map conversions remain.
   
   ## How was this tested?
   
   * `./gradlew format compileAll`
   * Reviewed all converted locations for mutability requirements
   * Verified ordering-sensitive tests remain correct
   * Ran targeted validation on affected modules
   
   
   ## Checklist
   - [ ] ๐Ÿ›ก๏ธ Don't disclose security issues! (contact security@apache.org)
   - [ ] ๐Ÿ”— Clearly explained why the changes are needed, or linked related issues: Fixes #
   - [ ] ๐Ÿงช Added/updated tests with good coverage, or manually tested (and explained how)
   - [ ] ๐Ÿ’ก Added comments for complex logic
   - [ ] ๐Ÿงพ Updated `CHANGELOG.md` (if needed)
   - [ ] ๐Ÿ“š Updated documentation in `site/content/in-dev/unreleased` (if needed)
   


-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Refactor static map initializations to use Map.ofEntries [polaris]

Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on code in PR #4745:
URL: https://github.com/apache/polaris/pull/4745#discussion_r3412067529


##########
extensions/auth/opa/tests/src/intTest/java/org/apache/polaris/extension/auth/opa/test/OpaTestProfiles.java:
##########
@@ -35,16 +34,15 @@ private OpaTestProfiles() {}
   public static class StaticToken implements QuarkusTestProfile {
     @Override
     public Map<String, String> getConfigOverrides() {
-      Map<String, String> config = new HashMap<>();
-      config.put("polaris.authorization.type", "opa");
-      config.put("polaris.authorization.opa.auth.type", "bearer");
-      config.put(
-          "polaris.authorization.opa.auth.bearer.static-token.value",
-          "test-opa-bearer-token-12345");
-      config.put("polaris.features.\"SUPPORTED_CATALOG_STORAGE_TYPES\"", "[\"FILE\"]");
-      config.put("polaris.features.\"ALLOW_INSECURE_STORAGE_TYPES\"", "true");
-      config.put("polaris.readiness.ignore-severe-issues", "true");
-      return config;
+      return Map.ofEntries(

Review Comment:
   Why not use `Map.of()`?
   
   ```java
         Map.of(
             "polaris.authorization.type", "opa",
             "polaris.authorization.opa.auth.type", "bearer",
             "polaris.authorization.opa.auth.bearer.static-token.value", "test-opa-bearer-token-12345",
             "polaris.features.\"SUPPORTED_CATALOG_STORAGE_TYPES\"", "[\"FILE\"]",
             "polaris.features.\"ALLOW_INSECURE_STORAGE_TYPES\"", "true",
             "polaris.readiness.ignore-severe-issues", "true");
   ```



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Refactor static map initializations to use Map.ofEntries [polaris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #4745: Refactor static map initializations to use Map.ofEntries
URL: https://github.com/apache/polaris/pull/4745


-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Refactor static map initializations to use Map.ofEntries [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4745:
URL: https://github.com/apache/polaris/pull/4745#discussion_r3414628601


##########
extensions/auth/opa/tests/src/intTest/java/org/apache/polaris/extension/auth/opa/test/OpaTestProfiles.java:
##########
@@ -35,16 +34,15 @@ private OpaTestProfiles() {}
   public static class StaticToken implements QuarkusTestProfile {
     @Override
     public Map<String, String> getConfigOverrides() {
-      Map<String, String> config = new HashMap<>();
-      config.put("polaris.authorization.type", "opa");
-      config.put("polaris.authorization.opa.auth.type", "bearer");
-      config.put(
-          "polaris.authorization.opa.auth.bearer.static-token.value",
-          "test-opa-bearer-token-12345");
-      config.put("polaris.features.\"SUPPORTED_CATALOG_STORAGE_TYPES\"", "[\"FILE\"]");
-      config.put("polaris.features.\"ALLOW_INSECURE_STORAGE_TYPES\"", "true");
-      config.put("polaris.readiness.ignore-severe-issues", "true");
-      return config;
+      return Map.ofEntries(

Review Comment:
   +1



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Refactor static map initializations to use Map.ofEntries [polaris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #4745:
URL: https://github.com/apache/polaris/pull/4745#issuecomment-4987458443

   This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.


-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org