java - 覆盖方法会导致 AndroidStudio 中出现冗余、重复的注解
问题描述
在最近的更新之后,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
。只有 with@Nullable
或 with@NotNull
就足够了。每次重写一个方法,都必须手动删除这样的注解,很痛苦。
以前 AndroidStudio 的行为(理想):
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater,
@Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
return super.onCreateView(inflater, container, savedInstanceState);
}
有什么办法可以避免最近 AndroidStudio 的这种行为?
解决方案
推荐阅读
- nginx - 基于 Nginx 位置的尝试文件?
- asp.net-core - 为什么我运行 WebApp 时有两个端口
- c++ - 如何将 Variadic Templates 变成多个单个模板?(C++ 竞争性编程调试模板)
- javascript - 如何确定 API 作业何时完成?
- c++ - C ++ - 从向量中删除特定的智能指针
- c# - 如何从 LINQ 中的另一个表中获取表的值
- python - 使用 django 显示生成的文档
- spring - 如何使用 JDBCTemplate 检查有效的数据库连接
- c++ - ProjectileMovement 在第二次生成时不起作用
- python - 使用其他函数中定义的参数