BT

Removal of sun.misc.Sort and sun.misc.Compare in Java 8

by Bienvenido David on Sep 09, 2013 |

Oracle is removing the sun.misc.Compare interface and sun.misc.Sort class in Java 8. These are old, residual classes that are no longer used within the JDK. sun.misc.Compare is an interface that allows you to compare two Objects and return an int. sun.misc.Sort is a class that takes in a sun.misc.Compare and sorts an Object array using the quicksort algorithm. The sun.misc package is internal to Sun/Oracle and should not be used as they are not publicly supported, and not portable across all JVMs.

These were initially proposed to be deprecated but are now being removed from the JDK after a consensus between the members of the OpenJDK Core Library Development mailing list. You can read the whole discussion from the Deprecate sun.misc.Sort and sun.misc.Compare thread. There is also JDK-6852936, a priority 4 bug in the Oracle JDK to remove unused classes from sun.misc.

Current users of sun.misc.Sort can use the sort() method of java.util.Arrays as better alternative. Users of sun.misc.Compare can use java.util.Comparator as a replacement.

As a side note, a new JDK command-line tool called jdeps is coming in Java 8. This is a tool that helps developers understand the static dependencies of their applications and libraries. This will also help identify the usage of non-standard and internal APIs, which is a complement to the warnings from the Java compiler. You can read more about this new tool from the Provide a command-line tool to find static dependencies thread.

For more information on why sun.* packages should not be used, read the official Oracle FAQ entry on the topic.

Hello stranger!

You need to Register an InfoQ account or to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2013 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT