Skip to content
New issue

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

Compiler generated anonymous classes with $$outer should not be serializable $$outer class is #569

Closed
scabug opened this issue Feb 26, 2008 · 3 comments

Comments

@scabug
Copy link

scabug commented Feb 26, 2008

This code

trait Test
{
  def foo(a : Array[Int]) = {
    a.foreach { i => println(i) }
  }
}

generates the following warning from findbugs 1.3.2:

class Test$$$$anonfun$$foo$$1 defines non-transient non-serializable instance

with this explanation:

Non-transient non-serializable instance field in serializable class

This Serializable class defines a non-primitive instance field which is
neither transient, Serializable, or java.lang.Object, and does not appear
to implement the Externalizable interface or the readObject() and
writeObject() methods.  Objects of this class will not be deserialized
correctly if a non-Serializable object is stored in this field.

Should this anonymous class only be serializable if the $$outer class
is serializable?

@scabug
Copy link
Author

scabug commented Feb 26, 2008

Imported From: https://issues.scala-lang.org/browse/SI-569?orig=1
Reporter: @blair

@scabug
Copy link
Author

scabug commented Feb 26, 2008

Geoffrey Alan Washburn (washburn) said:
Duplicate of #552.

@scabug
Copy link
Author

scabug commented Jan 14, 2009

@odersky said:
Milestone 2.7.1 deleted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant