mirror of
https://github.com/lightbend/config.git
synced 2025-01-15 23:01:05 +08:00
fix various warnings after enabling more warnings
This commit is contained in:
parent
64c6c753e5
commit
84e37b3745
@ -22,6 +22,7 @@ final class ConfigInt extends AbstractConfigValue {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canEqual(Object other) {
|
||||
return other instanceof ConfigInt || other instanceof ConfigLong;
|
||||
}
|
||||
@ -33,7 +34,7 @@ final class ConfigInt extends AbstractConfigValue {
|
||||
return this.value == ((ConfigInt) other).value;
|
||||
} else if (other instanceof ConfigLong) {
|
||||
Long l = ((ConfigLong) other).unwrapped();
|
||||
return ((long) l.intValue()) == l && this.value == l.intValue();
|
||||
return l.intValue() == l && this.value == l.intValue();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -72,6 +72,7 @@ final class ConfigList extends AbstractConfigValue {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canEqual(Object other) {
|
||||
return other instanceof ConfigList;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ final class ConfigLong extends AbstractConfigValue {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canEqual(Object other) {
|
||||
return other instanceof ConfigInt || other instanceof ConfigLong;
|
||||
}
|
||||
@ -33,7 +34,7 @@ final class ConfigLong extends AbstractConfigValue {
|
||||
return this.value == ((ConfigLong) other).value;
|
||||
} else if (other instanceof ConfigInt) {
|
||||
Long l = this.unwrapped();
|
||||
return ((long) l.intValue()) == l
|
||||
return l.intValue() == l
|
||||
&& ((ConfigInt) other).unwrapped() == l.intValue();
|
||||
} else {
|
||||
return false;
|
||||
|
@ -133,6 +133,7 @@ final class ConfigSubstitution extends AbstractConfigValue {
|
||||
return resolved;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canEqual(Object other) {
|
||||
return other instanceof ConfigSubstitution;
|
||||
}
|
||||
|
@ -38,6 +38,15 @@ class DefaultTransformer implements ConfigTransformer {
|
||||
return new ConfigBoolean(value.origin(), false);
|
||||
}
|
||||
break;
|
||||
case LIST:
|
||||
// can't go STRING to LIST automatically
|
||||
break;
|
||||
case OBJECT:
|
||||
// can't go STRING to OBJECT automatically
|
||||
break;
|
||||
case STRING:
|
||||
// no-op STRING to STRING
|
||||
break;
|
||||
}
|
||||
} else if (requested == ConfigValueType.STRING) {
|
||||
// if we converted null to string here, then you wouldn't properly
|
||||
@ -48,6 +57,19 @@ class DefaultTransformer implements ConfigTransformer {
|
||||
case BOOLEAN:
|
||||
return new ConfigString(value.origin(),
|
||||
value.transformToString());
|
||||
case NULL:
|
||||
// want to be sure this throws instead of returning "null" as a
|
||||
// string
|
||||
break;
|
||||
case OBJECT:
|
||||
// no OBJECT to STRING automatically
|
||||
break;
|
||||
case LIST:
|
||||
// no LIST to STRING automatically
|
||||
break;
|
||||
case STRING:
|
||||
// no-op STRING to STRING
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,7 @@ class SimpleConfigObject extends AbstractConfigObject {
|
||||
return 41 * (41 + keys.hashCode()) + valuesHash;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canEqual(Object other) {
|
||||
return other instanceof ConfigObject;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user