Java 中不推荐使用的项目是否会被删除
我们知道 Java 中有几个已弃用的项目。
他们会被移除吗? 是否已从 Java 中删除了任何已弃用的项目??
We know that there are several deprecated items in Java.
Will they be removed?
Have any deprecated items ever been removed from Java?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不太可能,因为 java 一直致力于保持向后兼容性,但它有可能发生。我认为弃用是一个警告,表明该 API 要么不可靠,要么存在严重缺陷。
(Thread 有其中几个)。
AFAIC 未删除,但从未实现 Thread.destroy(),因为它与其他几个 Thread 方法本质上是不安全的。
Unlikely since java has always been about maintaining backward compability, but it can happen. I see deprecations as a warning that the API is either unreliable or somehow seriously flawed.
(Thread has several of these).
AFAIC not removed but never implemented
Thread.destroy()
, as it was along with several other Thread methods inherently unsafe.其他地方已提出此问题。
坦率地说,Java 团队通常所做的就是弃用该方法并将其实现删除为建议的方法。不推荐使用的方法只是一个未实现的方法。
This question has been asked elsewhere.
Quite frankly, what the Java team usually do, is to deprecate the method and remove its implementation to the suggested method instead. The deprecated method is just an unimplemented method.
根据文档此处。
可以看到它说
因此,已弃用的方法或类基本上是不鼓励使用的旧方法或类,因为有更新的更合乎逻辑的方法来执行该操作。
这些方法会被删除吗?
可能不会。它将继续像弃用之前一样工作,您只需处理讨厌的警告即可。为了保持未更新的旧程序仍然正确运行,几乎所有已弃用的类和方法都不会仅仅因为这个原因而被删除。
是否删除了任何已弃用的项目?
在 java.* 类中,没有。 javax.* 类中发生了一些更改,但在常规 java 中从未删除过时的方法或类。
According to the documentation here.
You can see that it says
So a deprecated method or class is basically a older method or class that is discouraged from being used as there are newer more logical ways to perform that action.
Will these methods ever be removed?
Probably not. It will continue to work as before the deprecation, you just have to deal with the pesky warning. In order to keep older programs still running correctly that aren't being updated, almost all deprecated classes and methods won't be removed solely for that reason.
Have any deprecated items been removed?
In the java.* class, no. There have been a few changes in the javax.* class but in regular java there has never been a deprecated method or class removed.