BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

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

| by Bienvenido David Follow 0 Followers on Sep 09, 2013. Estimated reading time: 1 minute |

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.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login 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

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT