InspectionGadgets: erroneous error reported for floating point literal

1.) IG erroneously reports an error for flaoting point literals such as the following:

private static final double DOUBLE_TOLERANCE = 1.0E-5;

2.) The 'Change to canonical form' action invariably appends an extra '0' to the mantissa, thus:

private static final double DOUBLE_TOLERANCE = 1.00E-5;

6 comments

Gah, forgot about negative exponents. It'll be fixed in the next release.

--Dave Griffith

0

Hello Dave

I also have a problem with floating point literals.

IG reports "Confusing floating point literal 123456.0d". Quickfix generated exception:

0

Another minor issue.


Reported "Implicit numeric conversion of 1000 from int to long". Quickfix makes the following change:


However, it'd be great if it was smart enough to convert it to:


0

I didn't even know the "d" was legal Java. You learn something new every day. It'll be fixed in the next rev.

--Dave Griffith

0


Way ahead of you. I've already got a fix that does this on my machine, adding or removing "L" or "F", instead of casting literals. It'll be in the next release.

--Dave Griffith

0

Please sign in to leave a comment.