Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering
“The Double.longBitsToDouble method is invoked, but a 32 bit int value is passed as an argument. This almostly certainly is not intended and is unlikely to give the intended result. ” – 2013-11-25
The method Double.longBitsToDouble(long l) does not complain if you pass an int value instead of a long value since, in general, longs can be constructed out of ints. In this case though not the value but the bits are important, therefore the constructed long might have a different effect as intended.
In any case one should never pass an int to this method. There is no good fix for this, that's why we don't offer one.
<code Java>
int i = 1003; System.out.println(Double.longBitsToDouble(i)); Integer ii = new Integer(123); System.out.println(Double.longBitsToDouble(ii));
</Code>
<code Java>
long l = 1003; System.out.println(Double.longBitsToDouble(l));
</Code>
Benchmark project | Time | # Hits | Precision | Recall | |||||
---|---|---|---|---|---|---|---|---|---|
FB | JT | FB | JT | Delta | FB | JT | Delta | ||
Apache Tomcat | < 1s | 0 | 0 | 100% | 100% | 0 | 100% | 100% | 0 |
Argo UML | < 1s | 0 | 0 | 100% | 100% | 0 | 100% | 100% | 0 |
AWT | < 1s | 0 | 0 | 100% | 100% | 0 | 100% | 100% | 0 |
Jakarta | < 1s | 0 | 0 | 100% | 100% | 0 | 100% | 100% | 0 |
Java IO | < 1s | 0 | 0 | 100% | 100% | 0 | 100% | 100% | 0 |
JHotDraw | < 1s | 0 | 0 | 100% | 100% | 0 | 100% | 100% | 0 |
jrefactory | < 1s | 0 | 0 | 100% | 100% | 0 | 100% | 100% | 0 |
JServlet | < 1s | 0 | 0 | 100% | 100% | 0 | 100% | 100% | 0 |
JUnit | < 1s | 0 | 0 | 100% | 100% | 0 | 100% | 100% | 0 |
Lexi | < 1s | 0 | 0 | 100% | 100% | 0 | 100% | 100% | 0 |
Mapper XML | < 1s | 0 | 0 | 100% | 100% | 0 | 100% | 100% | 0 |
nutch | < 1s | 0 | 0 | 100% | 100% | 0 | 100% | 100% | 0 |
PMD | < 1s | 0 | 0 | 100% | 100% | 0 | 100% | 100% | 0 |
quickuml | < 1s | 0 | 0 | 100% | 100% | 0 | 100% | 100% | 0 |
FB = FindBugs, JT = JTransformer, Delta = JTransformer - FindBug
All measurements were taken on a machine with the following properties: