@Throws(IOException::class, ClassNotFoundException::class) private fun readObject(s: ObjectInputStream) { s.defaultReadObject() if (bayesIm == null) { throw NullPointerException() } if (variables == null) { throw NullPointerException() } }
Adds semantic checks to the default deserialization method . This method must have the standard signature for a readObject method , and the body of the method must begin with `` s.defaultReadObject ( ) ; '' . Other than that , any semantic checks can be specified and do not need to stay the same from version to version . A readObject method of this form may be added to any class , even if Tetrad sessions were previously saved out using a version of the class that did n't include it . ( That 's what the `` s.defaultReadObject ( ) ; '' is for . See J. Bloch , Effective Java , for help .