diff --git a/config/src/main/java/com/typesafe/config/impl/MemoKey.java b/config/src/main/java/com/typesafe/config/impl/MemoKey.java index d948aed0..cd843dad 100644 --- a/config/src/main/java/com/typesafe/config/impl/MemoKey.java +++ b/config/src/main/java/com/typesafe/config/impl/MemoKey.java @@ -2,20 +2,17 @@ package com.typesafe.config.impl; /** The key used to memoize already-traversed nodes when resolving substitutions */ final class MemoKey { - MemoKey(AbstractConfigValue root, AbstractConfigValue value, Path restrictToChildOrNull) { - this.root = root; + MemoKey(AbstractConfigValue value, Path restrictToChildOrNull) { this.value = value; this.restrictToChildOrNull = restrictToChildOrNull; } - final private AbstractConfigValue root; final private AbstractConfigValue value; final private Path restrictToChildOrNull; @Override public final int hashCode() { int h = System.identityHashCode(value); - h = h + 41 * (41 + root.hashCode()); if (restrictToChildOrNull != null) { return h + 41 * (41 + restrictToChildOrNull.hashCode()); } else { @@ -29,8 +26,6 @@ final class MemoKey { MemoKey o = (MemoKey) other; if (o.value != this.value) return false; - else if (o.root != this.root) - return false; else if (o.restrictToChildOrNull == this.restrictToChildOrNull) return true; else if (o.restrictToChildOrNull == null || this.restrictToChildOrNull == null) diff --git a/config/src/main/java/com/typesafe/config/impl/ResolveContext.java b/config/src/main/java/com/typesafe/config/impl/ResolveContext.java index 076d07fe..cf669912 100644 --- a/config/src/main/java/com/typesafe/config/impl/ResolveContext.java +++ b/config/src/main/java/com/typesafe/config/impl/ResolveContext.java @@ -146,7 +146,7 @@ final class ResolveContext { throws NotPossibleToResolve { // a fully-resolved (no restrictToChild) object can satisfy a // request for a restricted object, so always check that first. - final MemoKey fullKey = new MemoKey(source.root, original, null); + final MemoKey fullKey = new MemoKey(original, null); MemoKey restrictedKey = null; AbstractConfigValue cached = memos.get(fullKey); @@ -155,7 +155,7 @@ final class ResolveContext { // compute the restrictToChild object so use a more limited // memo key if (cached == null && isRestrictedToChild()) { - restrictedKey = new MemoKey(source.root, original, restrictToChild()); + restrictedKey = new MemoKey(original, restrictToChild()); cached = memos.get(restrictedKey); }