---
title: "type parameters of <T>T cannot be determined; no unique maximal instance exists "
author: "HUS2013"
date: "2015-09-18T16:57:06Z"
tags: []
categories: ["编程语言"]
slug: "type-parameters-of-t-t-cannot-be-determined-no-unique-maximal-instance-exists"
draft: false
lastmod: "2015-09-18T16:57:06Z"
id: 2244545
url: "https://hus2013.iteye.com/blog/2244545"
---

转自于: http://www.cnblogs.com/rollenholt/p/3799415.html

 

今天在进行代码检查的时候出现下面的异常：

```
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了。