舊版 反向連結 目錄表 SonarLint | Primitives should not be boxed just for "String" conversion (java:S2131) Problem How to fix? SonarLint SonarLint | Primitives should not be boxed just for "String" conversion (java:S2131) Problem 這個問題指的是使用了多此一舉的寫法,先將timeout從primitive type轉為primitive-wrapper type,然後再透過它轉成字串: Integer.valueOf(timeout).toString(); 這是浪費記憶體與CPU的寫法。 How to fix? 直接透過overloading的toString做轉換即可: Integer.toString(timeout); View the discussion thread.