Skip to content

Commit

Permalink
Add sanity checks
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Sep 7, 2024
1 parent ad88938 commit c5d7d81
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public BaseObject(Object delegate, BaseObject parent) {
}

public BaseObject(Object delegate, ChildrenTracking parent) {
this.delegate = delegate;
this.delegate = requireNonNull(delegate, "delegate cannot be null");
this.childrenTracking = parent;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

import java.io.Serializable;

import static java.util.Objects.requireNonNull;

public abstract class BaseObject implements Serializable, Cloneable {
protected transient ChildrenTracking childrenTracking;

Expand All @@ -28,12 +30,12 @@ public abstract class BaseObject implements Serializable, Cloneable {
public BaseObject() {}

public BaseObject(Object delegate, BaseObject parent) {
this.delegate = delegate;
this.delegate = requireNonNull(delegate, "delegate cannot be null");
this.childrenTracking = parent != null ? parent::replace : null;
}

public BaseObject(Object delegate, ChildrenTracking parent) {
this.delegate = delegate;
this.delegate = requireNonNull(delegate, "delegate cannot be null");
this.childrenTracking = parent;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

import java.io.Serializable;

import static java.util.Objects.requireNonNull;

public abstract class BaseObject implements Serializable, Cloneable {
protected transient ChildrenTracking childrenTracking;

Expand All @@ -28,12 +30,12 @@ public abstract class BaseObject implements Serializable, Cloneable {
public BaseObject() {}

public BaseObject(Object delegate, BaseObject parent) {
this.delegate = delegate;
this.delegate = requireNonNull(delegate, "delegate cannot be null");
this.childrenTracking = parent != null ? parent::replace : null;
}

public BaseObject(Object delegate, ChildrenTracking parent) {
this.delegate = delegate;
this.delegate = requireNonNull(delegate, "delegate cannot be null");
this.childrenTracking = parent;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

import java.io.Serializable;

import static java.util.Objects.requireNonNull;

public abstract class BaseObject implements Serializable, Cloneable {
protected transient ChildrenTracking childrenTracking;

Expand All @@ -28,12 +30,12 @@ public abstract class BaseObject implements Serializable, Cloneable {
public BaseObject() {}

public BaseObject(Object delegate, BaseObject parent) {
this.delegate = delegate;
this.delegate = requireNonNull(delegate, "delegate cannot be null");
this.childrenTracking = parent != null ? parent::replace : null;
}

public BaseObject(Object delegate, ChildrenTracking parent) {
this.delegate = delegate;
this.delegate = requireNonNull(delegate, "delegate cannot be null");
this.childrenTracking = parent;
}

Expand Down

0 comments on commit c5d7d81

Please sign in to comment.