45 lines
695 B
Plaintext
45 lines
695 B
Plaintext
include::../description.adoc[]
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
class Ball {
|
|
String color="red"; // Noncompliant
|
|
}
|
|
enum A {
|
|
B;
|
|
int a;
|
|
}
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
class Ball {
|
|
private String color="red"; // Compliant
|
|
}
|
|
enum A {
|
|
B;
|
|
private int a;
|
|
}
|
|
----
|
|
|
|
== Exceptions
|
|
|
|
Members annotated with ``++@VisibleForTesting++`` annotation are ignored, as it indicates that visibility has been purposely relaxed to make the code testable.
|
|
|
|
|
|
----
|
|
class Cone {
|
|
@VisibleForTesting
|
|
Logger logger; // Compliant
|
|
}
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|