== Why is this an issue?

Classes in the ``++sun.*++`` packages are considered implementation details, and are not part of the Java API.

They can cause problems when moving to new versions of Java because there is no backwards compatibility guarantee. Similarly, they can cause problems when moving to a different Java vendor, such as OpenJDK.


Such classes are almost always wrapped by Java API classes that should be used instead.


=== Noncompliant code example

[source,java]
----
import sun.misc.BASE64Encoder; // Noncompliant
----



ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

Use classes from the Java API instead of Sun classes.


=== Parameters

.Exclude
****
_String_

Comma separated list of Sun packages to be ignored by this rule. Example: sun.misc
****


=== Highlighting

* primary: first `sun` import
* secondary: all subsequent `sun` imports
** message: 'Replace also this "Sun" reference.'


'''
== Comments And Links
(visible only on this page)

=== on 8 Aug 2013, 16:46:08 Freddy Mallet wrote:
Is implemented by \http://jira.codehaus.org/browse/SONARJAVA-281

=== on 2 Mar 2017, 09:25:05 Michael Gumowski wrote:
Move constant cost to linear factor.

endif::env-github,rspecator-view[]
