Community
Participate
Working Groups
The following code produces an error: package test; @Data public class SingleLetterCamelCase { int a; Integer aBoxed; Integer abBoxed; } class Test { def a() { var SingleLetterCamelCase a println a.a println a.aBoxed // Error: The method aBoxed is undefined for the type Test println a.ABoxed // OK println a.abBoxed } } The problem is, that the getter "getABcde" maps to the attribute "ABcde" and not to the "aBcde".
From a JavaBeans perspective it's correct that the property name of getABoxed is 'ABoxed'. We could make the getter and setter generation to produce 'getaBoxed' instead, i.e. don't capitalize the first char if the second is upper case. Any thoughts?
I think it's important to be compliant with the rules of java.beans.Introspector.decapitalize(String). getaBoxed looks alien to me. We could issue a warning on aBoxed in the lines of 'discouraged property name' and accept that one has to use this.ABoxed afterwards.
A offline discussion convinced me that @Property Object aThing should yield getaThing and setaThing but issue an optional warning on the name in the sense of 'will produce unexpected accessor names'
What actually stops us from generating getABoxed() getter, but access it through aBoxed property in Xtend?
Compliance with the JavaBeans convention
Thanks! I see it now. Comment 3 is the best solution.
We cannot change @Property and also I think we should stick to JavaBeans spec (I don't remember the conclusion of our offline discussion...)