You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Collection fields are unnecessarily initialized to "null" #1346
changed the title [-]How can i generate collection fileld without initialized value and "null"[/-][+]Collection fields are unnecessarily initialized to "null"[/+]on Dec 3, 2021
Activity
unkish commentedon Dec 2, 2021
Hi
private List<Foo> fooList;is equally same asprivate List<Foo> fooList = null;Please see JLS 4.12.5. Initial Values of Variables
saberya commentedon Dec 2, 2021
@unkish
but
is not what i expect.
Beacuse the java Class with this kind of expression is not a good habit to definition a field.
unkish commentedon Dec 2, 2021
I'm sorry but I don't understand why is that a problem or what kind of problem are you trying to solve
saberya commentedon Dec 2, 2021
@unkish
I use this tool to generate original pojo in a project before developing,
this kind of code is not friendly
unkish commentedon Dec 3, 2021
At present it's not possible to get the described result without either:
DefaultRulewith custom onejoelittlejohn commentedon Dec 3, 2021
Not sure when this began happening, but I agree it would be nice to remove it. It's annoying noise.
Feel free to submit a PR for this.
[-]How can i generate collection fileld without initialized value and "null"[/-][+]Collection fields are unnecessarily initialized to "null"[/+]joelittlejohn commentedon Dec 6, 2021
Closed by #1347