不要使用com.sun.xml.internal。*? [英] do not use com.sun.xml.internal.*?

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

问题描述

这是真正的语句:

com.sun.xml.internal包是一个内部包作为名称suggestes。
  用户不应该写code依赖于内部JDK实现类。这样的类是JDK和主题的内部实现细节更改,恕不另行通知。

com.sun.xml.internal package is an internal package as the name suggestes. Users should not write code that depends on internal JDK implementation classes. Such classes are internal implementation details of the JDK and subject to change without notice

我的一位同事用他的code,造成javac任务在蚂蚁中的一个类编译失败我们的项目,因为编译器找不到类。来自Sun / Oracle的回答说,这是预期的编译器作为用户不应该使用软件包的行为。

One of my colleagues used one of the classes in his code, which caused javac task in Ant fail to compile our project as the compiler couldn't find the class. Answer from Sun/Oracle says that this is expected behavior of the compiler as user shouldn't use the package.

问题是,为什么在包中的类摆在首位公开?

Question is why the classes in the package made public in the first place?

谢谢,

莎拉

推荐答案

在SUN的JDK类是prefixed太阳。*和不属于公共支持的接口等都应该小心使用的一部分。从href=\"http://java.sun.com/products/jdk/faq/faq-sun-packages.html\">孙常见问题解答的

Sun classes in the JDK are prefixed sun.* and are not part of the public supported interface so should be used with care. From the Sun FAQ:

这是孙包括与该班
  的Java 2 SDK,标准版,秋季
  成包组的java,使用javax。,
  组织*和太阳..所有,但太阳。
  包的一个标准部分
  Java平台和将被支持的
  走向未来。在一般情况下,包
  如日晒,是外面的
  Java平台,可以在不同
  OS平台(Solaris,Windows和Linux,
  Macintosh等),并可以在任何改变
  时间不与SDK版本的通知
  (1.2,1.2.1,1.2.3,等)。程式
  包含在阳光下直接调用。
  包并不是100%纯Java。在
  换句话说:

The classes that Sun includes with the Java 2 SDK, Standard Edition, fall into package groups java., javax., org.* and sun.. All but the sun. packages are a standard part of the Java platform and will be supported into the future. In general, packages such as sun., that are outside of the Java platform, can be different across OS platforms (Solaris, Windows, Linux, Macintosh, etc.) and can change at any time without notice with SDK versions (1.2, 1.2.1, 1.2.3, etc). Programs that contain direct calls to the sun. packages are not 100% Pure Java. In other words:

化java,使用javax。和org。*包
  记载在Java 2平台
  标准版API规范
  弥补了官方的,支持的,
  公共接口。

The java., javax. and org.* packages documented in the Java 2 Platform Standard Edition API Specification make up the official, supported, public interface.

如果一个Java程序直接调用只
  在这些包中的API,将操作
  在所有Java兼容的平台,
  不管底层操作系统
  平台。

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.

一个Java程序,直接调用
  到太阳。*包不保证
  在所有Java兼容工作
  平台。事实上,这样的程序是
  不能保证将来甚至工作
  版本在同一平台上。

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.

这篇关于不要使用com.sun.xml.internal。*?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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