java:S2127 "Double.longBitsToDouble" should not be used for "int"

SonarLint v2.9
SonarLint IntelliJ v5.1.0.34721 (and v5.0.1.33703)

public class FP {
    public static double getDouble() {
        return Double.longBitsToDouble(Other.getLong());
    }
}
public class Other {
    public static long getLong() {
        return Long.MAX_VALUE;
    }
}

Hello @esaulpaugh

Ideally, it would be great if could provide a little description of the problem, what you expected, and so on. We are not robots processing tickets, it is always nicer and helps us to understand better the problem.

In any case, this looks like a false positive. Ticket created: SONARJAVA-3967.

Note that this should only happen in SonarLint when the semantic is incorrectly resolved (when the project is not built for example). If it happens in SonarQube aswell, it’s probably that your project analysis is misconfigured.

Best,
Quentin

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.