From 597452cac0981acbbee354254954d75740727a13 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sat, 27 Dec 2014 21:13:17 -0500 Subject: [PATCH] Remove some dead code --- .../config/impl/ConfigConcatenation.java | 15 --- .../typesafe/config/impl/ResolveSource.java | 91 +------------------ 2 files changed, 1 insertion(+), 105 deletions(-) diff --git a/config/src/main/java/com/typesafe/config/impl/ConfigConcatenation.java b/config/src/main/java/com/typesafe/config/impl/ConfigConcatenation.java index 88f34ca9..dd69528f 100644 --- a/config/src/main/java/com/typesafe/config/impl/ConfigConcatenation.java +++ b/config/src/main/java/com/typesafe/config/impl/ConfigConcatenation.java @@ -282,19 +282,4 @@ final class ConfigConcatenation extends AbstractConfigValue implements Unmergeab p.render(sb, indent, atRoot, options); } } - - static List valuesFromPieces(ConfigOrigin origin, List pieces) { - List values = new ArrayList(pieces.size()); - for (Object p : pieces) { - if (p instanceof SubstitutionExpression) { - values.add(new ConfigReference(origin, (SubstitutionExpression) p)); - } else if (p instanceof String) { - values.add(new ConfigString(origin, (String) p)); - } else { - throw new ConfigException.BugOrBroken("Unexpected piece " + p); - } - } - - return values; - } } diff --git a/config/src/main/java/com/typesafe/config/impl/ResolveSource.java b/config/src/main/java/com/typesafe/config/impl/ResolveSource.java index dd6a4d74..b192c305 100644 --- a/config/src/main/java/com/typesafe/config/impl/ResolveSource.java +++ b/config/src/main/java/com/typesafe/config/impl/ResolveSource.java @@ -1,8 +1,5 @@ package com.typesafe.config.impl; -import java.util.Iterator; -import java.util.NoSuchElementException; - import com.typesafe.config.ConfigException; import com.typesafe.config.impl.AbstractConfigValue.NotPossibleToResolve; @@ -161,19 +158,6 @@ final class ResolveSource { } } - ResolveSource popParent(Container parent) { - if (ConfigImpl.traceSubstitutionsEnabled()) - ConfigImpl.trace("popping parent " + parent); - if (parent == null) - throw new ConfigException.BugOrBroken("can't pop null parent"); - else if (pathFromRoot == null) - return this; - else if (pathFromRoot.head() != parent) - throw new ConfigException.BugOrBroken("parent was not pushed, can't pop: " + parent); - else - return new ResolveSource(root, pathFromRoot.tail()); - } - ResolveSource resetParents() { if (pathFromRoot == null) return this; @@ -271,27 +255,10 @@ final class ResolveSource { } // a persistent list - static final class Node implements Iterable { + static final class Node { final T value; final Node next; - @Override - public int hashCode() { - return value.hashCode() + 41 * (41 + next.hashCode()); - } - - @Override - public boolean equals(Object other) { - if (other instanceof Node) { - if (value == ((Node) other).value) - return true; - else - return value.equals(((Node) other).value); - } else { - return false; - } - } - Node(T value, Node next) { this.value = value; this.next = next; @@ -334,40 +301,6 @@ final class ResolveSource { } } - private static class NodeIterator implements Iterator { - Node current; - - NodeIterator(Node current) { - this.current = current; - } - - @Override - public T next() { - if (current == null) { - throw new NoSuchElementException(); - } else { - T result = current.value; - current = current.next; - return result; - } - } - - @Override - public boolean hasNext() { - return current != null; - } - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - } - - @Override - public Iterator iterator() { - return new NodeIterator(this); - } - @Override public String toString() { StringBuffer sb = new StringBuffer(); @@ -394,17 +327,6 @@ final class ResolveSource { this.pathFromRoot = pathFromRoot; } - ValueWithPath(AbstractConfigValue value) { - this(value, null); - } - - ValueWithPath addParent(Container parent) { - if (pathFromRoot == null) - return new ValueWithPath(value, new Node(parent)); - else - return new ValueWithPath(value, pathFromRoot.prepend(parent)); - } - @Override public String toString() { return "ValueWithPath(value=" + value + ", pathFromRoot=" + pathFromRoot + ")"; @@ -420,17 +342,6 @@ final class ResolveSource { this.pathFromRoot = pathFromRoot; } - ResultWithPath(ResolveResult result) { - this(result, null); - } - - ResultWithPath addParent(Container parent) { - if (pathFromRoot == null) - return new ResultWithPath(result, new Node(parent)); - else - return new ResultWithPath(result, pathFromRoot.prepend(parent)); - } - @Override public String toString() { return "ResultWithPath(result=" + result + ", pathFromRoot=" + pathFromRoot + ")";