用户登录
用户注册

分享至

Eclipse 忽略不正确的 @Override 注释

  • 作者: 小狗爱吃鱼
  • 来源: 51数据库
  • 2023-01-14

问题描述

由于某种原因,我的 Eclipse 安装之一忽略了错误设置的 @Override 注释.例如,如果我将 @Override 放在未被覆盖的方法上,它就会完全忽略它.

For some reason one of my eclipse installations is ignoring incorrectly set @Overrideannotations. For example, if I put @Override on a method that isn't overriden, it just completely ignores it.

有什么想法可以让它回到错误注释的方法会显示错误的状态吗?

Any ideas on how to bring it back to a state where it will display an error for an incorrectly annotated method?

推荐答案

@Override 的定义在 Java 6 (不幸的是没有适当的文档),其中实现接口方法的方法上的 @Override 注释是有效的.在 Java 5 中,这被认为是一个错误.

The definition of @Override changed slightly in Java 6 (and unfortunatly without proper documentation) wherein an @Override annotation on a method that implements an interface method is valid. In Java 5 that was considered an error.

软件
前端设计
程序设计
Java相关