Fix a bunch of compile-time warnings, minor doc tweaks

This commit is contained in:
Havoc Pennington 2015-04-01 21:43:31 -04:00
parent ea78c17381
commit 8ec5784e32
13 changed files with 17 additions and 28 deletions

View File

@ -12,7 +12,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.time.Duration;
import com.typesafe.config.Config;
@ -79,7 +78,7 @@ public class ConfigBeanImpl {
List<ConfigException.ValidationProblem> problems = new ArrayList<ConfigException.ValidationProblem>();
for (PropertyDescriptor beanProp : beanProps) {
Method setter = beanProp.getWriteMethod();
Class parameterClass = setter.getParameterTypes()[0];
Class<?> parameterClass = setter.getParameterTypes()[0];
ConfigValueType expectedType = getValueTypeOrNull(parameterClass);
if (expectedType != null) {
@ -127,7 +126,8 @@ public class ConfigBeanImpl {
// setting. So, instead, we only support a limited number of
// types plus you can always use Object, ConfigValue, Config,
// ConfigObject, etc. as an escape hatch.
private static Object getValue(Class beanClass, Type parameterType, Class<?> parameterClass, Config config, String configPropName) {
private static Object getValue(Class<?> beanClass, Type parameterType, Class<?> parameterClass, Config config,
String configPropName) {
if (parameterClass == Boolean.class || parameterClass == boolean.class) {
return config.getBoolean(configPropName);
} else if (parameterClass == Integer.class || parameterClass == int.class) {

View File

@ -336,7 +336,6 @@ final class ConfigDocumentParser {
t = nextTokenCollectingWhitespace(children);
// quoted string
String name;
if (!Tokens.isValueWithType(t, ConfigValueType.STRING)) {
throw parseError("expecting a quoted string inside file(), classpath(), or url(), rather than: "
+ t);
@ -399,7 +398,6 @@ final class ConfigDocumentParser {
Token afterKey = nextTokenCollectingWhitespace(keyValueNodes);
boolean insideEquals = false;
Token valueToken;
AbstractConfigNodeValue nextValue;
if (flavor == ConfigSyntax.CONF && afterKey == Tokens.OPEN_CURLY) {
// can omit the ':' or '=' before an object value

View File

@ -9,7 +9,7 @@ abstract class ConfigNodeComplexValue extends AbstractConfigNodeValue {
final protected ArrayList<AbstractConfigNode> children;
ConfigNodeComplexValue(Collection<AbstractConfigNode> children) {
this.children = new ArrayList(children);
this.children = new ArrayList<AbstractConfigNode>(children);
}
final public Collection<AbstractConfigNode> children() {
@ -18,7 +18,7 @@ abstract class ConfigNodeComplexValue extends AbstractConfigNodeValue {
@Override
protected Collection<Token> tokens() {
ArrayList<Token> tokens = new ArrayList();
ArrayList<Token> tokens = new ArrayList<Token>();
for (AbstractConfigNode child : children) {
tokens.addAll(child.tokens());
}

View File

@ -18,7 +18,7 @@ final class ConfigNodeInclude extends AbstractConfigNode {
@Override
protected Collection<Token> tokens() {
ArrayList<Token> tokens = new ArrayList();
ArrayList<Token> tokens = new ArrayList<Token>();
for (AbstractConfigNode child : children) {
tokens.addAll(child.tokens());
}

View File

@ -238,9 +238,7 @@ final class ConfigParser {
} else if (node instanceof ConfigNodeField) {
lastWasNewline = false;
Path path = ((ConfigNodeField) node).path().value();
AbstractConfigNodeValue nodeValue = ((ConfigNodeField) node).value();
comments.addAll(((ConfigNodeField) node).comments());
boolean insideEquals = false;
// path must be on-stack while we parse the value
pathStack.push(path);
@ -263,10 +261,6 @@ final class ConfigParser {
AbstractConfigNodeValue valueNode;
AbstractConfigValue newValue;
if (((ConfigNodeField) node).separator() == Tokens.EQUALS) {
insideEquals = true;
}
valueNode = ((ConfigNodeField) node).value();
// comments from the key token go to the value token

View File

@ -3,8 +3,6 @@
*/
package com.typesafe.config.impl;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Stack;
import com.typesafe.config.ConfigException;

View File

@ -161,11 +161,6 @@ final class SimpleConfig implements Config, MergeableValue, Serializable {
return v;
}
static private AbstractConfigValue find(AbstractConfigObject self, Path path,
ConfigValueType expected, Path originalPath) {
return throwIfNull(findOrNull(self, path, expected, originalPath), expected, originalPath);
}
static private AbstractConfigValue findOrNull(AbstractConfigObject self, Path path,
ConfigValueType expected, Path originalPath) {
try {

View File

@ -1,7 +1,6 @@
package com.typesafe.config.impl;
import com.typesafe.config.parser.ConfigDocument;
import com.typesafe.config.ConfigException;
import com.typesafe.config.ConfigParseOptions;
import com.typesafe.config.ConfigValue;

View File

@ -131,8 +131,6 @@ final class Tokens {
this.value = s;
}
String value() { return value; }
@Override
public String toString() { return "'" + value + "' (WHITESPACE)"; }

View File

@ -1,6 +1,5 @@
package com.typesafe.config.parser;
import com.typesafe.config.ConfigParseOptions;
import com.typesafe.config.ConfigValue;
/**

View File

@ -2,7 +2,6 @@ package com.typesafe.config.parser;
import com.typesafe.config.ConfigParseOptions;
import com.typesafe.config.impl.ConfigImpl;
import com.typesafe.config.impl.Parseable;
import java.io.File;

View File

@ -7,6 +7,13 @@ package com.typesafe.config.parser;
* A node in the syntax tree for a HOCON or JSON document.
*
* <p>
* Note: at present there is no way to obtain an instance of this interface, so
* please ignore it. A future release will make syntax tree nodes available in
* the public API. If you are interested in working on it, please see: <a
* href="https://github.com/typesafehub/config/issues/300"
* >https://github.com/typesafehub/config/issues/300</a>
*
* <p>
* Because this object is immutable, it is safe to use from multiple threads and
* there's no need for "defensive copies."
*
@ -19,7 +26,9 @@ package com.typesafe.config.parser;
*/
public interface ConfigNode {
/**
* The original text of the input which was used to form this particular node.
* The original text of the input which was used to form this particular
* node.
*
* @return the original text used to form this node as a String
*/
public String render();

View File

@ -248,7 +248,7 @@ abstract trait TestUtils {
"possibly caused by http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6446627",
nf)
case e: Exception =>
System.err.println(e.getStackTraceString);
System.err.println(e.getStackTrace.toString);
throw new AssertionError("failed to make a copy via serialization", e)
}