-
Notifications
You must be signed in to change notification settings - Fork 216
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 #8 from nblair/detect-circular-reference
Watch for circular references during HollowObjectMapper#initializeTypeState, fail fast
- Loading branch information
Showing
12 changed files
with
177 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ | |
**.ipr | ||
**.iml | ||
**.iws | ||
.idea |
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
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
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
16 changes: 16 additions & 0 deletions
16
hollow/src/test/java/com/netflix/hollow/core/write/objectmapper/DirectCircularReference.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,16 @@ | ||
package com.netflix.hollow.core.write.objectmapper; | ||
|
||
|
||
/** | ||
* Sample type that represents a direct circular reference between 2 classes. | ||
*/ | ||
public class DirectCircularReference { | ||
|
||
private final String name; | ||
private final DirectCircularReference child; | ||
|
||
public DirectCircularReference(String name, DirectCircularReference child) { | ||
this.name = name; | ||
this.child = child; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...src/test/java/com/netflix/hollow/core/write/objectmapper/DirectListCircularReference.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,18 @@ | ||
package com.netflix.hollow.core.write.objectmapper; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
/** | ||
* Sample type that represents a direct circular reference between 2 classes, with a List containing the child. | ||
*/ | ||
public class DirectListCircularReference { | ||
|
||
private final String name; | ||
private final List<DirectListCircularReference> children; | ||
|
||
public DirectListCircularReference(String name, List<DirectListCircularReference> children) { | ||
this.name = name; | ||
this.children = children; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
.../src/test/java/com/netflix/hollow/core/write/objectmapper/DirectMapCircularReference.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,17 @@ | ||
package com.netflix.hollow.core.write.objectmapper; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* Sample type that represents a direct circular reference between 2 classes, with a Map containing the child. | ||
*/ | ||
public class DirectMapCircularReference { | ||
|
||
private final String name; | ||
private final Map<String, DirectMapCircularReference> children; | ||
|
||
public DirectMapCircularReference(String name, Map<String, DirectMapCircularReference> children) { | ||
this.name = name; | ||
this.children = children; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
.../src/test/java/com/netflix/hollow/core/write/objectmapper/DirectSetCircularReference.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,17 @@ | ||
package com.netflix.hollow.core.write.objectmapper; | ||
|
||
import java.util.Set; | ||
|
||
/** | ||
* Sample type that represents a direct circular reference between 2 classes, with a Set containing the child. | ||
*/ | ||
public class DirectSetCircularReference { | ||
|
||
private final String name; | ||
private final Set<DirectSetCircularReference> children; | ||
|
||
public DirectSetCircularReference(String name, Set<DirectSetCircularReference> children) { | ||
this.name = name; | ||
this.children = children; | ||
} | ||
} |
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
31 changes: 31 additions & 0 deletions
31
...w/src/test/java/com/netflix/hollow/core/write/objectmapper/IndirectCircularReference.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,31 @@ | ||
package com.netflix.hollow.core.write.objectmapper; | ||
|
||
/** | ||
* Object model representing an indirect or nested circular reference: | ||
* | ||
* E depends on F, F depends on G, and G depends back on E | ||
*/ | ||
public class IndirectCircularReference { | ||
|
||
class TypeE { | ||
private final TypeF f; | ||
|
||
public TypeE(TypeF f) { | ||
this.f = f; | ||
} | ||
} | ||
class TypeF { | ||
private final TypeG g; | ||
|
||
public TypeF(TypeG g) { | ||
this.g = g; | ||
} | ||
} | ||
class TypeG { | ||
private final TypeE e; | ||
|
||
public TypeG(TypeE e) { | ||
this.e = e; | ||
} | ||
} | ||
} |