Skip to content

Commit

Permalink
objectionary#3160 resolve PMD.ConstructorShouldDoInitialization warning
Browse files Browse the repository at this point in the history
  • Loading branch information
c71n93 committed May 16, 2024
1 parent b2a049c commit d3a8376
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions eo-runtime/src/main/java/org/eolang/PhDefault.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* @checkstyle DesignForExtensionCheck (500 lines)
*/
@Versionized
@SuppressWarnings({"PMD.TooManyMethods", "PMD.ConstructorShouldDoInitialization", "PMD.GodClass"})
@SuppressWarnings({"PMD.TooManyMethods", "PMD.GodClass"})
public class PhDefault implements Phi, Cloneable {
/**
* Vertices.
Expand Down Expand Up @@ -74,7 +74,7 @@ public class PhDefault implements Phi, Cloneable {
* Data.
* @checkstyle VisibilityModifierCheck (2 lines)
*/
private AtomicReference<byte[]> data = new AtomicReference<>(null);
private AtomicReference<byte[]> data;

/**
* Forma of it.
Expand All @@ -96,6 +96,7 @@ public class PhDefault implements Phi, Cloneable {
*/
@SuppressWarnings("PMD.ConstructorOnlyInitializesOrCallOtherConstructors")
public PhDefault() {
this.data = new AtomicReference<>(null);
this.vertex = PhDefault.VTX.next();
this.form = this.getClass().getName();
this.attrs = new HashMap<>(0);
Expand Down
9 changes: 5 additions & 4 deletions eo-runtime/src/main/java/org/eolang/PhPackage.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* @since 0.22
*/
@Versionized
@SuppressWarnings({"PMD.TooManyMethods", "PMD.ConstructorShouldDoInitialization"})
@SuppressWarnings("PMD.TooManyMethods")
final class PhPackage implements Phi {

/**
Expand All @@ -46,16 +46,17 @@ final class PhPackage implements Phi {
/**
* All of them.
*/
private final ThreadLocal<Map<String, Phi>> objects = ThreadLocal.withInitial(
() -> new ConcurrentHashMap<>(0)
);
private final ThreadLocal<Map<String, Phi>> objects;

/**
* Ctor.
* @param name The name
*/
PhPackage(final String name) {
this.pkg = name;
this.objects = ThreadLocal.withInitial(
() -> new ConcurrentHashMap<>(0)
);
}

@Override
Expand Down

0 comments on commit d3a8376

Please sign in to comment.