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

Scala 3 lazy val implementation breaks FieldAccess reflection #86

Open
nvollmar opened this issue Feb 4, 2022 · 0 comments
Open

Scala 3 lazy val implementation breaks FieldAccess reflection #86

nvollmar opened this issue Feb 4, 2022 · 0 comments

Comments

@nvollmar
Copy link

nvollmar commented Feb 4, 2022

Scala 3 changed the implementation of lazy vals. Classes containing a lazy val end up with a field called 0bitmap$1:

Compiled from "Test.scala"
public class Test implements scala.Product,java.io.Serializable {
  public static final long OFFSET$0;
  public long 0bitmap$1;
  private final byte a;
  ...

This results in a ClassFormatError:

Cause: java.lang.ClassFormatError: Illegal field name "0bitmap$1" in class io/altoo/akka/serialization/kryo/TestFieldAccess
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012)
	at com.esotericsoftware.reflectasm.AccessClassLoader.defineClass(AccessClassLoader.java:78)
	at com.esotericsoftware.reflectasm.AccessClassLoader.defineAccessClass(AccessClassLoader.java:57)
	at com.esotericsoftware.reflectasm.FieldAccess.get(FieldAccess.java:173)

(Report from EsotericSoftware/kryo#882)

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

No branches or pull requests

1 participant