今天在進行代碼檢查的時候出現下面的異常:
1 type parameters of <T>T cannot be determined; no unique maximal instance exists for type variable T with upper bounds int,java.lang.Object
當時的第一感覺就是代碼因為jdk版本太低引起的、
因為最后咨詢了配置管理組的同事,確實發現是因為我本地jdk用的是1.7版本,而代碼檢查機器上用的是jdk1.6版本。因此出現了這個問題。
其實出現這個問題的解決辦法很簡單:
1. 升級jdk版本
2. 修改代碼
第一種升級jdk版本的方式我們就不細說了,說說第二種,原始代碼為:
1 public int queryIpCount(String ipAddr) { 2 return getSqlSession().selectOne("IpVerify.queryIpCount", ipAddr); 3 }
修改為:
1 public Integer queryIpCount(String ipAddr) { 2 return getSqlSession().selectOne("IpVerify.queryIpCount", ipAddr); 3 }
也就是將返回類型從int修改為Integer就ok了。
參考資料:
Error: type parameters of <T>T cannot be determined during Maven Install