前 幾篇有提到在不需要使用泛型的部份可以加上 @SuppressWarnings("unchecked"),這也可寫成 @SuppressWarnings(value="unchecked") 或@SuppressWarnings(value={"unchecked"}),所以若再加上不提醒"過時"API就要寫成 @SuppressWarnings({"unchecked","deprecation"}) 或@SuppressWarnings(value={"unchecked","deprecation"}) 另外,在自己的程式裡用 @Override或 @Deprecated也是很好的習慣。 @Deprecated位置目前版本的JDK5已經沒有問題,寫在上一行或method前都可以。 |
留言