mirror of
https://github.com/fankes/moshi.git
synced 2025-10-20 00:19:21 +08:00
Fix prose in deferred adapters
This commit is contained in:
@@ -248,7 +248,7 @@ public final class Moshi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A possibly-reentrant chain of lookups a JSON adapter.
|
* A possibly-reentrant chain of lookups for JSON adapters.
|
||||||
*
|
*
|
||||||
* <p>We keep track of the current stack of lookups: we may start by looking up the JSON adapter
|
* <p>We keep track of the current stack of lookups: we may start by looking up the JSON adapter
|
||||||
* for Employee, re-enter looking for the JSON adapter of HomeAddress, and re-enter again looking
|
* for Employee, re-enter looking for the JSON adapter of HomeAddress, and re-enter again looking
|
||||||
|
@@ -35,10 +35,13 @@ public final class DeferredAdapterTest {
|
|||||||
* the cycle work. It's important that any adapters that depend on this deferred adapter don't
|
* the cycle work. It's important that any adapters that depend on this deferred adapter don't
|
||||||
* leak out until it's ready.
|
* leak out until it's ready.
|
||||||
*
|
*
|
||||||
* <p>This test sets up a circular dependency BlueNode to GreenNode to BlueNode and then tries to
|
* <p>This test sets up a circular dependency [BlueNode -> GreenNode -> BlueNode] and then tries
|
||||||
* use it before the BlueNode JSON adapter is built, but after the GreenNode adapter is built. It
|
* to use a GreenNode JSON adapter before the BlueNode JSON adapter is built. It creates a
|
||||||
* creates a similar cycle for BlueNode to RedNode to BlueNode so the order adapters are retrieved
|
* similar cycle [BlueNode -> RedNode -> BlueNode] so the order adapters are retrieved is
|
||||||
* is insignificant.
|
* insignificant.
|
||||||
|
*
|
||||||
|
* <p>This used to trigger a crash because we'd incorrectly put the GreenNode JSON adapter in the
|
||||||
|
* cache even though it depended upon an incomplete BlueNode JSON adapter.
|
||||||
*/
|
*/
|
||||||
@Test public void concurrentSafe() {
|
@Test public void concurrentSafe() {
|
||||||
final List<Throwable> failures = new ArrayList<>();
|
final List<Throwable> failures = new ArrayList<>();
|
||||||
|
Reference in New Issue
Block a user