Open
Description
Environment Details
- EclipseStore Version: 2.1.1
- JDK version: 21
- OS: Windows 11
Describe the bug
Enums seem to be persisted the first time they are encountered, not reflecting any changes on the enum fields.
I have an enum in which I have a collection. I added an item to the collection, but at runtime, its the old collection, without the added item.
If I print it first thing in main
, it shows the new value. Once EclipseStore started up, the enum values were replaced with the persisted ones it seemed.
To Reproduce
import org.eclipse.store.storage.embedded.types.EmbeddedStorage;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
public class BugMain {
enum EnumA {
A1(List.of(EnumB.B1, EnumB.B2)),
A2(List.of(EnumB.B1 /*, EnumB.B2 UNCOMMENT AFTER FIRST STARTT */)),
;
final List<EnumB> enumBs;
EnumA(List<EnumB> enumBs) {
this.enumBs = new ArrayList<>(enumBs);
}
}
enum EnumB {
B1,
B2,
;
}
static class Root {
EnumA a = null;
}
public static void main(String[] args) {
System.out.println("Before: " + EnumA.A2.enumBs);
final var manager = EmbeddedStorage.start(Paths.get("./temp_db"));
if (manager.root() == null) {
Root newRoot = new Root();
newRoot.a = EnumA.A2;
manager.setRoot(newRoot);
manager.storeRoot();
}
System.out.println("After: "+ EnumA.A2.enumBs);
}
}
- Start once
- Uncomment
EnumA.A2.B2
- Start again
- Enum is incorrect
Expected behavior
Enum values should always represent the same state as they did before restoring eclipse store data.
Metadata
Metadata
Assignees
Labels
No labels