Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mutable objects used for immutable values #772

Open
snazy opened this issue Jan 15, 2025 · 0 comments
Open

Mutable objects used for immutable values #772

snazy opened this issue Jan 15, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@snazy
Copy link
Member

snazy commented Jan 15, 2025

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

@snazy snazy added the bug Something isn't working label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant