@Getter(lazy=true) does not work with byte/short/float fields and values that are initialized with a constant. #418

Closed
lombokissues opened this Issue Jul 14, 2015 · 5 comments

Projects

None yet

1 participant

@lombokissues
Collaborator

Migrated from Google Code (issue 345)

@lombokissues
Collaborator

๐Ÿ‘ค reinierz ย  ๐Ÿ•— Feb 14, 2012 at 00:14 UTC

This is the stupidest bug report ever, because this is only an issue with constants, and why the heck would you want to @ Getter(lazy=true) on a constant?

Anyway, this:

private byte test = 1;

is fine, but throw a @ Getter(lazy=true) in there and it'll fail to compile, complaining that AtomicReference<Byte>(int) does not exist. Indeed it doesn't; only AtomicReference<Byte>(Byte) exists, and there's no type coercion+boxing path that leads from int to Byte.

@lombokissues
Collaborator

๐Ÿ‘ค reinierz ย  ๐Ÿ•— Feb 14, 2012 at 00:15 UTC

Wont fix anytime this century because it's actually relatively difficult to do so and as stated in the report this will never happen in real life.

Note that we might revisit the way we generate lazy constructors, and there's a chance this bug will end up solving itself when we do.

@lombokissues
Collaborator

๐Ÿ‘ค reinierz ย  ๐Ÿ•— Feb 14, 2012 at 00:39 UTC

Whoops - the same problem occurs with something like:

@ Getter(lazy=true) private long foo = someExpensiveCalculationThatReturnsAnInt();

Fortunately, we figured out a really easy and elegant fix which we'll be committing shortly.

@lombokissues
Collaborator

๐Ÿ‘ค reinierz ย  ๐Ÿ•— Feb 14, 2012 at 17:20 UTC

Fixed. Will be in whatever follows 0.10.8

@lombokissues lombokissues added this to the 0.10.9 milestone Jul 14, 2015
@lombokissues
Collaborator

End of migration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment