java - 我如何才能知道此 Java API 更改发生的时间?

标签 java

在某些时候,java.lang.Override 开始可用于实现接口(interface)中声明的方法。我很确定曾经有一段时间它只适用于覆盖父类(super class)中定义的方法。

我如何才能知道此更改发生的时间(即在哪个版本)?

最佳答案

在从接口(interface)实现但未从父类(super class)覆盖的方法上使用@Override 注释是Java 6 中的一项新功能。参见@Override specification changes in Java 6。 :

Between Java 5 and Java 6 changes to the specification of @Override have been made. In Java 6 it is possible to add the @Override annotation to methods that implement methods of an interface which is not allowed in Java 5.

I noticed the difference when a friend told me that he had to remove all the @Override annotations to make his Java 6 project compile with Java 5.

The interesting thing is that there is no documentation about this change. The API specification of @Override is exactly the same in both Java versions. I found out that this was forgotten by Sun developers. Peter Ahé, a former developer at Sun, calls it the @Override Snafu.

关于java - 我如何才能知道此 Java API 更改发生的时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1165270/

相关文章:

java - 如何关闭无限循环锁定的套接字?

java - 比较 2 个数组列表之间的值

java - Scene2D UI 未填满整个屏幕

java - 使用 XMLGregorianCalendar 获取错误的日期

java - WebSocket EndPoints 注释中编码器列表或解码器列表的用例是什么?

java - 如何在 Eclipse 中找到方法实现的用法?

java - 如何让本地JBOSS AS 7提供静态资源?

java - HotSpot JVM 的 -server 选项有什么作用?

java - Apache CXF (JAXBattachmentMarhaller) 和 JBOSS 5.2 的链接错误

java - 应该在微服务中使用多线程吗?