Skip to content

Android: NoSuchFieldException for sizeIsSticky on BitSet.class #461

@niilz

Description

@niilz

Environment Details

  • EclipseStore Version: 3.0.0
  • JDK version: 17
  • OS: Android 15 / SDK 36

The bug

Since 3.0.0 eclipse store breaks on Android during the initialization phase with the error:
java.lang.NoSuchFieldException: No field with name sizeIsSticky found in type class java.util.BitSet

The problem most likely was introduced with the upgrade of eclipse-serializer to 3.0.0. Which added the BinaryHandlerBitSet in eclipse-serializer/serializer#194. It's implementation uses org.eclipse.serializer.reflect.XReflect to read the value of the private field sizeIsSticky on java.util.BitSet.class.

But it seems that this private field can only be accessed via reflection, if the JVM arg --add-opens java.base/java.util=ALL-UNNAMED is set. My understanding though is that these JVM args can not be set in an Android environment.

So the attempt to reach into the private fields fails.

To Reproduce

Use eclipse-store 3.0.0 and initialize a store on Android.

Expected behavior

The store gets initialized and the app does not crash

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions