Skip to content

Does not store enum #140

@LiveNathan

Description

@LiveNathan

Checklist

  • I am able to reproduce the bug with the latest version
  • I made sure that there are no existing issues - open or closed - which I could contribute my information to.
  • I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
  • This issue contains only one bug.

Affected version

2.1.0

Steps to reproduce the bug

Try to store a record with an enum.

Expected behavior

No exception

Actual behavior

java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.lang.String java.lang.Enum.name accessible: module java.base does not "opens java.lang" to unnamed module @411f53a0

Additional information

@Component
public class ClockEclipseAdapter implements ClockRepository {
    private final EclipseClockRepository repository;
    private static final Logger log = LoggerFactory.getLogger(ClockEclipseAdapter.class);

    public ClockEclipseAdapter(EclipseClockRepository repository) {
        this.repository = repository;
    }

    @Override
    public void save(ClockEvent clockEvent) {
        repository.save(clockEvent);
    }

    @Override
    public List<ClockEvent> findAll() {
        return repository.findAll();
    }
}
public interface EclipseClockRepository extends ListCrudRepository<ClockEvent, Long> {
}
public record ClockEvent(LocalDateTime time, ClockEventType type) {
    public ClockEvent {
        if (time == null) {
            throw new IllegalArgumentException("Event time is empty");
        }
        if (type == null) {
            throw new IllegalArgumentException("Event type is empty");
        }
    }

}
public enum ClockEventType {
    IN,
    OUT
}

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