Hi, The issue KARAF-4829 was closed. I thought I could now use the config tag as long with a location attribute, but I’m wrong!
How to configure a feature in order configuration files to be installed prior to bundle startup? Thanks! Regards, JP De : Guillaume Nodet [mailto:[email protected]] Envoyé : lundi 3 avril 2017 18:18 À : user Objet : Re: Blueprint fails instantiating bean with generic constructor 2017-04-03 17:03 GMT+02:00 CLEMENT Jean-Philippe <[email protected]<mailto:[email protected]>>: I understand your point and you’re right, it’s better to test things early than let the system crash later on. To go further I guess the Blueprint spec would have to be enhanced to fully support generics, for instance to be able to instantiate an ArrayList<String> bean, to expose and retrieve services with generics signature etc. That's what I did to some degree with my ARIES-960 branch: https://github.com/gnodet/aries/tree/ARIES-960/blueprint/blueprint-core That's why I'd like some people to look at it and see if their actual use case works. From that point: * they work, and that's great * they don't work and they should, and I'll work on fixing those * they don't work because they require ARIES-1633 which I don't have the time to implement in the short term In the third case, I could look at adding a flag... That said, a fallback strategy could also be welcome in the meantime. And it would be more efficient than letting the system try to convert, fail, then finally use the custom “erasure converter” defined in the Blueprint. Would it be possible to get a nice generics defeat flag? Please provide a test case for my ARIES-960 branch which falls into the third category above. Regards, JP De : Guillaume Nodet [mailto:[email protected]<mailto:[email protected]>] Envoyé : lundi 3 avril 2017 16:30 À : user Objet : Re: Blueprint fails instantiating bean with generic constructor I still am not comfortable allowing casting List<String> to List<Integer> as we perfectly know what will happen. Blueprint is not a compiler, but if you look at CDI, those kind of problems have been handled correctly for example, and CDI is not a compiler either, but both blueprint and CDI are dependency injection framework, so there's no technical reason to not be able to support the use cases correctly, instead of allowing ClassCastException at a later time. 2017-04-03 15:46 GMT+02:00 CLEMENT Jean-Philippe <[email protected]<mailto:[email protected]>>: Hi Guillaume, As already discussed, Blueprint is not a compiler but a runtime library. Once compiled there is no more generics as Java is a type erasure language. Moreover, I’m not too sure how Blueprint may handle injection with things like <S> S getSomething() where in java you can write myinstance.<Boolean> getSomething(). I still do have issues with injection and generics, so a global flag to defeat Blueprint checking would be greatly appreciated :) JP De : Guillaume Nodet [mailto:[email protected]<mailto:[email protected]>] Envoyé : lundi 3 avril 2017 14:31 À : user Objet : Re: Blueprint fails instantiating bean with generic constructor There are 2 different issues. One is type erasure, i.e. allow the invocation of a method taking a List<String> with a List<Integer> for example. That's ARIES-1607, and I really think that's a bad idea, unless someone show me a good example where it makes sense. At least by default (well, it's against the blueprint spec anyway). A flag to turn on such a behavior (on a bean or globally) could be an acceptable way, though. Another issue is ARIES-960 where the same thing written in java would work. That's a problem of type assignability verification and I'm willing to fix those. I think that's more your use case. There's a branch I created a while ago with some changes. Could you check if your use case works with the code there ? In all cases, a workaround is always to provide a custom blueprint converter, as this would allow converting whatever you want to whatever is needed. 2017-04-03 11:23 GMT+02:00 CLEMENT Jean-Philippe <[email protected]<mailto:[email protected]>>: Hi Setya, It might be related to an issue I opened last year: https://issues.apache.org/jira/browse/ARIES-1607 At that time I was told to add a custom converter as a workaround. No update on the Jira since then; maybe you may vote for it :) Regards, JP -----Message d'origine----- De : Setya [mailto:[email protected]<mailto:[email protected]>] Envoyé : vendredi 31 mars 2017 19:09 À : [email protected]<mailto:[email protected]> Objet : Blueprint fails instantiating bean with generic constructor Hi all, Aries Blueprint fails to instantiate bean with the following constructors: public AggregateAnnotationCommandHandler(Class<T> aggregateType, Repository<T> repository) { } It seems to have problems with the second argument since it contains generic parameter. While it successfully instantiates the following bean: public EventSourcingRepository(AggregateFactory<T> aggregateFactory, EventStore eventStore) { } I'm using Apache Karaf 4.0.8. Any insight would be greatly appreciated. Thanks & Regards, Setya -- View this message in context: http://karaf.922171.n3.nabble.com/Blueprint-fails-instantiating-bean-with-generic-constructor-tp4049986.html Sent from the Karaf - User mailing list archive at Nabble.com. -- ------------------------ Guillaume Nodet -- ------------------------ Guillaume Nodet -- ------------------------ Guillaume Nodet
