mirror of
https://github.com/lightbend/config.git
synced 2025-03-17 04:40:41 +08:00
Fix compilation errors
This commit is contained in:
parent
368ad614f8
commit
13cb4785b9
@ -405,7 +405,7 @@ final class ConfigDocumentParser {
|
||||
boolean lastInsideEquals = false;
|
||||
ArrayList<AbstractConfigNode> objectNodes = new ArrayList<AbstractConfigNode>();
|
||||
ArrayList<AbstractConfigNode> keyValueNodes;
|
||||
HashMap<String, Boolean> keys = new HashMap();
|
||||
HashMap<String, Boolean> keys = new HashMap<String, Boolean>();
|
||||
if (hadOpenCurly)
|
||||
objectNodes.add(new ConfigNodeSingleToken(Tokens.OPEN_CURLY));
|
||||
|
||||
@ -653,7 +653,7 @@ final class ConfigDocumentParser {
|
||||
if (t == Tokens.END) {
|
||||
if (missingCurly) {
|
||||
// If there were no braces, the entire document should be treated as a single object
|
||||
return new ConfigNodeRoot(Collections.singletonList(new ConfigNodeObject(children)));
|
||||
return new ConfigNodeRoot(Collections.singletonList((AbstractConfigNode)new ConfigNodeObject(children)));
|
||||
} else {
|
||||
return new ConfigNodeRoot(children);
|
||||
}
|
||||
@ -691,7 +691,7 @@ final class ConfigDocumentParser {
|
||||
}
|
||||
} else {
|
||||
putBack(t);
|
||||
ArrayList<AbstractConfigNode> nodes = new ArrayList();
|
||||
ArrayList<AbstractConfigNode> nodes = new ArrayList<AbstractConfigNode>();
|
||||
AbstractConfigNodeValue node = consolidateValues(nodes);
|
||||
t = nextToken();
|
||||
if (t == Tokens.END) {
|
||||
|
@ -13,12 +13,12 @@ final class ConfigNodeField extends AbstractConfigNode {
|
||||
final private ArrayList<AbstractConfigNode> children;
|
||||
|
||||
public ConfigNodeField(Collection<AbstractConfigNode> children) {
|
||||
this.children = new ArrayList(children);
|
||||
this.children = new ArrayList<AbstractConfigNode>(children);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<Token> tokens() {
|
||||
ArrayList<Token> tokens = new ArrayList();
|
||||
ArrayList<Token> tokens = new ArrayList<Token>();
|
||||
for (AbstractConfigNode child : children) {
|
||||
tokens.addAll(child.tokens());
|
||||
}
|
||||
@ -26,7 +26,7 @@ final class ConfigNodeField extends AbstractConfigNode {
|
||||
}
|
||||
|
||||
public ConfigNodeField replaceValue(AbstractConfigNodeValue newValue) {
|
||||
ArrayList<AbstractConfigNode> childrenCopy = new ArrayList(children);
|
||||
ArrayList<AbstractConfigNode> childrenCopy = new ArrayList<AbstractConfigNode>(children);
|
||||
for (int i = 0; i < childrenCopy.size(); i++) {
|
||||
if (childrenCopy.get(i) instanceof AbstractConfigNodeValue) {
|
||||
childrenCopy.set(i, newValue);
|
||||
|
@ -13,7 +13,7 @@ final class ConfigNodeObject extends ConfigNodeComplexValue {
|
||||
}
|
||||
|
||||
protected ConfigNodeObject changeValueOnPath(Path desiredPath, AbstractConfigNodeValue value) {
|
||||
ArrayList<AbstractConfigNode> childrenCopy = new ArrayList(super.children);
|
||||
ArrayList<AbstractConfigNode> childrenCopy = new ArrayList<AbstractConfigNode>(super.children);
|
||||
// Copy the value so we can change it to null but not modify the original parameter
|
||||
AbstractConfigNodeValue valueCopy = value;
|
||||
for (int i = super.children.size() - 1; i >= 0; i--) {
|
||||
@ -62,7 +62,7 @@ final class ConfigNodeObject extends ConfigNodeComplexValue {
|
||||
|
||||
protected ConfigNodeObject addValueOnPath(ConfigNodePath desiredPath, AbstractConfigNodeValue value, ConfigSyntax flavor) {
|
||||
Path path = desiredPath.value();
|
||||
ArrayList<AbstractConfigNode> childrenCopy = new ArrayList(super.children);
|
||||
ArrayList<AbstractConfigNode> childrenCopy = new ArrayList<AbstractConfigNode>(super.children);
|
||||
if (path.length() > 1) {
|
||||
for (int i = super.children.size() - 1; i >= 0; i--) {
|
||||
if (!(super.children.get(i) instanceof ConfigNodeField)) {
|
||||
@ -80,7 +80,7 @@ final class ConfigNodeObject extends ConfigNodeComplexValue {
|
||||
}
|
||||
boolean startsWithBrace = super.children.get(0) instanceof ConfigNodeSingleToken &&
|
||||
((ConfigNodeSingleToken) super.children.get(0)).token() == Tokens.OPEN_CURLY;
|
||||
ArrayList<AbstractConfigNode> newNodes = new ArrayList();
|
||||
ArrayList<AbstractConfigNode> newNodes = new ArrayList<AbstractConfigNode>();
|
||||
newNodes.add(new ConfigNodeSingleToken(Tokens.newLine(null)));
|
||||
newNodes.add(desiredPath.first());
|
||||
newNodes.add(new ConfigNodeSingleToken(Tokens.newIgnoredWhitespace(null, " ")));
|
||||
@ -90,7 +90,7 @@ final class ConfigNodeObject extends ConfigNodeComplexValue {
|
||||
if (path.length() == 1) {
|
||||
newNodes.add(value);
|
||||
} else {
|
||||
ArrayList<AbstractConfigNode> newObjectNodes = new ArrayList();
|
||||
ArrayList<AbstractConfigNode> newObjectNodes = new ArrayList<AbstractConfigNode>();
|
||||
newObjectNodes.add(new ConfigNodeSingleToken(Tokens.OPEN_CURLY));
|
||||
newObjectNodes.add(new ConfigNodeSingleToken(Tokens.CLOSE_CURLY));
|
||||
ConfigNodeObject newObject = new ConfigNodeObject(newObjectNodes);
|
||||
|
@ -21,7 +21,7 @@ final class ConfigNodeRoot extends ConfigNodeComplexValue {
|
||||
}
|
||||
|
||||
protected ConfigNodeRoot setValue(String desiredPath, AbstractConfigNodeValue value, ConfigSyntax flavor) {
|
||||
ArrayList<AbstractConfigNode> childrenCopy = new ArrayList(children);
|
||||
ArrayList<AbstractConfigNode> childrenCopy = new ArrayList<AbstractConfigNode>(children);
|
||||
for (int i = 0; i < childrenCopy.size(); i++) {
|
||||
AbstractConfigNode node = childrenCopy.get(i);
|
||||
if (node instanceof ConfigNodeComplexValue) {
|
||||
|
@ -117,7 +117,7 @@ final class ConfigParser {
|
||||
}
|
||||
|
||||
if (comments != null && !comments.isEmpty()) {
|
||||
v = v.withOrigin(v.origin().prependComments(new ArrayList(comments)));
|
||||
v = v.withOrigin(v.origin().prependComments(new ArrayList<String>(comments)));
|
||||
comments.clear();
|
||||
}
|
||||
|
||||
@ -220,7 +220,7 @@ final class ConfigParser {
|
||||
SimpleConfigOrigin objectOrigin = lineOrigin();
|
||||
boolean lastWasNewline = false;
|
||||
|
||||
ArrayList<AbstractConfigNode> nodes = new ArrayList(n.children());
|
||||
ArrayList<AbstractConfigNode> nodes = new ArrayList<AbstractConfigNode>(n.children());
|
||||
List<String> comments = new ArrayList<String>();
|
||||
for (int i = 0; i < nodes.size(); i++) {
|
||||
AbstractConfigNode node = nodes.get(i);
|
||||
@ -381,7 +381,7 @@ final class ConfigParser {
|
||||
if (lastWasNewLine && v == null) {
|
||||
comments.clear();
|
||||
} else if (v != null) {
|
||||
values.add(v.withOrigin(v.origin().appendComments(new ArrayList(comments))));
|
||||
values.add(v.withOrigin(v.origin().appendComments(new ArrayList<String>(comments))));
|
||||
comments.clear();
|
||||
v = null;
|
||||
}
|
||||
@ -389,7 +389,7 @@ final class ConfigParser {
|
||||
} else if (node instanceof AbstractConfigNodeValue) {
|
||||
lastWasNewLine = false;
|
||||
if (v != null) {
|
||||
values.add(v.withOrigin(v.origin().appendComments(new ArrayList(comments))));
|
||||
values.add(v.withOrigin(v.origin().appendComments(new ArrayList<String>(comments))));
|
||||
comments.clear();
|
||||
}
|
||||
v = parseValue((AbstractConfigNodeValue)node, comments);
|
||||
@ -397,7 +397,7 @@ final class ConfigParser {
|
||||
}
|
||||
// There shouldn't be any comments at this point, but add them just in case
|
||||
if (v != null) {
|
||||
values.add(v.withOrigin(v.origin().appendComments(new ArrayList(comments))));
|
||||
values.add(v.withOrigin(v.origin().appendComments(new ArrayList<String>(comments))));
|
||||
}
|
||||
arrayCount -= 1;
|
||||
return new SimpleConfigList(arrayOrigin, values);
|
||||
@ -418,7 +418,7 @@ final class ConfigParser {
|
||||
if (lastWasNewLine && result == null) {
|
||||
comments.clear();
|
||||
} else if (result != null) {
|
||||
result = result.withOrigin(result.origin().appendComments(new ArrayList(comments)));
|
||||
result = result.withOrigin(result.origin().appendComments(new ArrayList<String>(comments)));
|
||||
comments.clear();
|
||||
break;
|
||||
}
|
||||
|
@ -211,7 +211,9 @@ public abstract class Parseable implements ConfigParseable {
|
||||
return rawParseDocument(origin, finalOptions);
|
||||
} catch (IOException e) {
|
||||
if (finalOptions.getAllowMissing()) {
|
||||
return new SimpleConfigDocument(new ConfigNodeRoot(Collections.singletonList(new ConfigNodeObject(new ArrayList<AbstractConfigNode>()))), finalOptions);
|
||||
ArrayList<AbstractConfigNode> children = new ArrayList<AbstractConfigNode>();
|
||||
children.add(new ConfigNodeObject(new ArrayList<AbstractConfigNode>()));
|
||||
return new SimpleConfigDocument(new ConfigNodeRoot(children), finalOptions);
|
||||
} else {
|
||||
trace("exception loading " + origin.description() + ": " + e.getClass().getName()
|
||||
+ ": " + e.getMessage());
|
||||
|
Loading…
Reference in New Issue
Block a user