【发布时间】:2021-09-18 15:08:36
【问题描述】:
在最近的更新之后,AndroidStudio 会在覆盖方法(通过使用代码 > 生成 > 覆盖方法)时放置这些多余的重复注释,例如:
@Nullable
@org.jetbrains.annotations.Nullable
@Override
public View onCreateView(@NonNull @org.jetbrains.annotations.NotNull LayoutInflater inflater,
@Nullable @org.jetbrains.annotations.Nullable ViewGroup container,
@Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
return super.onCreateView(inflater, container, savedInstanceState);
}
我不需要这些 @org.jetbrains.annotations.Nullable and @org.jetbrains.annotations.NotNull。仅使用@Nullable 或@NotNull 就足够了。每次重写一个方法,都要手动删除这样的注解,很痛苦。
之前AndroidStudio的行为(理想):
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater,
@Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
return super.onCreateView(inflater, container, savedInstanceState);
}
有什么办法可以避免最近AndroidStudio的这种行为?
【问题讨论】:
标签: java android android-studio intellij-idea jetbrains-ide