Skip to content

Commit 8ec5784

Browse files
committed
Fix a bunch of compile-time warnings, minor doc tweaks
1 parent ea78c17 commit 8ec5784

File tree

13 files changed

+17
-28
lines changed

13 files changed

+17
-28
lines changed

config/src/main/java/com/typesafe/config/impl/ConfigBeanImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import java.util.HashMap;
1313
import java.util.List;
1414
import java.util.Map;
15-
import java.util.concurrent.TimeUnit;
1615
import java.time.Duration;
1716

1817
import com.typesafe.config.Config;
@@ -79,7 +78,7 @@ public static <T> T createInternal(Config config, Class<T> clazz) {
7978
List<ConfigException.ValidationProblem> problems = new ArrayList<ConfigException.ValidationProblem>();
8079
for (PropertyDescriptor beanProp : beanProps) {
8180
Method setter = beanProp.getWriteMethod();
82-
Class parameterClass = setter.getParameterTypes()[0];
81+
Class<?> parameterClass = setter.getParameterTypes()[0];
8382

8483
ConfigValueType expectedType = getValueTypeOrNull(parameterClass);
8584
if (expectedType != null) {
@@ -127,7 +126,8 @@ public static <T> T createInternal(Config config, Class<T> clazz) {
127126
// setting. So, instead, we only support a limited number of
128127
// types plus you can always use Object, ConfigValue, Config,
129128
// ConfigObject, etc. as an escape hatch.
130-
private static Object getValue(Class beanClass, Type parameterType, Class<?> parameterClass, Config config, String configPropName) {
129+
private static Object getValue(Class<?> beanClass, Type parameterType, Class<?> parameterClass, Config config,
130+
String configPropName) {
131131
if (parameterClass == Boolean.class || parameterClass == boolean.class) {
132132
return config.getBoolean(configPropName);
133133
} else if (parameterClass == Integer.class || parameterClass == int.class) {

config/src/main/java/com/typesafe/config/impl/ConfigDocumentParser.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,6 @@ private ConfigNodeInclude parseInclude(ArrayList<AbstractConfigNode> children) {
336336
t = nextTokenCollectingWhitespace(children);
337337

338338
// quoted string
339-
String name;
340339
if (!Tokens.isValueWithType(t, ConfigValueType.STRING)) {
341340
throw parseError("expecting a quoted string inside file(), classpath(), or url(), rather than: "
342341
+ t);
@@ -399,7 +398,6 @@ private ConfigNodeComplexValue parseObject(boolean hadOpenCurly) {
399398
Token afterKey = nextTokenCollectingWhitespace(keyValueNodes);
400399
boolean insideEquals = false;
401400

402-
Token valueToken;
403401
AbstractConfigNodeValue nextValue;
404402
if (flavor == ConfigSyntax.CONF && afterKey == Tokens.OPEN_CURLY) {
405403
// can omit the ':' or '=' before an object value

config/src/main/java/com/typesafe/config/impl/ConfigNodeComplexValue.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ abstract class ConfigNodeComplexValue extends AbstractConfigNodeValue {
99
final protected ArrayList<AbstractConfigNode> children;
1010

1111
ConfigNodeComplexValue(Collection<AbstractConfigNode> children) {
12-
this.children = new ArrayList(children);
12+
this.children = new ArrayList<AbstractConfigNode>(children);
1313
}
1414

1515
final public Collection<AbstractConfigNode> children() {
@@ -18,7 +18,7 @@ final public Collection<AbstractConfigNode> children() {
1818

1919
@Override
2020
protected Collection<Token> tokens() {
21-
ArrayList<Token> tokens = new ArrayList();
21+
ArrayList<Token> tokens = new ArrayList<Token>();
2222
for (AbstractConfigNode child : children) {
2323
tokens.addAll(child.tokens());
2424
}

config/src/main/java/com/typesafe/config/impl/ConfigNodeInclude.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ final public Collection<AbstractConfigNode> children() {
1818

1919
@Override
2020
protected Collection<Token> tokens() {
21-
ArrayList<Token> tokens = new ArrayList();
21+
ArrayList<Token> tokens = new ArrayList<Token>();
2222
for (AbstractConfigNode child : children) {
2323
tokens.addAll(child.tokens());
2424
}

config/src/main/java/com/typesafe/config/impl/ConfigParser.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,7 @@ private AbstractConfigObject parseObject(ConfigNodeObject n) {
238238
} else if (node instanceof ConfigNodeField) {
239239
lastWasNewline = false;
240240
Path path = ((ConfigNodeField) node).path().value();
241-
AbstractConfigNodeValue nodeValue = ((ConfigNodeField) node).value();
242241
comments.addAll(((ConfigNodeField) node).comments());
243-
boolean insideEquals = false;
244242

245243
// path must be on-stack while we parse the value
246244
pathStack.push(path);
@@ -263,10 +261,6 @@ private AbstractConfigObject parseObject(ConfigNodeObject n) {
263261
AbstractConfigNodeValue valueNode;
264262
AbstractConfigValue newValue;
265263

266-
if (((ConfigNodeField) node).separator() == Tokens.EQUALS) {
267-
insideEquals = true;
268-
}
269-
270264
valueNode = ((ConfigNodeField) node).value();
271265

272266
// comments from the key token go to the value token

config/src/main/java/com/typesafe/config/impl/PathBuilder.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*/
44
package com.typesafe.config.impl;
55

6-
import java.util.ArrayList;
7-
import java.util.Collection;
86
import java.util.Stack;
97

108
import com.typesafe.config.ConfigException;

config/src/main/java/com/typesafe/config/impl/SimpleConfig.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,6 @@ static private AbstractConfigValue findKeyOrNull(AbstractConfigObject self, Stri
161161
return v;
162162
}
163163

164-
static private AbstractConfigValue find(AbstractConfigObject self, Path path,
165-
ConfigValueType expected, Path originalPath) {
166-
return throwIfNull(findOrNull(self, path, expected, originalPath), expected, originalPath);
167-
}
168-
169164
static private AbstractConfigValue findOrNull(AbstractConfigObject self, Path path,
170165
ConfigValueType expected, Path originalPath) {
171166
try {

config/src/main/java/com/typesafe/config/impl/SimpleConfigDocument.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.typesafe.config.impl;
22

33
import com.typesafe.config.parser.ConfigDocument;
4-
import com.typesafe.config.ConfigException;
54
import com.typesafe.config.ConfigParseOptions;
65
import com.typesafe.config.ConfigValue;
76

config/src/main/java/com/typesafe/config/impl/Tokens.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,6 @@ static private class IgnoredWhitespace extends Token {
131131
this.value = s;
132132
}
133133

134-
String value() { return value; }
135-
136134
@Override
137135
public String toString() { return "'" + value + "' (WHITESPACE)"; }
138136

config/src/main/java/com/typesafe/config/parser/ConfigDocument.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.typesafe.config.parser;
22

3-
import com.typesafe.config.ConfigParseOptions;
43
import com.typesafe.config.ConfigValue;
54

65
/**

0 commit comments

Comments
 (0)