2023-05-03 11:06:20 +02:00
|
|
|
== Why is this an issue?
|
|
|
|
|
2020-06-30 12:47:33 +02:00
|
|
|
include::../description.adoc[]
|
|
|
|
|
|
|
|
include::../noncompliant.adoc[]
|
|
|
|
|
|
|
|
include::../compliant.adoc[]
|
|
|
|
|
2023-05-03 11:06:20 +02:00
|
|
|
=== Exceptions
|
2020-06-30 12:47:33 +02:00
|
|
|
|
|
|
|
When the type of the field is the containing class and that field is static, no issue is raised to allow singletons named like the type.
|
|
|
|
|
2021-02-02 15:02:10 +01:00
|
|
|
|
2020-06-30 12:47:33 +02:00
|
|
|
----
|
|
|
|
public class Foo {
|
|
|
|
...
|
|
|
|
private static Foo foo;
|
|
|
|
public Foo getInstance() {
|
|
|
|
if(foo==null) {
|
|
|
|
foo = new Foo();
|
|
|
|
}
|
|
|
|
return foo;
|
|
|
|
}
|
|
|
|
...
|
|
|
|
}
|
|
|
|
----
|
2021-09-20 15:38:42 +02:00
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
|
|
|
|
'''
|
|
|
|
== Implementation Specification
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::../message.adoc[]
|
|
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|