users@ejb-spec.java.net

[ejb-spec users] [jsr345-experts] Re: Final methods in a bean class?

From: Jeremy Bauer <jrbauer_at_us.ibm.com>
Date: Fri, 29 Mar 2013 13:42:57 -0500

I may have overlooked something, but does CDI allow non-private non-public
methods to be final? With the new rules, couldn't we have this situation?

@Stateless public class MyBean {
    final void m() { };
}

public class Other {
   @EJB MyBean field; // PASS
   @Inject MyBean field; // FAIL - unproxyable
}


-Jeremy



From: Marina Vatkina <marina.vatkina_at_oracle.com>
To: jsr345-experts_at_ejb-spec.java.net,
Cc: Pete Muir <pmuir_at_bleepbleep.org.uk>, Jeremy
Bauer/Rochester/IBM_at_IBMUS
Date: 03/28/2013 02:06 PM
Subject: [jsr345-experts] Re: Final methods in a bean class?



So we are just catching up with the CDI spec ;)

Thanks Pete.

-marina

On 3/28/13 11:21 AM, Pete Muir wrote:
> Static methods were never considered as a block to proxability.
>
> On 28 Mar 2013, at 18:20, Marina Vatkina <marina.vatkina_at_oracle.com>
wrote:
>
>> How about static methods?
>>
>> thanks,
>> -marina
>>
>> On 3/28/13 11:12 AM, Pete Muir wrote:
>>> We updated the requirements in CDI to specifically exclude private
methods from proxability requirements. Note we moved this to it's own
section - 3.15
>>>
>>> Pete
>>>
>>> On 28 Mar 2013, at 17:16, Marina Vatkina <marina.vatkina_at_oracle.com>
wrote:
>>>
>>>> Well, Pete is on this list (and I'm cc-ing him here explicitly), but
I don't think private final (or static final) methods should be
restricted...
>>>>
>>>> -marina
>>>>
>>>> On 3/28/13 9:30 AM, Jeremy Bauer wrote:
>>>>> Hi Marina,
>>>>>
>>>>> Won't allowing final methods will cause an inconsistency with the
CDI spec? CDI 1.0 section 5.4.1 says:
>>>>>
>>>>> Certain legal bean types cannot be proxied by the container:
>>>>> [...]
>>>>> • classes which are declared final or have final methods,
>>>>>
>>>>> And I believe this is true in CDI 1.1, but I don't have that spec
handy.
>>>>>
>>>>> -Jeremy
>>>>>
>>>>>
>>>>>
>>>>> From: Marina Vatkina <marina.vatkina_at_oracle.com>
>>>>> To: jsr345-experts_at_ejb-spec.java.net,
>>>>> Date: 03/27/2013 06:21 PM
>>>>> Subject: [jsr345-experts] Re: Final methods in a bean class?
>>>>>
>>>>>
>>>>>
>>>>> After a longer discussion with Mark offline and not to allow users
to
>>>>> shoot themselves into a foot, the new proposal is to change both
>>>>> statements as follow:
>>>>>
>>>>> (a) "All non-static public methods of the bean class and of any
>>>>> superclasses except the java.lang.Object, are exposed as business
methods."
>>>>>
>>>>> (b) "Business methods exposed through the no-interface view must not
be
>>>>> declared final."
>>>>>
>>>>> Let me know if anybody disagrees.
>>>>>
>>>>> thanks,
>>>>> -marina
>>>>>
>>>>> On 3/27/13 11:36 AM, Marina Vatkina wrote:
>>>>>> Experts,
>>>>>>
>>>>>> The EJB spec currently requires that if a bean exposes a
no-interface
>>>>>> view (see 4.9.8 Session Bean’s No-Interface View):
>>>>>>
>>>>>> (a) "All public methods of the bean class and of any superclasses
>>>>>> except the java.lang.Object, are exposed as business methods
through
>>>>>> the no-interface view."
>>>>>> (b) "All methods of the bean class and any superclasses must not be
>>>>>> declared final."
>>>>>>
>>>>>> For all other views the rules for a *business method* is
>>>>>> "The method must not be declared as final or static."
>>>>>>
>>>>>> Does any of you see a problem with removing the rule (b) and
changing
>>>>>> the rule (a) to:
>>>>>>
>>>>>> "All non-final non-static public methods of the bean class and of
any
>>>>>> superclasses except the java.lang.Object, are exposed as business
>>>>>> methods through the no-interface view."
>>>>>>
>>>>>> thanks,
>>>>>> -marina
>>>>>>
>>>>>>