Skip to content

Dealing with NoClassTag when converting to arraysΒ #69

@vasigorc

Description

@vasigorc

Hello πŸ‘‹

I have a very simple case and I couldn't find documentation on how to deal with this πŸ€·β€β™‚οΈ

I've declared a new type like this:

@newtype final case class Id(value: String)
@newtype final case class ExternalId(value: String)

Later in the code I finish up with a map mapping: Map[Id, ExternalId]. But when I need to collect it's keys/values to an array I get compilation errors:

val myIds = mapping.keys.toArray
val externalIds = mapping.values.toArray

Error:

No ClassTag available for ...Id
No ClassTag available for ...ExternalId

How is this supposed to be handled. Are newtypes incompatible with arrays because of generics?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions