Why Developers Should Not Write Programs That Call 'sun' Packages
来源:互联网 发布:网络词蜜汁是什么意思 编辑:程序博客网 时间:2024/06/05 21:54
Why Developers Should Not Write Programs That Call ‘sun’ Packages
The java., javax. and org.* packages documented in the Java Platform Standard Edition API Specification make up the official, supported, public interface.
If a Java program directly calls only API in these packages, it will operate on all Java-compatible platforms, regardless of the underlying OS platform.
The sun.* packages are not part of the supported, public interface.
A Java program that directly calls into sun.* packages is not guaranteed to work on all Java-compatible platforms. In fact, such a program is not guaranteed to work even in future versions on the same platform.
Each company that implements the Java platform will do so in their own private way. The classes in sun.* are present in the JDK to support Oracle’s implementation of the Java platform: the sun.* classes are what make the Java platform classes work “under the covers” for Oracle’s JDK. These classes will not in general be present on another vendor’s Java platform. If your Java program asks for a class “sun.package.Foo” by name, it may fail with ClassNotFoundError, and you will have lost a major advantage of developing in Java.
Technically, nothing prevents your program from calling into sun.* by name. From one release to another, these classes may be removed, or they may be moved from one package to another, and it’s fairly likely that their interface (method names and signatures) will change. (From Oracle’s point of view, since we are committed to maintaining the Java platform, we need to be able to change sun.* to refine and enhance the platform.) In this case, even if you are willing to run only on Oracle’s implementation, you run the risk of a new version of the implementation breaking your program.
In general, writing java programs that rely on sun.* is risky: those classes are not portable, and are not supported.
- Why Developers Should Not Write Programs That Call 'sun' Packages
- Why Developers Should Not Write Programs That Call 'sun' Packages
- Developers should know How, What and Why
- Books that android framework developers should read
- Why you should never call Suspend/TerminateThread
- Standard Programs That Every ABAP Developer Should Know
- Why Software Should Not Have Owners
- Why Should Write Node Modules In C++ If Possible.
- Why not write OS kernel with C++?
- 6 more things C# developers should (not) do
- Why Web Developers Should Switch to Google Chrome(建议使用Chrome浏览器的原因)
- Why the "volatile" type class should not be used
- Why you should not shrink your data files
- Why should I not use equals with inheritance?
- Recursion !!! Recursive calls should not address subproblems that overlap !!!
- [翻]Why call it Apps and not Oracle ERP ?
- ubuntu RPM should not be used directly install RPM packages, use Alien instead!
- Ubuntu下RPM should not be used directly install RPM packages, use Alien instead!
- 笨方法学Python 习题 27: 记住逻辑关系
- java编程常见错误笔记
- php缓存处理
- Android中Recyclerview使用15----禁止RecycleView的滑动
- TensorFlow-mnist-学习
- Why Developers Should Not Write Programs That Call 'sun' Packages
- C++里string类字符串输入的用法
- Android Studio中Git和GitHub使用详解(上篇)
- C++文件的打开与关闭
- tripletLoss,训练,网络配置
- JQuery中的trim()方法去掉前后空格
- gzseek gztell 怎样知道gz文件的大小?
- jQuery选择器(二)
- 瑞博PM9000A+ 主控板与多生理参数功能通讯故障分析与处理方法