[ 
https://issues.apache.org/jira/browse/FELIX-2455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12883589#action_12883589
 ] 

Guillaume Nodet commented on FELIX-2455:
----------------------------------------

I guess the problem comes from the fact you consider that Closure is the only 
implementation of Function, which is not the case, because there are users that 
actually create commands that implement Function.

So either we still support this way of creating functions, or we'd have to 
remove this interface all together.


> [gogo API] the Function interface used for Closures, takes an unused session 
> parameter
> --------------------------------------------------------------------------------------
>
>                 Key: FELIX-2455
>                 URL: https://issues.apache.org/jira/browse/FELIX-2455
>             Project: Felix
>          Issue Type: Improvement
>          Components: Gogo Runtime
>            Reporter: Derek Baum
>
> The org.osgi.service.command.Function interface (used for Closures), takes a 
> session argument, which is not used in the implementation:
> The Closure constructor takes a session parameter. This is used by the 
> execute() method, which ignores its own session parameter.
> Unless there is another reason for execute() taking a session parameter, I 
> suggest we change the API to remove this parameter
> (deprecating the existing method to keep backward compatibility).
> public interface Function {
>   Object execute(CommandSession session, List<Object> arguments) throws 
> Exception;
> }
> Closure.java:113:
>     // implements Function interface
>     // XXX: session arg x not used?
>     public Object execute(CommandSession x, List<Object> values) throws 
> Exception
>     {
>         try
>         {
>             location.remove();
>             session.variables.remove(LOCATION);
>             return execute(values);
>         }
>         catch (Exception e)
>         {
>             throw setLocation(e);
>         }
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to