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

[Feature] strict parameter for @get and @set #480

Open
CC007 opened this issue Aug 26, 2023 · 0 comments
Open

[Feature] strict parameter for @get and @set #480

CC007 opened this issue Aug 26, 2023 · 0 comments

Comments

@CC007
Copy link
Contributor

CC007 commented Aug 26, 2023

Is your feature request related to a problem? Please describe.
This feature is related to the ability to access/reassign field contents from inside a class, if the field is annotated with @get/@set respectively.

In manifold version 2023.1.18 the functionality of @set was changed so that if there was no other manifold-props annotation, then a @get(Private) would automatically get added, so that the field would still be usable inside the class, without the user having to explicitly use @get(Private) themselves. This was also helpful for the usage of Lombok annotations like @ToString

This however made it impossible to restrict access to the variable from inside the class (for instance if the dev wanted it to only be available through reflection or something).

It also made the way that @set works inconsistent with the way that @get works.

Describe the solution you'd like
It would be nice if @set got a parameter like strict of type boolean, to specify if field access should be allowed from inside the class. Similarly, the strict parameter could be added to @get.

When strict = false, this would mean for @set that field access would still be allowed from inside the class. For @get this would mean that field reassignment would still be allowed from inside the class (so the field wouldn't be final).

When strict = true, this would mean for @set that field access would be disallowed even from inside the class (other than possibly through reflection). For @get this would mean that field reassignment would be disallowed, even from inside the class (This is basically how @get works right now and how @val should still work after the change).

Describe alternatives you've considered
The alternative is to continue using @set @get(Private) and @var @get(Private)

Additional context
First mentioned here: #477 (comment)

@CC007 CC007 changed the title [Feature] [Feature] strict parameter for @get and @set Aug 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants