valentiay / phobos

Efficient and expressive XML data-binding library for Scala
Apache License 2.0
20 stars 5 forks source link

Add Enumeratum ValueEnum codecs #28

Closed ChrisMcD1 closed 1 month ago

ChrisMcD1 commented 1 month ago

Using the play-json enumeratum integration as inspiration here, this PR adds an implementation for the various *EnumEntry types.

Things of note I had to do:

[error] -- Error: /Users/chrismcdonnell/other/phobos/modules/enumeratum/src/test/scala/phobos/enumeratum/EnumeratumValueTest.scala:16:15
[error] 16 |  val values = findValues
[error]    |               ^^^^^^^^^^
[error]    |Exception occurred while executing macro expansion.
[error]    |java.lang.AssertionError: Received invalid flags. Expected flags Flags.Abstract to only contain a subset of Flags.Case | Flags.CaseAccessor | Flags.Deferred | Flags.Enum | Flags.Final | Flags.Given | Flags.Implicit | Flags.JavaStatic | Flags.Lazy | Flags.Local | Flags.Module | Flags.Mutable | Flags.Override | Flags.Package | Flags.Param | Flags.ParamAccessor | Flags.Private | Flags.PrivateLocal | Flags.Protected.
[error]    |    at enumeratum.ValueEnumMacros$.$anonfun$4(ValueEnumMacros.scala:162)
[error]    |    at scala.Option.getOrElse(Option.scala:201)
[error]    |    at enumeratum.ValueEnumMacros$.findValueEntriesImpl(ValueEnumMacros.scala:163)
[error]    |    at enumeratum.ValueEnumMacros$.findIntValueEntriesImpl(ValueEnumMacros.scala:23)
[error]    |
[error]    |----------------------------------------------------------------------------
[error]    |Inline stack trace
[error]    |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[error]    |This location contains code that was inlined from ValueEnumCompat.scala:23
[error]     ----------------------------------------------------------------------------
[error] one error found