fix various warnings after enabling more warnings

This commit is contained in:
Havoc Pennington 2011-11-08 22:08:28 -05:00
parent 64c6c753e5
commit 84e37b3745
6 changed files with 29 additions and 2 deletions

View File

@ -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;
}

View File

@ -72,6 +72,7 @@ final class ConfigList extends AbstractConfigValue {
}
}
@Override
protected boolean canEqual(Object other) {
return other instanceof ConfigList;
}

View File

@ -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;

View File

@ -133,6 +133,7 @@ final class ConfigSubstitution extends AbstractConfigValue {
return resolved;
}
@Override
protected boolean canEqual(Object other) {
return other instanceof ConfigSubstitution;
}

View File

@ -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;
}
}

View File

@ -70,6 +70,7 @@ class SimpleConfigObject extends AbstractConfigObject {
return 41 * (41 + keys.hashCode()) + valuesHash;
}
@Override
protected boolean canEqual(Object other) {
return other instanceof ConfigObject;
}