-
Notifications
You must be signed in to change notification settings - Fork 754
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
[Refactoring] Names and Name cleanup (use static access & getter) #43265
[Refactoring] Names and Name cleanup (use static access & getter) #43265
Conversation
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
6f63094
to
168a00b
Compare
@Shadow-Devil first of all thank you very much for taking time to do this refactoring and I generally agree with almost all the changes, with one minor caveat. You may have seen in many places we have direct access to fields instead of going via encapsulated methods. Rational for this is as fallows
Given with your changes
Therefore I think it is better to cross that bridge when we need to do 1 since I don't see in many places we need to do 2. WDYT? |
@heshanpadmasiri oh wow, thank you for that deep analysis! Do you know what would happen, if we made Name a record? then one would have to use the accessors and (i hope) the invokeVirtial could be optimised away. Downside is, that the methodname would change from getValue() to value() and many libraries which use this field would need to be updated as well. WDYT? //Edit: I just tried it and record field access also generate an |
As I understand the Name class is pretty much only a wrapper of a String. |
@heshanpadmasiri If you think we should not do this change, close the PR please so I know that this will not be included. I do understand your points but still think these micro optimisations might not be enough to go against the Java Standard of having getters instead of directly accessing the property. Maybe also others could share their opinion on this topic :) |
168a00b
to
37cf61e
Compare
37cf61e
to
97b4c9d
Compare
Purpose
Names
variables and only use static accessgetValue()
).Check List