rspec/rules/S1191/java/rule.adoc

64 lines
1.9 KiB
Plaintext

== Why is this an issue?
The classes in the `sun.*` packages are not part of the official Java API and are not intended for public use. They are internal
implementation details specific to the Oracle JDK (Java Development Kit). Therefore, their availability, behavior, or compatibility is not
guaranteed across different Java implementations or versions.
Since these classes are not part of the official Java API, they usually lack proper documentation and support. Finding comprehensive and
up-to-date information about their usage, functionality, and potential limitations can be challenging. This lack of documentation can make
it difficult to understand how to use these classes correctly.
Classes in the `sun.*` packages are often platform-dependent and can vary between different operating systems or Java Virtual Machine (JVM)
implementations. Relying on these classes may lead to code that works on one platform but fails on others, limiting your code's portability
and cross-platform compatibility.
=== Noncompliant code example
[source,java]
----
import sun.misc.BASE64Encoder; // Noncompliant
----
== Documentation
* https://www.oracle.com/java/technologies/faq-sun-packages.html[Sun Packages]
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[]