-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #651 from cushon/i650
Use IdentityHashSet for cycle detection
- Loading branch information
Showing
3 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/test/java/org/json/junit/data/RecursiveBeanEquals.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.json.junit.data; | ||
|
||
/** test class for verifying if recursively defined bean can be correctly identified */ | ||
public class RecursiveBeanEquals { | ||
private final String name; | ||
private Object reference; | ||
|
||
public RecursiveBeanEquals(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public Object getRef() { | ||
return reference; | ||
} | ||
|
||
public void setRef(Object refObj) { | ||
reference = refObj; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
return other instanceof RecursiveBeanEquals && name.equals(((RecursiveBeanEquals) other).name); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return name.hashCode(); | ||
} | ||
} |