mirror of
https://github.com/lightbend/config.git
synced 2025-02-23 17:50:30 +08:00
add some missing serialVersionUID
All the most-derived classes need to have it, not just base classes. Update expected serializations in the tests to reflect new serialVersionUID.
This commit is contained in:
parent
dc2f52aa24
commit
71d209070a
@ -25,6 +25,8 @@ import com.typesafe.config.ConfigValueType;
|
|||||||
final class ConfigDelayedMerge extends AbstractConfigValue implements
|
final class ConfigDelayedMerge extends AbstractConfigValue implements
|
||||||
Unmergeable {
|
Unmergeable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
// earlier items in the stack win
|
// earlier items in the stack win
|
||||||
final private List<AbstractConfigValue> stack;
|
final private List<AbstractConfigValue> stack;
|
||||||
final private boolean ignoresFallbacks;
|
final private boolean ignoresFallbacks;
|
||||||
|
@ -18,9 +18,11 @@ import com.typesafe.config.ConfigValue;
|
|||||||
|
|
||||||
// This is just like ConfigDelayedMerge except we know statically
|
// This is just like ConfigDelayedMerge except we know statically
|
||||||
// that it will turn out to be an object.
|
// that it will turn out to be an object.
|
||||||
class ConfigDelayedMergeObject extends AbstractConfigObject implements
|
final class ConfigDelayedMergeObject extends AbstractConfigObject implements
|
||||||
Unmergeable {
|
Unmergeable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
final private List<AbstractConfigValue> stack;
|
final private List<AbstractConfigValue> stack;
|
||||||
final private boolean ignoresFallbacks;
|
final private boolean ignoresFallbacks;
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@ import com.typesafe.config.ConfigValueType;
|
|||||||
|
|
||||||
final class SimpleConfigList extends AbstractConfigValue implements ConfigList {
|
final class SimpleConfigList extends AbstractConfigValue implements ConfigList {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
final private List<AbstractConfigValue> value;
|
final private List<AbstractConfigValue> value;
|
||||||
final private boolean resolved;
|
final private boolean resolved;
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ class ConfigSubstitutionTest extends TestUtils {
|
|||||||
"257400046f626a427371007e00177371007e000700000007000000077071007e000c71007e000f70" +
|
"257400046f626a427371007e00177371007e000700000007000000077071007e000c71007e000f70" +
|
||||||
"00000000007371007e001a7704000000017371007e001c007371007e001f740001617371007e001f" +
|
"00000000007371007e001a7704000000017371007e001c007371007e001f740001617371007e001f" +
|
||||||
"74000162707874000361727273720029636f6d2e74797065736166652e636f6e6669672e696d706c" +
|
"74000162707874000361727273720029636f6d2e74797065736166652e636f6e6669672e696d706c" +
|
||||||
"2e53696d706c65436f6e6669674c697374ef9443c7c6af330d0200025a00087265736f6c7665644c" +
|
"2e53696d706c65436f6e6669674c69737400000000000000010200025a00087265736f6c7665644c" +
|
||||||
"000576616c756571007e00087871007e00047371007e00070000000a0000000a7071007e000c7100" +
|
"000576616c756571007e00087871007e00047371007e00070000000a0000000a7071007e000c7100" +
|
||||||
"7e000f70007371007e001a7704000000067371007e00177371007e00070000000a0000000a707100" +
|
"7e000f70007371007e001a7704000000067371007e00177371007e00070000000a0000000a707100" +
|
||||||
"7e000c71007e000f7000000000007371007e001a7704000000017371007e001c007371007e001f74" +
|
"7e000c71007e000f7000000000007371007e001a7704000000017371007e001c007371007e001f74" +
|
||||||
|
@ -204,7 +204,7 @@ class ConfigValueTest extends TestUtils {
|
|||||||
def configListSerializable() {
|
def configListSerializable() {
|
||||||
val expectedSerialization = "" +
|
val expectedSerialization = "" +
|
||||||
"aced000573720029636f6d2e74797065736166652e636f6e6669672e696d706c2e53696d706c6543" +
|
"aced000573720029636f6d2e74797065736166652e636f6e6669672e696d706c2e53696d706c6543" +
|
||||||
"6f6e6669674c697374ef9443c7c6af330d0200025a00087265736f6c7665644c000576616c756574" +
|
"6f6e6669674c69737400000000000000010200025a00087265736f6c7665644c000576616c756574" +
|
||||||
"00104c6a6176612f7574696c2f4c6973743b7872002c636f6d2e74797065736166652e636f6e6669" +
|
"00104c6a6176612f7574696c2f4c6973743b7872002c636f6d2e74797065736166652e636f6e6669" +
|
||||||
"672e696d706c2e4162737472616374436f6e66696756616c756500000000000000010200014c0006" +
|
"672e696d706c2e4162737472616374436f6e66696756616c756500000000000000010200014c0006" +
|
||||||
"6f726967696e74002d4c636f6d2f74797065736166652f636f6e6669672f696d706c2f53696d706c" +
|
"6f726967696e74002d4c636f6d2f74797065736166652f636f6e6669672f696d706c2f53696d706c" +
|
||||||
@ -288,7 +288,7 @@ class ConfigValueTest extends TestUtils {
|
|||||||
def configDelayedMergeSerializable() {
|
def configDelayedMergeSerializable() {
|
||||||
val expectedSerialization = "" +
|
val expectedSerialization = "" +
|
||||||
"aced00057372002b636f6d2e74797065736166652e636f6e6669672e696d706c2e436f6e66696744" +
|
"aced00057372002b636f6d2e74797065736166652e636f6e6669672e696d706c2e436f6e66696744" +
|
||||||
"656c617965644d657267656d8c8e0e0c0145760200025a001069676e6f72657346616c6c6261636b" +
|
"656c617965644d6572676500000000000000010200025a001069676e6f72657346616c6c6261636b" +
|
||||||
"734c0005737461636b7400104c6a6176612f7574696c2f4c6973743b7872002c636f6d2e74797065" +
|
"734c0005737461636b7400104c6a6176612f7574696c2f4c6973743b7872002c636f6d2e74797065" +
|
||||||
"736166652e636f6e6669672e696d706c2e4162737472616374436f6e66696756616c756500000000" +
|
"736166652e636f6e6669672e696d706c2e4162737472616374436f6e66696756616c756500000000" +
|
||||||
"000000010200014c00066f726967696e74002d4c636f6d2f74797065736166652f636f6e6669672f" +
|
"000000010200014c00066f726967696e74002d4c636f6d2f74797065736166652f636f6e6669672f" +
|
||||||
@ -338,7 +338,7 @@ class ConfigValueTest extends TestUtils {
|
|||||||
def configDelayedMergeObjectSerializable() {
|
def configDelayedMergeObjectSerializable() {
|
||||||
val expectedSerialization = "" +
|
val expectedSerialization = "" +
|
||||||
"aced000573720031636f6d2e74797065736166652e636f6e6669672e696d706c2e436f6e66696744" +
|
"aced000573720031636f6d2e74797065736166652e636f6e6669672e696d706c2e436f6e66696744" +
|
||||||
"656c617965644d657267654f626a65637401fa1552304cae900200025a001069676e6f7265734661" +
|
"656c617965644d657267654f626a65637400000000000000010200025a001069676e6f7265734661" +
|
||||||
"6c6c6261636b734c0005737461636b7400104c6a6176612f7574696c2f4c6973743b7872002d636f" +
|
"6c6c6261636b734c0005737461636b7400104c6a6176612f7574696c2f4c6973743b7872002d636f" +
|
||||||
"6d2e74797065736166652e636f6e6669672e696d706c2e4162737472616374436f6e6669674f626a" +
|
"6d2e74797065736166652e636f6e6669672e696d706c2e4162737472616374436f6e6669674f626a" +
|
||||||
"65637400000000000000010200014c0006636f6e6669677400274c636f6d2f74797065736166652f" +
|
"65637400000000000000010200014c0006636f6e6669677400274c636f6d2f74797065736166652f" +
|
||||||
|
@ -116,30 +116,40 @@ abstract trait TestUtils {
|
|||||||
|
|
||||||
val why = failure.map({ e => ": " + e.getClass.getSimpleName + ": " + e.getMessage }).getOrElse("")
|
val why = failure.map({ e => ": " + e.getClass.getSimpleName + ": " + e.getMessage }).getOrElse("")
|
||||||
|
|
||||||
assertEquals("Can no longer deserialize the old format of " + o.getClass.getSimpleName + why,
|
|
||||||
o, deserialized)
|
|
||||||
assertFalse(failure.isDefined) // should have thrown if we had a failure
|
|
||||||
|
|
||||||
val byteStream = new ByteArrayOutputStream()
|
val byteStream = new ByteArrayOutputStream()
|
||||||
val objectStream = new ObjectOutputStream(byteStream)
|
val objectStream = new ObjectOutputStream(byteStream)
|
||||||
objectStream.writeObject(o)
|
objectStream.writeObject(o)
|
||||||
objectStream.close()
|
objectStream.close()
|
||||||
val hex = Hex.encodeHexString(byteStream.toByteArray())
|
val hex = Hex.encodeHexString(byteStream.toByteArray())
|
||||||
if (expectedHex != hex) {
|
def showCorrectResult(): Unit = {
|
||||||
@tailrec
|
if (expectedHex != hex) {
|
||||||
def outputStringLiteral(s: String): Unit = {
|
@tailrec
|
||||||
if (s.nonEmpty) {
|
def outputStringLiteral(s: String): Unit = {
|
||||||
val (head, tail) = s.splitAt(80)
|
if (s.nonEmpty) {
|
||||||
val plus = if (tail.isEmpty) "" else " +"
|
val (head, tail) = s.splitAt(80)
|
||||||
System.err.println("\"" + head + "\"" + plus)
|
val plus = if (tail.isEmpty) "" else " +"
|
||||||
outputStringLiteral(tail)
|
System.err.println("\"" + head + "\"" + plus)
|
||||||
|
outputStringLiteral(tail)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
System.err.println("Correct result literal for " + o.getClass.getSimpleName + " serialization:")
|
||||||
|
System.err.println("\"\" + ") // line up all the lines by using empty string on first line
|
||||||
|
outputStringLiteral(hex)
|
||||||
}
|
}
|
||||||
System.err.println("Correct result literal for " + o.getClass.getSimpleName + " serialization:")
|
|
||||||
System.err.println("\"\" + ") // line up all the lines by using empty string on first line
|
|
||||||
outputStringLiteral(hex)
|
|
||||||
}
|
}
|
||||||
assertEquals(o.getClass.getSimpleName + " serialization has changed (though we still deserialized the old serialization)", expectedHex, hex)
|
|
||||||
|
try {
|
||||||
|
assertEquals("Can no longer deserialize the old format of " + o.getClass.getSimpleName + why,
|
||||||
|
o, deserialized)
|
||||||
|
assertFalse(failure.isDefined) // should have thrown if we had a failure
|
||||||
|
|
||||||
|
assertEquals(o.getClass.getSimpleName + " serialization has changed (though we still deserialized the old serialization)",
|
||||||
|
expectedHex, hex)
|
||||||
|
} catch {
|
||||||
|
case e: Throwable =>
|
||||||
|
showCorrectResult()
|
||||||
|
throw e
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected def checkSerializable[T: Manifest](expectedHex: String, o: T): T = {
|
protected def checkSerializable[T: Manifest](expectedHex: String, o: T): T = {
|
||||||
|
Loading…
Reference in New Issue
Block a user