ZupIT/beagle

[Annotation Processor] - Currently is possible to register more than one TypeAdapter for the same type.

Closed this issue · 0 comments

Please provide all the information requested. Issues that do not follow this format are likely to stall.

Description

Currently is possible to register more than one TypeAdapter for the same type. This can lead to unwanted behavior.

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Register two or more TypeAdapter for the same type.
  2. Build project.

Expected Results

Annotation processor should break the build with compilation error. It should show an error message informing what are the TypeAdapters that are registered for the same type.

Code example, screenshot, or link to a repository:

@RegisterBeagleAdapter
class ModuleTypeAdapter : BeagleTypeAdapter {
override fun fromJson(json: String): Int {}
override fun toJson(type: Int): String {}
}

@RegisterBeagleAdapter
class AppTypeAdapter : BeagleTypeAdapter {
override fun fromJson(json: String): Int {}
override fun toJson(type: Int): String {}
}