John Eipe
John Eipe

Reputation: 11266

what happened to sun.* packages

I don't find any references in JDK 7 documentation regarding sun.* packages. Is it deprecated. But then what are the substitutes?

For eg: sun.reflect.*; is deprecated, so what are the options now?

It would be great if someone could post the deprecated packages and the new options available.

Note: I succeded in using them by setting access rules to all available. enter image description here

What does this mean?

Upvotes: 1

Views: 1175

Answers (2)

Erwin Bolwidt
Erwin Bolwidt

Reputation: 31299

The sun.reflect packages are not deprecated. They are for internal use by the JDK only. Oracle (formerly Sun) does not document the internal packages and does not guarantee that they will exist on all Java platform implementations (any vendor can make a Java platform implementation) nor that they will be the same in all versions of the standard Oracle Java platform implementation.

Oracle explains this on their website:

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.

Upvotes: 1

bobbel
bobbel

Reputation: 3365

You have to use the java.lang.reflect package for reflection purposes.

See: http://docs.oracle.com/javase/8/docs/api/java/lang/reflect/package-summary.html

Upvotes: 1

Related Questions