Fix compilation errors

This commit is contained in:
Preben Ingvaldsen 2015-03-26 16:57:46 -07:00
parent 368ad614f8
commit 13cb4785b9
6 changed files with 20 additions and 18 deletions

View File

@ -405,7 +405,7 @@ final class ConfigDocumentParser {
boolean lastInsideEquals = false; boolean lastInsideEquals = false;
ArrayList<AbstractConfigNode> objectNodes = new ArrayList<AbstractConfigNode>(); ArrayList<AbstractConfigNode> objectNodes = new ArrayList<AbstractConfigNode>();
ArrayList<AbstractConfigNode> keyValueNodes; ArrayList<AbstractConfigNode> keyValueNodes;
HashMap<String, Boolean> keys = new HashMap(); HashMap<String, Boolean> keys = new HashMap<String, Boolean>();
if (hadOpenCurly) if (hadOpenCurly)
objectNodes.add(new ConfigNodeSingleToken(Tokens.OPEN_CURLY)); objectNodes.add(new ConfigNodeSingleToken(Tokens.OPEN_CURLY));
@ -653,7 +653,7 @@ final class ConfigDocumentParser {
if (t == Tokens.END) { if (t == Tokens.END) {
if (missingCurly) { if (missingCurly) {
// If there were no braces, the entire document should be treated as a single object // 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 { } else {
return new ConfigNodeRoot(children); return new ConfigNodeRoot(children);
} }
@ -691,7 +691,7 @@ final class ConfigDocumentParser {
} }
} else { } else {
putBack(t); putBack(t);
ArrayList<AbstractConfigNode> nodes = new ArrayList(); ArrayList<AbstractConfigNode> nodes = new ArrayList<AbstractConfigNode>();
AbstractConfigNodeValue node = consolidateValues(nodes); AbstractConfigNodeValue node = consolidateValues(nodes);
t = nextToken(); t = nextToken();
if (t == Tokens.END) { if (t == Tokens.END) {

View File

@ -13,12 +13,12 @@ final class ConfigNodeField extends AbstractConfigNode {
final private ArrayList<AbstractConfigNode> children; final private ArrayList<AbstractConfigNode> children;
public ConfigNodeField(Collection<AbstractConfigNode> children) { public ConfigNodeField(Collection<AbstractConfigNode> children) {
this.children = new ArrayList(children); this.children = new ArrayList<AbstractConfigNode>(children);
} }
@Override @Override
protected Collection<Token> tokens() { protected Collection<Token> tokens() {
ArrayList<Token> tokens = new ArrayList(); ArrayList<Token> tokens = new ArrayList<Token>();
for (AbstractConfigNode child : children) { for (AbstractConfigNode child : children) {
tokens.addAll(child.tokens()); tokens.addAll(child.tokens());
} }
@ -26,7 +26,7 @@ final class ConfigNodeField extends AbstractConfigNode {
} }
public ConfigNodeField replaceValue(AbstractConfigNodeValue newValue) { 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++) { for (int i = 0; i < childrenCopy.size(); i++) {
if (childrenCopy.get(i) instanceof AbstractConfigNodeValue) { if (childrenCopy.get(i) instanceof AbstractConfigNodeValue) {
childrenCopy.set(i, newValue); childrenCopy.set(i, newValue);

View File

@ -13,7 +13,7 @@ final class ConfigNodeObject extends ConfigNodeComplexValue {
} }
protected ConfigNodeObject changeValueOnPath(Path desiredPath, AbstractConfigNodeValue value) { 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 // Copy the value so we can change it to null but not modify the original parameter
AbstractConfigNodeValue valueCopy = value; AbstractConfigNodeValue valueCopy = value;
for (int i = super.children.size() - 1; i >= 0; i--) { 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) { protected ConfigNodeObject addValueOnPath(ConfigNodePath desiredPath, AbstractConfigNodeValue value, ConfigSyntax flavor) {
Path path = desiredPath.value(); Path path = desiredPath.value();
ArrayList<AbstractConfigNode> childrenCopy = new ArrayList(super.children); ArrayList<AbstractConfigNode> childrenCopy = new ArrayList<AbstractConfigNode>(super.children);
if (path.length() > 1) { if (path.length() > 1) {
for (int i = super.children.size() - 1; i >= 0; i--) { for (int i = super.children.size() - 1; i >= 0; i--) {
if (!(super.children.get(i) instanceof ConfigNodeField)) { if (!(super.children.get(i) instanceof ConfigNodeField)) {
@ -80,7 +80,7 @@ final class ConfigNodeObject extends ConfigNodeComplexValue {
} }
boolean startsWithBrace = super.children.get(0) instanceof ConfigNodeSingleToken && boolean startsWithBrace = super.children.get(0) instanceof ConfigNodeSingleToken &&
((ConfigNodeSingleToken) super.children.get(0)).token() == Tokens.OPEN_CURLY; ((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(new ConfigNodeSingleToken(Tokens.newLine(null)));
newNodes.add(desiredPath.first()); newNodes.add(desiredPath.first());
newNodes.add(new ConfigNodeSingleToken(Tokens.newIgnoredWhitespace(null, " "))); newNodes.add(new ConfigNodeSingleToken(Tokens.newIgnoredWhitespace(null, " ")));
@ -90,7 +90,7 @@ final class ConfigNodeObject extends ConfigNodeComplexValue {
if (path.length() == 1) { if (path.length() == 1) {
newNodes.add(value); newNodes.add(value);
} else { } else {
ArrayList<AbstractConfigNode> newObjectNodes = new ArrayList(); ArrayList<AbstractConfigNode> newObjectNodes = new ArrayList<AbstractConfigNode>();
newObjectNodes.add(new ConfigNodeSingleToken(Tokens.OPEN_CURLY)); newObjectNodes.add(new ConfigNodeSingleToken(Tokens.OPEN_CURLY));
newObjectNodes.add(new ConfigNodeSingleToken(Tokens.CLOSE_CURLY)); newObjectNodes.add(new ConfigNodeSingleToken(Tokens.CLOSE_CURLY));
ConfigNodeObject newObject = new ConfigNodeObject(newObjectNodes); ConfigNodeObject newObject = new ConfigNodeObject(newObjectNodes);

View File

@ -21,7 +21,7 @@ final class ConfigNodeRoot extends ConfigNodeComplexValue {
} }
protected ConfigNodeRoot setValue(String desiredPath, AbstractConfigNodeValue value, ConfigSyntax flavor) { 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++) { for (int i = 0; i < childrenCopy.size(); i++) {
AbstractConfigNode node = childrenCopy.get(i); AbstractConfigNode node = childrenCopy.get(i);
if (node instanceof ConfigNodeComplexValue) { if (node instanceof ConfigNodeComplexValue) {

View File

@ -117,7 +117,7 @@ final class ConfigParser {
} }
if (comments != null && !comments.isEmpty()) { 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(); comments.clear();
} }
@ -220,7 +220,7 @@ final class ConfigParser {
SimpleConfigOrigin objectOrigin = lineOrigin(); SimpleConfigOrigin objectOrigin = lineOrigin();
boolean lastWasNewline = false; boolean lastWasNewline = false;
ArrayList<AbstractConfigNode> nodes = new ArrayList(n.children()); ArrayList<AbstractConfigNode> nodes = new ArrayList<AbstractConfigNode>(n.children());
List<String> comments = new ArrayList<String>(); List<String> comments = new ArrayList<String>();
for (int i = 0; i < nodes.size(); i++) { for (int i = 0; i < nodes.size(); i++) {
AbstractConfigNode node = nodes.get(i); AbstractConfigNode node = nodes.get(i);
@ -381,7 +381,7 @@ final class ConfigParser {
if (lastWasNewLine && v == null) { if (lastWasNewLine && v == null) {
comments.clear(); comments.clear();
} else if (v != null) { } 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(); comments.clear();
v = null; v = null;
} }
@ -389,7 +389,7 @@ final class ConfigParser {
} else if (node instanceof AbstractConfigNodeValue) { } else if (node instanceof AbstractConfigNodeValue) {
lastWasNewLine = false; lastWasNewLine = false;
if (v != null) { 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(); comments.clear();
} }
v = parseValue((AbstractConfigNodeValue)node, comments); 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 // There shouldn't be any comments at this point, but add them just in case
if (v != null) { 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; arrayCount -= 1;
return new SimpleConfigList(arrayOrigin, values); return new SimpleConfigList(arrayOrigin, values);
@ -418,7 +418,7 @@ final class ConfigParser {
if (lastWasNewLine && result == null) { if (lastWasNewLine && result == null) {
comments.clear(); comments.clear();
} else if (result != null) { } 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(); comments.clear();
break; break;
} }

View File

@ -211,7 +211,9 @@ public abstract class Parseable implements ConfigParseable {
return rawParseDocument(origin, finalOptions); return rawParseDocument(origin, finalOptions);
} catch (IOException e) { } catch (IOException e) {
if (finalOptions.getAllowMissing()) { 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 { } else {
trace("exception loading " + origin.description() + ": " + e.getClass().getName() trace("exception loading " + origin.description() + ": " + e.getClass().getName()
+ ": " + e.getMessage()); + ": " + e.getMessage());