所以问题在于能够组合多个警告抑制,以便每个项目不需要它自己的 @SuppressWarnings
注释。
例如:
public class Example
public Example() {
GO go = new GO(); // unused
....
List<String> list = ( List<String> ) go.getList(); // unchecked
}
...
// getters/setters/other methods
}
现在不是有两个 @SuppressWarnings
我想在类级别有一个用于这两个警告,所以像这样:
@SuppressWarnings( "unused", "unchecked" )
public class Example
public Example() {
GO go = new GO(); // unused - suppressed
....
List<String> list = ( List<String> ) go.getList(); // unchecked - suppressed
}
...
// getters/setters/other methods
}
但这不是一个有效的语法,有没有办法做到这一点?
最佳答案
使用以下内容:
@SuppressWarnings({"unused", "unchecked"})
关于java - 组合多个@SuppressWarnings 注释 - Eclipse Indigo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13070260/