We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"@transient object" does not work and does not generate an error. Instead the compiler silently accepts the annotation and then simply ignores it.
object ExpMain { def main(args: Array[String]) { import java.io._ val test = new TransientTest test.nested.value = 1 test.transientNested.value = 1 val bytes = new ByteArrayOutputStream val out = new ObjectOutputStream(bytes) out.writeObject(test) out.close() val in = new ObjectInputStream(new ByteArrayInputStream(bytes.toByteArray)) val restored = in.readObject.asInstanceOf[TransientTest] println("nested.value equal: " + (test.nested.value == restored.nested.value)) println("transientNested.value equal: " + (test.transientNested.value == restored.transientNested.value)) } } class TransientTest extends Serializable { object nested extends Serializable { var value = 0 } @transient object transientNested extends Serializable { var value = 0 } }
The text was updated successfully, but these errors were encountered:
Imported From: https://issues.scala-lang.org/browse/SI-5773?orig=1 Reporter: @lexn82 Affected Versions: 2.9.2
Sorry, something went wrong.
@adriaanm said: Un-assigning to foster work stealing, as announced in https://groups.google.com/forum/?fromgroups=#!topic/scala-internals/o8WG4plpNkw
@adriaanm said: Unassigning and rescheduling to M6 as previous deadline was missed.
Sonnenschein (sonnenschein) said: I also spent some time to test with the following result:
@transient for a nested object works only in an enclosing object. Unfortunately it does not work in any enclosing trait or class.
See also object ScalaObjectSerialization in TSerializable.scala.
No branches or pull requests
"@transient object" does not work and does not generate an error. Instead the compiler silently accepts the annotation and then simply ignores it.
The text was updated successfully, but these errors were encountered: