Skip to content

Commit 313a713

Browse files
committed
Merge pull request #940 from Sergio-Mira/hash-code-fixes
Add hashCode implementations where there are none
2 parents 5612187 + 7862187 commit 313a713

File tree

5 files changed

+18
-1
lines changed

5 files changed

+18
-1
lines changed

src/main/java/com/fasterxml/jackson/databind/node/BooleanNode.java

+5
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ public final void serialize(JsonGenerator jg, SerializerProvider provider)
7777
jg.writeBoolean(_value);
7878
}
7979

80+
@Override
81+
public int hashCode() {
82+
return Boolean.valueOf(_value).hashCode();
83+
}
84+
8085
@Override
8186
public boolean equals(Object o)
8287
{

src/main/java/com/fasterxml/jackson/databind/node/IntNode.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,5 +129,5 @@ public boolean equals(Object o)
129129
}
130130

131131
@Override
132-
public int hashCode() { return _value; }
132+
public int hashCode() { return _value; }
133133
}

src/main/java/com/fasterxml/jackson/databind/node/MissingNode.java

+5
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,9 @@ public String toString()
9595
// toString() should never return null
9696
return "";
9797
}
98+
99+
@Override
100+
public int hashCode() {
101+
return 0;
102+
}
98103
}

src/main/java/com/fasterxml/jackson/databind/node/NullNode.java

+5
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,9 @@ public boolean equals(Object o)
5353
{
5454
return (o == this);
5555
}
56+
57+
@Override
58+
public int hashCode() {
59+
return 0;
60+
}
5661
}

src/main/java/com/fasterxml/jackson/databind/node/ValueNode.java

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ public void serializeWithType(JsonGenerator jg, SerializerProvider provider,
4545
typeSer.writeTypeSuffixForScalar(this, jg);
4646
}
4747

48+
@Override public abstract int hashCode();
49+
4850
/*
4951
/**********************************************************************
5052
/* Base impls for standard methods

0 commit comments

Comments
 (0)