Skip to content

Commit

Permalink
[hotfix] Preserve the singleton property for ResourceProfile#ANY.
Browse files Browse the repository at this point in the history
  • Loading branch information
xintongsong authored and azagrebin committed Nov 12, 2019
1 parent bfd6aa5 commit 36d1b62
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Expand Up @@ -503,8 +503,17 @@ public String toString() {
// ------------------------------------------------------------------------

private Object readResolve() {
// try to preserve the singleton property for UNKNOWN
return this.equals(UNKNOWN) ? UNKNOWN : this;
// try to preserve the singleton property for UNKNOWN and ANY

if (this.equals(UNKNOWN)) {
return UNKNOWN;
}

if (this.equals(ANY)) {
return ANY;
}

return this;
}

// ------------------------------------------------------------------------
Expand Down
Expand Up @@ -260,4 +260,11 @@ public void testSingletonPropertyOfUnknown() throws Exception {

assertSame(ResourceProfile.UNKNOWN, copiedProfile);
}

@Test
public void testSingletonPropertyOfAny() throws Exception {
final ResourceProfile copiedProfile = CommonTestUtils.createCopySerializable(ResourceProfile.ANY);

assertSame(ResourceProfile.ANY, copiedProfile);
}
}

0 comments on commit 36d1b62

Please sign in to comment.