Using intellij 15.0.3 + Java 8u65...
lower = System.currentTimeMillis();
long upper = lower + 31536000000L; //add a year-ish
Works fine. But if I do:
lower = System.currentTimeMillis();
long upper = lower + (1000L*60*60*24*365);
Intellij now gives a warning "Numeric overflow in expression". I'd understand if this were in fact true, and it was consistently warning over both expressions, but it's not.
Anyone know why the 2nd expression generates the warning? I'd rather have the breakdown this way than a number because it's easier for other devs on the project to understand what it's doing (though I suppose I could comment). Code still compiles obviously but I find warnings in my builds like an itch that I can't scratch.
EDIT Thanks for responses... I think this is just a caching issue in Intellij... If I know copy/paste the above I don't get the warning. If I try to edit it after the paste 1 or 2 times out of 10 I get the warning popping in.
L
at the end of a number means that it is a long type – Marlin