felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Meschberger <fmesc...@adobe.com>
Subject Re: [InventoryPrinter] Finding methods by reflection
Date Mon, 11 Mar 2013 10:21:45 GMT
Hi

I have created FELIX-3963 [1] and attached two patches implementing the options.

Regards
Felix

[1] https://issues.apache.org/jira/browse/FELIX-3963

Am 11.03.2013 um 09:47 schrieb Clement Escoffier:

> Hi,
> 
> What about walking in two steps:
> - first with getMethod
> - then with getDeclaredMethod and check the owner class.
> 
> If the first lookup is not successful, then try with the private methods of the implementation
class. 
> 
> Regards,
> 
> Clement
> 
> On 11 mars 2013, at 08:35, Felix Meschberger <fmeschbe@adobe.com> wrote:
> 
>> Hi,
>> 
>> Am 10.03.2013 um 19:59 schrieb Carsten Ziegeler:
>> 
>>> Hi,
>>> 
>>>> My opinion would be:
>>>> 
>>>> (a) search the implementation class only
>>>> (b) accept all method modifiers
>>>> (c) document to prefer private
>>>> 
>>>> Alternatively we could search the class hierarchy as is defined in section
112.9.4 (Locating Component Methods) of the Declarative Services specification.
>>> 
>>> I think the current implementation searches the hierarchy
>> 
>> Yes and no ;-) The current implementation walks the hierarchy but it uses the Class.getMethod
method to find the method, which actually only returns public methods. So walking the hierarchy
is essentially useless.
>> 
>> Just using getDeclaredMethod is not fully correct, because you probably don't want
to use a private method from a super class or a package private method from a super class
in a different package. Which is why I also refer to the DS specification, which explains
how to actually find and select methods from superclasses.
>> 
>> 
>>> - I don't
>>> have a strong preference, but I think searching the hierarchy is
>>> better.
>> 
>> I somehow have the impression that subclassing is not a concern for InventoryPrinter
services and in fact may not even make sense. Which is probably also why Web Console 4 does
not walk the class hierarchy for finding ConfigurationPrinter methods.
>> 
>> Regards
>> Felix
>> 
>>>> 
>>>> --
>>>> Felix Meschberger | Principal Scientist | Adobe
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>>> 
>>> -- 
>>> Carsten Ziegeler
>>> cziegeler@apache.org
>> 
>> 
>> --
>> Felix Meschberger | Principal Scientist | Adobe
>> 
>> 
>> 
>> 
>> 
>> 
>> 
> 


--
Felix Meschberger | Principal Scientist | Adobe








Mime
View raw message