Type-parameterized annotations are not deserializable
See original GitHub issueType of issue: bug report
What is the use case for changing the behavior? If a user tries to build a type-parameterized annotation, chisel will emit it without complaint, but it will not be deserializable by firrtl.
Impact: API modification
Development Phase: request
Other information
For example:
trait MyCoolTrait {
val foo: Int
}
case class MyConcreteClassA(foo: Int) extends MyCoolTrait
case class MyConcreteClassB(foo: Int, bar: String) extends MyCoolTrait
case class MyAnnotation[T <: MyCoolTrait](target: ModuleTarget, data: T)
extends SingleTargetAnnotation[ModuleTarget] { /* snipped boilerplate */ }
This is serialized by chisel without issue, but cannot be deserialized by firrtl because no type hints for data
are provided. I think there are basically two options:
- Figure out a smart way to enable this
- Explicitly disallow it somehow so that chisel errors out when building such a thing
But… I currently have no suggestions on how to do either of these. 😃
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Deserialization Not Working Right with Generic Types and ...
I use Lombok and the @JsonPOJOBuilder - annotation to trick Jackson into deserializing my immutable object, but once a type parameter enters ...
Read more >Is Jackson really unable to deserialize json into a generic type?
And without the @JsonProperty annotation, Jackson does not know that the first argument of the constructor maps to the result property. Share.
Read more >Serialization Attributes - Json.NET
The JsonExtensionDataAttribute instructs the JsonSerializer to deserialize properties with no matching field or property on the type into the specified ...
Read more >How to serialize and deserialize JSON using C# - .NET
Use the library directly, not through a framework such as ASP.NET Core. Use the JsonSerializer class with custom types to serialize from and ......
Read more >JsonTypeInfo (Jackson-annotations 2.4.0 API) - FasterXML
Annotation used for configuring details of if and how type information is used with JSON serialization and deserialization, to preserve information about ...
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
I modified the JsonProtocol (firrtl) to let annotations supply additional TypeHints to get this working in Golden Gate. The fully qualified classnames for everything you need the extra type hint for is captured in an additional annotation, so that deserialization can proceed. I think it would be trivial to let annotations also supply a custom serdes, though i suspect in your case that extra type hints are all you need.
I was going to open a draft PR later today.
Closed by #1211