FindBugs的告訴我,我有以下錯誤:自動裝箱錯誤
A primitive is boxed, and then immediately unboxed. This probably is due to a manual boxing in a place where an unboxed value is required, thus forcing the compiler to immediately undo the work of the boxing.
下面是相關代碼:
...
String str= "10.0";
Double d = (str != null ? Double.valueOf(str) : new Double(0.0));
...
這是什麼意思?我該如何解決呢?
您是否嘗試將此行分割爲多個,從而查看findbugs的哪一部分的確切含義? – ZeissS