polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kent Sølvsten <kent.soelvs...@gmail.com>
Subject Re: Bug in @This injections??
Date Tue, 17 Nov 2015 20:10:25 GMT
It looks like constructor injection *sometimes* works, depending on the
details.

I made a few experiments, and in some cases it "works" - but a package
protected constructor or the mixin declared as a non-static inner class
are at least 2 of the cases giving problems.
There may be more.

@Niclas: Can you push your concrete testcase to git (possibly ignored) -
so we are sure we are not comparing apples n' oranges?

/Kent



Den 17-11-2015 kl. 01:06 skrev Niclas Hedhman:
> I don't know what you mean by "no luck". Is it, "it works as expected" or
> "it doesn't work as Niclas claims" ?
>
> @Mixins(AbcMixin.class)
> public interface Abc extends TransientComposite {
>
> }
>
> public interface Def
> {
>     Property<String> def();
> }
>
>
> public class AbcMixin
>     implements Abc
> {
>     public AbcMixin( @This Def privateMixin )  // a Def instance is not
> given
>     {
>     }
> }
>
> but if I add Def to the Abc,
>
> public interface Abc extends Def, TransientComposite{}
>
> then there is a value in the constructor.
>
>
> If you had problem understanding what *I* meant, then I hope this is
> clearer.
>
> Cheers
> Niclas
>
> On Mon, Nov 16, 2015 at 11:24 PM, Paul Merlin <paul@nosphere.org> wrote:
>
>> Hey,
>>
>> Catching up ...
>>
>> Niclas Hedhman a écrit :
>>> I think that "Private @This" doesn't work for Constructor injections at
>> the
>>> moment.
>>>
>>> Not sure if that is because it can't be done, or because the
>> implementation
>>> is lacking the feature.
>>>
>>> Looking at the ThisInjectionProviderFactory, I can't figure out how this
>> is
>>> supposed to work at all. And if anyone has interest, please enlighten me
>> of
>>> what we ned to do to support this properly. The previous
>> decorator-feature
>>> I mention, depends on this :-(
>> Niclas Hedhman a écrit :
>>> So, for @This injection in fields, the type is somehow added to the
>>> Composite, but when it is injected in the Constructor, it seems to only
>>> take the public  Composite type interfaces...
>> I tried to understand/reproduce the issue but couldn't.
>> Also added some tests in ConstructorInjectionOfThisTest and
>> PrivateMixinTest by the way, with no luck. The latter existing test was
>> wrong as under-test Work fragment was declared as a *public* mixin.
>>
>> /Paul
>>
>>
>


Mime
View raw message