I am introducing a small fix (use single() instead of first(), catch IllegalArgumentException and rethrow a AmbiguousTypeException), and the output is
org.qi4j.api.composite.AmbiguousTypeException: More than one model matches the classname org.qi4j.api.value.ValueSerialization:[OrgJsonValueSerializationService(active=false,module='Module 1'), JacksonValueSerializationService(active=false,module='Module 1')] for the case that I just detected. I am starting a local build to see what else fails and whether there is concern for this change. Perhaps some way it is needed to ignore ambiguous types in some usecase. I'll report back later. Niclas On Fri, Jul 10, 2015 at 4:56 PM, Niclas Hedhman <[email protected]> wrote: > So, the question is; SHOULD a AmbiguousTypeException be thrown when one is > asking for a @Service injection of a composite type or ServiceReference<T>? > > And I am pretty sure the exact same code is called if one calls > ServiceFinder.findService(), and that would also throw the > AmbiguousTypeException. > > > Cheers > Niclas > > On Fri, Jul 10, 2015 at 4:53 PM, Niclas Hedhman <[email protected]> > wrote: > >> And it is not done there... It takes, and instantiates, the first one. >> Line 378 in TypeLookup >> >> On Fri, Jul 10, 2015 at 4:50 PM, Niclas Hedhman <[email protected]> >> wrote: >> >>> The findService() (single instance) should be checking ambiguity, where >>> as findServices() shouldn't. I am looking into that at the moment. >>> >>> On Fri, Jul 10, 2015 at 4:45 PM, Paul Merlin <[email protected]> wrote: >>> >>>> Good catch Niclas. >>>> >>>> No AmbiguousTypeException should be expected though. >>>> >>>> There is two services registered for the ValueSerialization type with != >>>> identities, possibly different qualifiers etc... there's no type >>>> ambiguity with multiple services of the same type. >>>> >>>> Think @Service Iterable<ValueSerialization> inject; >>>> >>>> /Paul >>>> >>>> Niclas Hedhman a écrit : >>>> > EntityTestAssembler is the answer... which is invoked in the >>>> > AbstractValueCompositeSerializationTest. >>>> > >>>> > I'll resolve that. Sorry for the noise. >>>> > >>>> > On Fri, Jul 10, 2015 at 4:31 PM, Niclas Hedhman <[email protected]> >>>> wrote: >>>> > >>>> >> So, the Module contains TWO ValueSerialization systems, both the >>>> OrgJson >>>> >> and the Jackson ones. >>>> >> >>>> >> That should then raise the question, Why don't we get >>>> >> AmbigiousTypeException?? >>>> >> >>>> >> There are also a MemoryEntityStore and a UuidIdentityGenerator in the >>>> >> Module.... Where are those coming from? >>>> >> >>>> >> >>>> >> Cheers >>>> >> >>>> >> On Fri, Jul 10, 2015 at 4:25 PM, Niclas Hedhman <[email protected]> >>>> >> wrote: >>>> >> >>>> >>> I think I have found a Testcase problem, while trying to improve the >>>> >>> ValueSerialization subsystem. >>>> >>> >>>> >>> To show what I mean; >>>> >>> >>>> >>> a. Put a breakpoint on the first line in the only(!) test in >>>> >>> AbstractValueCompositeSerializationTest >>>> >>> >>>> >>> b. Run the JacksonValueCompositeSerializationTest. >>>> >>> >>>> >>> c. At breakpoint, look at the this.valueSerialization member. It >>>> has >>>> >>> a ServiceComposite reference to the >>>> OrgJsonValueSerializationService, >>>> >>> not the Jackson one. >>>> >>> >>>> >>> >>>> >>> I am trying to figure out how this is at all possible. >>>> >>> >>>> >>> >>>> >>> Cheers >>>> >>> -- >>>> >>> Niclas Hedhman, Software Developer >>>> >>> http://zest.apache.org - New Energy for Java >>>> >>> >>>> >> -- >>>> >> Niclas Hedhman, Software Developer >>>> >> http://zest.apache.org - New Energy for Java >>>> >> >>>> > >>>> > >>>> > >>>> >>> >>> >>> >>> -- >>> Niclas Hedhman, Software Developer >>> http://zest.apache.org - New Energy for Java >>> >> >> >> >> -- >> Niclas Hedhman, Software Developer >> http://zest.apache.org - New Energy for Java >> > > > > -- > Niclas Hedhman, Software Developer > http://zest.apache.org - New Energy for Java > -- Niclas Hedhman, Software Developer http://zest.apache.org - New Energy for Java
