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

Derek Baum commented on FELIX-2455:
-----------------------------------

I raised this issue as I noticed that the Closure implementation of Function 
doesn't use its session parameter.

I've since found that CommandProxy also implements Function and it does use the 
session parameter, so I'll mark this issue as 'won't fix'.



> [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