使用Sun专有的Java类是不好的做法? [英] It is a bad practice to use Sun's proprietary Java classes?

查看:144
本文介绍了使用Sun专有的Java类是不好的做法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆