为什么我不能在Eclipse中使用完全限定类型名(FQN)来注释参数,如@NonNull
?这是Eclipse的一个bug吗?
import org.eclipse.jdt.annotation.NonNull;
public class Foo {
// No problem
public void bar(@NonNull String x) {
}
// Error: Type annotations are not allowed on type names used to access
// static members
public void baz(@NonNull java.lang.String x) {
}
}
java.lang.@NonNull String
看起来很丑,但是没关系,它能用 :) - Vertexjava.lang.@NonNull String
。 - Next Developer