使用 Sun 的专有 Java 类是一种不好的做法吗? [英] It is a bad practice to use Sun's proprietary Java classes?
问题描述
如果您使用 Sun 的专有 Java 类,编译器会显示警告.我认为使用这些类通常是一个坏主意.我在某处读到过这个.但是,除了警告之外,还有什么根本原因不应该使用它们吗?
The compiler display warnings if you use Sun's proprietary Java classes. I'm of the opinion that it's generally a bad idea to use these classes. I read this somewhere. However, aside from the warnings are there any fundamental reasons why you should not use them?
推荐答案
因为它们是内部 API:它们可能会以未记录或不受支持的方式更改,并且它们绑定到特定的 JRE/JDK(在您的情况下为 Sun),从而限制了您的程序的可移植性.
Because they are internal APIs: they are subject to change in a undocumented or unsupported way and they are bound to a specific JRE/JDK (Sun in your case), limiting portability of your programs.
尽量避免使用此类 API,始终首选公开的文档化和指定类.
Try to avoid uses of such APIs, always prefer a public documented and specified class.
这篇关于使用 Sun 的专有 Java 类是一种不好的做法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!