Circe Enumeratum knownDirectSubclasses compile time error
See original GitHub issueError during compilation of a CirceEnum: knownDirectSubclasses observed before subclass registered
Using:
- Scala - 2.12.1
- enumeratum - 1.5.3
- enumeratum-circe - 1.5.3
Enumeratum ADT looks like:
import enumeratum._
sealed trait Role extends EnumEntry
case object Role extends CirceEnum[Role] with Enum[Role] {
case object Service extends Role
case object User extends Role
val values = findValues
}
For this case, two errors are produced:
[error] knownDirectSubclasses of Role observed before subclass Service registered
[error] knownDirectSubclasses of Role observed before subclass User registered
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
lloydmeta/enumeratum - Gitter
hi enumeratum, I'm struggling with issue#90 - I can't seem to get it to stable state. while I can get it to compile...
Read more >Unable to resolve compile time error in circe custom decoder
I am trying to write a custom encoder and decoder in Circe for an Object like case class User(id: Long, name: String). So...
Read more >Adding Enumeratum to the Scala Platform
ValueEnum was written to solve the problem of not having compile-time uniqueness checks on Enum values and to be able to deserialise ...
Read more >Troubleshooting - sbt - Triplequote Hydra
Using Enumeratum: knownDirectSubclasses of ... observed before subclass .. registered¶. Enumeratum, especially when combined with Circe may exhibit a known bug ...
Read more >Fix the top 10 most common compile time errors in Java
Compile time errors in Java can be confusing and frustrating. Be prepared with this list of the 10 most common Java compile errors...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Rename your Enum trait to
AWhatwver
. It just needs to start with a letter high enough in the alphabetical order. What a joke.Using 2.12.2 See: https://github.com/circe/circe/issues/639
For other poor souls trying to get it to work. For me the fix was to force imports order:
where
TextType extends EnumEntry
. It does not matter weather enumerated types are used or not in the class (for me they’re not). The only thing that triggered working code path was to have all enumerated types imported beforeio.circe.generic.auto._
.This seems to work for both generic akka-http application and unit tests with isolated Circe encoding/decoding.