组合多个@SuppressWarnings注释 - Eclipse Indigo
2022-08-31 07:18:17
因此,问题在于能够组合多个警告抑制,以便每个项目都不需要自己的注释。@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
}
但这不是一个有效的语法,有没有办法做到这一点?