E08230: duplicate registration of the same abstract component type in application
What went wrong
The application block has two or more registrations for the same abstract component type. Each abstract type should have exactly one concrete implementation registered.
Worked examples
Compilable examples demonstrating this error and the correct fix:
- ek9 -q 1334 (Why does EK9 reject two 'register' lines for the same...)
How to fix it
- Remove the duplicate registration
- If both implementations are needed, use different abstract types
See also
Examples
Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.
Fails with E08230: duplicate registration of the same abstract component type in application
#!ek9 defines module error.e08230.bad defines component AbstractService as abstract doWork() as abstract <- rtn as Boolean? default operator ? ServiceImplA is AbstractService override doWork() <- rtn as Boolean: true default operator ? ServiceImplB is AbstractService override doWork() <- rtn as Boolean: false default operator ? defines application dupApp register ServiceImplA() as AbstractService register ServiceImplB() as AbstractService
Fixed: One registration per abstract component
#!ek9 defines module error.e08230.good defines component AbstractService as abstract doWork() as abstract <- rtn as Boolean? default operator ? ServiceImplA is AbstractService override doWork() <- rtn as Boolean: true default operator ? ServiceImplB is AbstractService override doWork() <- rtn as Boolean: false default operator ? defines application appA register ServiceImplA() as AbstractService appB register ServiceImplB() as AbstractService
Questions and answers
These Q&A entries show E08230 and its fix: