46 lines
824 B
Plaintext
46 lines
824 B
Plaintext
== Why is this an issue?
|
|
|
|
According to the Java Language Specification:
|
|
|
|
|
|
____
|
|
Unnamed packages are provided by the Java platform principally for convenience when developing small or temporary applications or when just beginning development.
|
|
|
|
____
|
|
|
|
To enforce this best practice, classes located in default package can no longer be accessed from named ones since Java 1.4.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,java]
|
|
----
|
|
public class MyClass { /* ... */ }
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,java]
|
|
----
|
|
package org.example;
|
|
|
|
public class MyClass{ /* ... */ }
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::message.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|