[weld-dev] Abstract decorators

Gavin King gavin.king at gmail.com
Fri Nov 20 11:10:49 EST 2009


Ugh. This is not right either.

Here's a much better approach:

If a method is abstract:
= if it is a method of a decorated type, it has a generated
implementation that calls the delegate
= otherwise, definition error

Much cleaner. Avoids the special casing of those annotations, and
fixes a hole in what I wrote earlier.

On Fri, Nov 20, 2009 at 10:35 AM, Gavin King <gavin.king at gmail.com> wrote:
> Nono, that's wrong. I think what should really happen is this:
>
> = Abstract method annotated @Inject, @PostConstruct or @PreDestroy
> results in a DE
> = Other abstract methods have a generated impl that simply calls the
> same method on the delegate (and returns the result)
>
> Does that make sense?
>
> On Fri, Nov 20, 2009 at 9:30 AM, Gavin King <gavin.king at gmail.com> wrote:
>> We could say that annotating an abstract method of a decorator with
>> @Inject is a DE. Same for @PostConstruct and @PreDestroy.
>> Alternatively, we could just say that the container ignores them,
>> which seems to be more or less what happens if they are declared on an
>> abstract bean.
>>
>> What the spec definitely needs to do is say that if an abstract method
>> of a decorator is called at runtime, an UnsupportedOperationException
>> results. This is a big oversight.
>>
>> On Fri, Nov 20, 2009 at 3:19 AM, Marius Bogoevici <mariusb at redhat.com> wrote:
>>> The specification allows for decorators to be abstract classes, but this
>>> is currently not supported in Weld (defect WELD-298).
>>>
>>> Since allowing decorator classes to be abstract is the only stated
>>> requirement, here are the general lines I think we should follow for
>>> supporting this:
>>>
>>> - abstract decorator classes can have injected fields, injected
>>> constructor parameters and concrete initializer methods, but abstract
>>> initializer methods should be forbidden (DefinitionException), or at the
>>> very least be non-portable.
>>> - abstract decorator classes cannot have abstract  decorating methods
>>> (DefinitionException)
>>>
>>> WDYT?
>>>
>>> Marius
>>>
>>> _______________________________________________
>>> weld-dev mailing list
>>> weld-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/weld-dev
>>>
>>
>>
>>
>> --
>> Gavin King
>> gavin.king at gmail.com
>> http://in.relation.to/Bloggers/Gavin
>> http://hibernate.org
>> http://seamframework.org
>>
>
>
>
> --
> Gavin King
> gavin.king at gmail.com
> http://in.relation.to/Bloggers/Gavin
> http://hibernate.org
> http://seamframework.org
>



-- 
Gavin King
gavin.king at gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org



More information about the weld-dev mailing list