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

Dotty backend does not generate serialVersionUID #7319

Closed
ekrich opened this issue Sep 25, 2019 · 0 comments
Closed

Dotty backend does not generate serialVersionUID #7319

ekrich opened this issue Sep 25, 2019 · 0 comments

Comments

@ekrich
Copy link
Contributor

ekrich commented Sep 25, 2019

minimized code

@SerialVersionUID(2L)
final class ConfigBoolean(_origin: ConfigOrigin, val value: jl.Boolean)
    extends AbstractConfigValue(_origin)
    with java.io.Serializable {
...
}

expectation

Generate bytecode similar to Scala 2.

As seen with javap -p -c ConfigBoolean.class

Compiled from "ConfigBoolean.scala"
public final class org.ekrich.config.impl.ConfigBoolean extends org.ekrich.config.impl.AbstractConfigValue implements java.io.Serializable {
  private static final long serialVersionUID;

  private final java.lang.Boolean value;
...
}

As seen with Dotty 0.18.1-RC1

public final class org.ekrich.config.impl.ConfigBoolean extends org.ekrich.config.impl.AbstractConfigValue implements java.io.Serializable {
  private final java.lang.Boolean value;
...
}

code reference

https://github.com/lampepfl/dotty/blob/102eccd3edc42bf145baba4a44d3a69c6babd68b/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala#L794

blocker

Apparently, Config's need to be able to be serialized so the tests involving serialization do not pass.
https://github.com/ekrich/sconfig

smarter added a commit to dotty-staging/dotty that referenced this issue Sep 27, 2019
We need to emit a static `serialVersionUID` field when this annotation
is used, but we were missing the logic in DottyBackendInterface to
actually retrieve the value of the annotation. I also updated
BCodeHelpers to emit the field as private like scalac does since
scala/scala@7f20b1c
bishabosha added a commit that referenced this issue Sep 28, 2019
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