Add Info.readOnlyMembers to disable generating setters for publi… - #461
Conversation
| boolean inaccessible = false; | ||
| boolean objectify = false; | ||
| boolean virtualize = false; | ||
| boolean readOnlyMembers = false; |
There was a problem hiding this comment.
For consistency, what about naming this "constify"? (It's actually a term that C++ programmers use!)
There was a problem hiding this comment.
But that way this property would also have to disable non-const C++ methods (and maybe some other things too) otherwise it would be confusing.
Although, current name also doesn't make it 100% clear that it deals only with data members, since methods in C++ are technically called member functions.
There was a problem hiding this comment.
Right w.r.t to "const", but "immutable" can only refer to data and usually only to "properties", even in the case of C++. Functions, or even variables for that matter, are not "properties", because well we can't do things like make them immutable. :)
There was a problem hiding this comment.
I see, we can't currently apply this to individual fields, but ideally it's something that it should let us do. I guess we can wait until someone asks for it before implementing this though.
Sometimes it is needed to pass data from C++ to Java in form of struct, but there is no need to make it mutable. In this case, generated setter methods are unused and only increase size of native library and compiled Java classes.