You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "snazy (via GitHub)" <gi...@apache.org> on 2025/01/15 11:00:07 UTC

[I] Mutable objects used for immutable values [polaris]

snazy opened a new issue, #772:
URL: https://github.com/apache/polaris/issues/772

   ### Describe the bug
   
   `PolarisEntityCore` type hierarchy is used to represent the persisted (or about to be persisted) state. Especially the already persisted state should be considered immutable. Instances of `PolarisEntityCore` are also cached via `org.apache.polaris.core.persistence.cache.EntityCacheEntry#entity`.
   
   `PolarisEntityCore` + `PolarisBaseEntity` type hierarchy exposes _public_ setters for effectively all properties. This makes it very easy to (accidentally?) _modify_ entity instances that are cached or in any other way shared. Although the types have some "copy constructors", the risk of modifying attributes is still there. Even if a legit change to a property of a shared object would not be correct, given the Java memory model guarantees.
   
   ### To Reproduce
   
   _No response_
   
   ### Actual Behavior
   
   _No response_
   
   ### Expected Behavior
   
   _No response_
   
   ### Additional context
   
   _No response_
   
   ### System information
   
   _No response_


-- 
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.apache.org

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


Re: [I] Mutable objects used for immutable values [polaris]

Posted by "sclee01 (via GitHub)" <gi...@apache.org>.
sclee01 commented on issue #772:
URL: https://github.com/apache/polaris/issues/772#issuecomment-2942494048

   Hi @snazy , I'd like to take this on. I agree the current mutability of shared PolarisEntityCore instances is risky. I'll focus on reinforcing immutability and preventing accidental mutation, especially around cached objects.


-- 
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