Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
@Getter(lazy=true) does not work with byte/short/float fields and values that are initialized with a constant. #418
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?
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.
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.
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.