有没有办法以与Eclipse类似的方式为您正在处理的文件连续创建IntelliJ标记错误位置?目前我需要制作一个列出消息面板中所有错误的项目,但即使这样我也无法使用编辑器面板导航到它们.我想有简单的点/标记指向错误/警告位置.
给出了如何让Intellij Idea显示编译警告的答案?不再适用于版本12.据我所知,不再有消息面板.
如何在版本12中查看项目中所有警告的完整列表?
为什么下面的代码没有报告Intellij IDEA的未经检查的警告,jdk 1.8.0_121因为 Supplier<R> & Serializable是超类型T?
<T extends Supplier<Integer> & Serializable> T createdBy(AtomicInteger counter) {
// v--- if I removed the first cast expression, I can't compile it
return (T) (Supplier<Integer> & Serializable) counter::incrementAndGet;
// ^--- it should be reports unchecked warnings, but it doesn't
}
Run Code Online (Sandbox Code Playgroud)
以下代码报告了未经检查的强制警告:
<T, R extends T> R apply(T value) {
return (R) value;
// ^--- unchecked cast
}
Run Code Online (Sandbox Code Playgroud)
为什么会出现这个问题,感兴趣的事情发生在我编写下面的代码用于链接具有多超类型的类型时:
AtomicInteger counter = new AtomicInteger(0);
Supplier<Integer> serialized = serialized(createdBy(counter));
assert serialized.get() …Run Code Online (Sandbox Code Playgroud)