@SuppressWarnings
したがって、問題は、複数の警告抑制を組み合わせて、各アイテムに独自の注釈が必要ないようにすることです。
たとえば、次のようになります。
public class Example
public Example() {
GO go = new GO(); // unused
....
List<String> list = ( List<String> ) go.getList(); // unchecked
}
...
// getters/setters/other methods
}
2 つではなく、@SuppressWarnings
これら 2 つの警告のためにクラス レベルで 1 つにしたいので、次のようにします。
@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
}
しかし、それは有効な構文ではありません。これを行う方法はありますか?