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

Consider warning if a final variable is changed via readMarshallable #414

Open
rogersimmons opened this issue Mar 15, 2022 · 5 comments
Open
Assignees

Comments

@rogersimmons
Copy link
Contributor

rogersimmons commented Mar 15, 2022

readMarshallable allows final variables to be changed - eg when reading config on startup.
As Java allows aggressive optimisation of final variables this can result in a situation where a variable in an object has one value (changed from config), but accessors will return a different value (a default baked in at compilation).

Ideally a warning should be emitted when a final variable is changed, or the config refused altogether.

@RobAustin
Copy link
Member

We should be more abrupt and throw an exception, the problem with WARNings is they get missed!

@alamar
Copy link
Contributor

alamar commented Mar 23, 2022

Let's do warning now, error in 2.24?

@alamar
Copy link
Contributor

alamar commented Mar 23, 2022

Turns out we have more than 10 tests which do exactly that - overwrite final fields.

What should we do - should we update them all?

@rogersimmons @RobAustin

alamar pushed a commit that referenced this issue Apr 22, 2022
alamar pushed a commit to OpenHFT/Chronicle-Queue that referenced this issue Apr 22, 2022
alamar pushed a commit that referenced this issue Apr 22, 2022
De-finalize marshallable fields to remove warnings

closes #414
alamar pushed a commit to OpenHFT/Chronicle-Queue that referenced this issue Apr 25, 2022
@RobAustin
Copy link
Member

@alamar this looks done, if this is not the case please reopen

@alamar
Copy link
Contributor

alamar commented Sep 12, 2022

Nope, no real work is done yet, reopening.

@alamar alamar reopened this Sep 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants