You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
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 likestrict
of typeboolean
, to specify if field access should be allowed from inside the class. Similarly, thestrict
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 befinal
).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)
The text was updated successfully, but these errors were encountered: