Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Eclipse显示推断泛型类型参数-要删除此警告而不取消它吗_Java_Eclipse_Generics_Svnkit - Fatal编程技术网

Java Eclipse显示推断泛型类型参数-要删除此警告而不取消它吗

Java Eclipse显示推断泛型类型参数-要删除此警告而不取消它吗,java,eclipse,generics,svnkit,Java,Eclipse,Generics,Svnkit,我正在尝试使用SVNKit从svn存储库获取所有日志。它工作正常,但看到一条推断泛型类型参数警告消息。我已经试过了 repository.log(new String[]{""}, null, START_REVISION, HEAD_REVISION, true, true); 与 收藏 但警告仍然存在。是否可以在不抑制的情况下删除此警告 private Collection<SVNLogEntry> getAllSvnLogsFromStart_Revision()

我正在尝试使用SVNKit从svn存储库获取所有日志。它工作正常,但看到一条推断泛型类型参数警告消息。我已经试过了

repository.log(new String[]{""}, null, START_REVISION, HEAD_REVISION, true, true);

收藏

但警告仍然存在。是否可以在不抑制的情况下删除此警告

    private Collection<SVNLogEntry> getAllSvnLogsFromStart_Revision()   {
    DAVRepositoryFactory.setup();
    SVNRepository repository = null;
    Collection<SVNLogEntry> logEntries = null;
    try {
        repository = SVNRepositoryFactory.create( SVNURL.parseURIEncoded( SVN_URL ) );
        ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(userName, passWord);
        repository.setAuthenticationManager(authManager);          
        logEntries = repository.log(new String[]{""}, null, START_REVISION, HEAD_REVISION, true, true);
    }catch (SVNException e) {
        e.printStackTrace();
    }
    return logEntries;
}
private Collection getAllSvnLogsFromStart\u Revision(){
DAVRepositoryFactory.setup();
SVNRepository repository=null;
收集日志项=null;
试一试{
repository=SVNRepositoryFactory.create(SVNURL.parseURIEncoded(SVN_URL));
ISVNAuthenticationManager authManager=SVNWCUtil.createDefaultAuthenticationManager(用户名、密码);
setAuthenticationManager(authManager);
logEntries=repository.log(新字符串[]{”“},null,START\u REVISION,HEAD\u REVISION,true,true);
}捕获(SVE){
e、 printStackTrace();
}
返回日志条目;
}



由于
SVNRepository.log()
返回原始
集合
类型,因此必须处理未经检查的转换。最干净的方法是通过将
@SuppressWarnings
字段应用于变量声明来最小化其影响:

@SuppressWarnings("unchecked")
Collection<SVNLogEntry> logEntries = repository.log(new String[]{""}, null, START_REVISION, HEAD_REVISION, true, true);
return logEntries;
@SuppressWarnings(“未选中”)
Collection logEntries=repository.log(新字符串[]{”“},null,START\u REVISION,HEAD\u REVISION,true,true);
返回日志条目;

由于
SVNRepository.log()
返回原始
集合
类型,因此必须处理未经检查的转换。最干净的方法是通过将
@SuppressWarnings
字段应用于变量声明来最小化其影响:

@SuppressWarnings("unchecked")
Collection<SVNLogEntry> logEntries = repository.log(new String[]{""}, null, START_REVISION, HEAD_REVISION, true, true);
return logEntries;
@SuppressWarnings(“未选中”)
Collection logEntries=repository.log(新字符串[]{”“},null,START\u REVISION,HEAD\u REVISION,true,true);
返回日志条目;

由于
SVNRepository.log()
返回原始
集合
类型,因此必须处理未经检查的转换。最干净的方法是通过将
@SuppressWarnings
字段应用于变量声明来最小化其影响:

@SuppressWarnings("unchecked")
Collection<SVNLogEntry> logEntries = repository.log(new String[]{""}, null, START_REVISION, HEAD_REVISION, true, true);
return logEntries;
@SuppressWarnings(“未选中”)
Collection logEntries=repository.log(新字符串[]{”“},null,START\u REVISION,HEAD\u REVISION,true,true);
返回日志条目;

由于
SVNRepository.log()
返回原始
集合
类型,因此必须处理未经检查的转换。最干净的方法是通过将
@SuppressWarnings
字段应用于变量声明来最小化其影响:

@SuppressWarnings("unchecked")
Collection<SVNLogEntry> logEntries = repository.log(new String[]{""}, null, START_REVISION, HEAD_REVISION, true, true);
return logEntries;
@SuppressWarnings(“未选中”)
Collection logEntries=repository.log(新字符串[]{”“},null,START\u REVISION,HEAD\u REVISION,true,true);
返回日志条目;

未经检查的警告无法通过直接转换解决,因为Java无法静态定义操作的类型安全性,因为数组的内容是未知的;解决方案是让java知道数组的内容:

    Collection<SVNLogEntry> typesafe = new ArrayList<SVNLogEntry>();

    for (Object o : repository.log(new String[]{""}, null, START_REVISION, HEAD_REVISION, true, true)) {
        typesafe.add((SVNLogEntry)o);
    }
Collection typesafe=new ArrayList();
for(对象o:repository.log(新字符串[]{”“},null,开始修订,头修订,true,true)){
类型安全。添加((SVNLogEntry)o);
}
这会带来性能损失,但允许运行时确定类型化数组内容是什么,并使警告消失

但是,如果您正在寻找一种替代方法来在不使用SuppressWarning的情况下抑制警告,那么还有另一种方法(遗憾的是,它适用于整个项目):

要在不抑制警告的情况下禁用警告,必须转到首选项,在java>编译器>错误/警告下,有一个包含这些消息的泛型类型折叠


忽略它们也会删除工具提示。

未经检查的警告无法通过直接转换解决,因为Java无法静态定义操作的类型安全性,因为数组的内容是未知的;解决方案是让java知道数组的内容:

    Collection<SVNLogEntry> typesafe = new ArrayList<SVNLogEntry>();

    for (Object o : repository.log(new String[]{""}, null, START_REVISION, HEAD_REVISION, true, true)) {
        typesafe.add((SVNLogEntry)o);
    }
Collection typesafe=new ArrayList();
for(对象o:repository.log(新字符串[]{”“},null,开始修订,头修订,true,true)){
类型安全。添加((SVNLogEntry)o);
}
这会带来性能损失,但允许运行时确定类型化数组内容是什么,并使警告消失

但是,如果您正在寻找一种替代方法来在不使用SuppressWarning的情况下抑制警告,那么还有另一种方法(遗憾的是,它适用于整个项目):

要在不抑制警告的情况下禁用警告,必须转到首选项,在java>编译器>错误/警告下,有一个包含这些消息的泛型类型折叠


忽略它们也会删除工具提示。

未经检查的警告无法通过直接转换解决,因为Java无法静态定义操作的类型安全性,因为数组的内容是未知的;解决方案是让java知道数组的内容:

    Collection<SVNLogEntry> typesafe = new ArrayList<SVNLogEntry>();

    for (Object o : repository.log(new String[]{""}, null, START_REVISION, HEAD_REVISION, true, true)) {
        typesafe.add((SVNLogEntry)o);
    }
Collection typesafe=new ArrayList();
for(对象o:repository.log(新字符串[]{”“},null,开始修订,头修订,true,true)){
类型安全。添加((SVNLogEntry)o);
}
这会带来性能损失,但允许运行时确定类型化数组内容是什么,并使警告消失

但是,如果您正在寻找一种替代方法来在不使用SuppressWarning的情况下抑制警告,那么还有另一种方法(遗憾的是,它适用于整个项目):

要在不抑制警告的情况下禁用警告,必须转到首选项,在java>编译器>错误/警告下,有一个包含这些消息的泛型类型折叠

忽略它们也会删除工具提示。