我在Eclipse上创建了一个相当大的Web项目(8个月的工作)。我一直在使用Eclipse构建系统。现在我想去Ant,其中有很多原因(其中包括能够添加某些预先WAR任务,如js压缩和其他...)。我发现Eclipse自动创建了一个build.xml
文件,并设置了所有依赖关系。问题是,如果我尝试运行它,它失败并给出了此错误:使用Ant编译Eclipse项目的问题
type parameters of <TypeName>TypeName cannot be determined; no unique maximal instance exists for type variable TypeName with upper bounds TypeName,java.lang.Object
[javac] return dao.getItemByProperty(propertyName, val, objectClass);
它besically死亡东阳泛型错误的....通常它编译于Eclipse罚款(我知道这是一个不同的编译器......)。我怎样才能让javac使用这个?
的方法是:
@Override
@Transactional
public <TypeName> TypeName getItemByProperty(String propertyName,
Object val, Class objectClass) {
return dao.getItemByProperty(propertyName, val, objectClass);
}
和dao.getItem ...是
@Override
public <TypeName> TypeName getItemByProperty(String propertyName,
Object val, Class objectClass) {
Session sess = sessionFactory.getCurrentSession();
Criteria criteria = sess.createCriteria(objectClass);
criteria.add(Expression.eq(propertyName, val));
@SuppressWarnings("unchecked")
List<TypeName> results = criteria.list();
if (results != null && results.size() != 0) {
TypeName res = results.get(0);
return res;
}
return null;
}
它们在分别实现两个接口,所述第一对服务,第二个针对两个类一个道,他们在春天使用。
这是怎么发生的? Eclipse编译器与javac如此不同?
ant是1.8.1和javac是1.6.0_21 – gotch4
@ gotch4是你期待的值吗? – bakoyaro
是的,他们是...所以? – gotch4