OpenPojo / openpojo

POJO Testing & Identity Management Made Trivial
http://openpojo.com
Apache License 2.0
156 stars 40 forks source link

getter validation didn't allow isX() getter for a boolean - why ? #47

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Configured getter validation - but error didn't allow a boolean field to have 
getter of isX() format
2.
3.

What is the expected output? What do you see instead?
Allow getter of format isX()

What version of the product are you using? On what operating system?
            <groupId>com.googlecode.openpojo</groupId>
            <artifactId>openpojo</artifactId>
            <version>0.4.9</version>
            <scope>test</scope>

Please provide any additional information below.

Original issue reported on code.google.com by stum...@gmail.com on 3 Oct 2014 at 9:23

GoogleCodeExporter commented 9 years ago
Actually my boolean field is called isX and getter is called isX() - maybe that 
is the problem

Original comment by stum...@gmail.com on 3 Oct 2014 at 9:25

GoogleCodeExporter commented 9 years ago
This is bug and an interesing corner case for sure, if the field is named "isX" 
and it is a boolean, OpenPojo expects:
- Getter to be isIsX(), getIsX()
- Setter to be setIsX.

Apparently both Eclipse and IntelliJ, both agree that isX property's getter 
would be isX(), and setter would be setX()... 

More interestingly, having the Eclipse generate getter/setter for a class with 
"isX" and "x" fields, breaks the class as two sets of identical method 
signatures get generated, IntelliJ ignores generates one and ignores the other. 
 If you add isX and generate getter/setter on either eclipse or IntelliJ then 
come around and add "x" then try to generate both respond with no fields 
missing getter/setter.

I think OpenPojo needs a rule that enforces rejection of such practices.

Stay tuned for the release with the fix in it.

Original comment by oshou...@gmail.com on 5 Oct 2014 at 12:21

GoogleCodeExporter commented 9 years ago

Original comment by oshou...@gmail.com on 5 Oct 2014 at 12:22

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r805.

Original comment by oshou...@gmail.com on 9 Oct 2014 at 3:04

GoogleCodeExporter commented 9 years ago
Release 0.6.1 will incorporate the fix for this issue.

Original comment by oshou...@gmail.com on 9 Oct 2014 at 3:31