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

Fix identification getters / setters for properties with second upper case symbol. For example eTemperature #10130

Open
wants to merge 1 commit into
base: 5.0.x
Choose a base branch
from

Conversation

altro3
Copy link
Contributor

@altro3 altro3 commented Nov 17, 2023

@altro3
Copy link
Contributor Author

altro3 commented Nov 17, 2023

@graemerocher @dstepanov I've known about this problem for a long time, but usually got around it by simply renaming the fields. It's time to fix this bug

@graemerocher
Copy link
Contributor

unlikely to happen before 5.x

@dstepanov
Copy link
Contributor

This change might lead to wrong interpretation of the method
like getorXyz as a property of OrXyz

@altro3
Copy link
Contributor Author

altro3 commented Nov 18, 2023

@dstepanov your sample is invalid: in your method name you have 2 chars with lower case. This is contrary to Java naming conventions. Therefore the given method name will simply be ignored because it is not a getter.

The only naming restriction in Java is this: for names like MfIeld and mfIeld getter and setter method names will be the same:

public String getMfIeld() {
    ...
}
public void setMfIeld(...) {
    ...
}

But even this situation has no solution: according to Java convention, class attribute names must begin with a lowercase letter, so a field called MfIeLd contradicts this convention. Therefore, the name of the field for such getters and setters is always defined the same way: mfIeld Therefore, if the user decides to name the fields with a capital letter, and then uses a small letter, he breaks the rules and creates problems for himself.

But the name eTemperature does not contradict any principles, so it should be interpreted correctly

@altro3
Copy link
Contributor Author

altro3 commented Nov 18, 2023

@dstepanov I want to say that now only one case of a correct getter name is not processed: When the first letter is lowercase, but the second letter is uppercase, that is, the first two letters in lowercase cannot be in the getter name.

Remember, I described to you the rules for naming getters and setters, in sufficient detail and identified 3 rules. So, then I only corrected the keyword with the _ symbol, but I did not correct the third point (which describes the case with the first lowercase character) in that merge request. Apparently in vain :-(

@altro3
Copy link
Contributor Author

altro3 commented Nov 18, 2023

@graemerocher It doesn't matter. The main thing is, don’t forget about this fix. As I understand it, version 5 will be released no earlier than in 3 years

@sdelamo sdelamo added the status: under consideration The issue is being considered, but has not been accepted yet label Nov 24, 2023
@altro3 altro3 changed the base branch from 4.2.x to 4.3.x January 27, 2024 05:57
@sdelamo sdelamo added the status: next major version The issue will be considered for the next major version label Feb 5, 2024
@CLAassistant
Copy link

CLAassistant commented Feb 7, 2024

CLA assistant check
All committers have signed the CLA.

@altro3 altro3 changed the base branch from 4.3.x to 5.0.x April 10, 2024 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: next major version The issue will be considered for the next major version status: under consideration The issue is being considered, but has not been accepted yet
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

5 participants