为什么不建议使用sun.misc? [英] Why is sun.misc discouraged for use?

查看:120
本文介绍了为什么不建议使用sun.misc?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用sun.misc中的BASE64EncoderBASE64Decoder;我使用的是Eclipse,由于默认情况下仅限访问它,因此不得不转向警告.

I've been using the BASE64Encoder and BASE64Decoder in sun.misc; I'm using Eclipse and had to turn to warnings since the access is restricted to it by default.

这些类可以完美地工作,但是在我从事此工作的过程中,我已经读过很多地方,根本不应该使用sun.misc,但是没有人指出正确的理由.

The classes works perfectly, but during my work with this I've read plenty of places that one should not use sun.misc at all but no one states a proper reason.

我应该远离sun.misc吗,为什么?

Should I stay away from sun.misc and why?

推荐答案

没有承诺继续支持这些类.它们可能会在不发布任何警告的情况下从JDK中删除.

There is no promise to continue support for these classes; they may be removed from the JDK without warning at any release.

而且,并非所有JDK都具有这些类,因此您的代码可能无法在所有平台上运行,这与Java的一次编译,随处运行"的哲学思想背道而驰.

Also, not all JDKs have these classes, so your code may not run on all platforms, which goes against the intention of java's "compile once, run anywhere" philosophy.

这篇关于为什么不建议使用sun.misc?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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