You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Derek Baum (JIRA)" <ji...@apache.org> on 2010/06/29 17:26:51 UTC

[jira] Created: (FELIX-2455) [gogo API] the Function interface used for Closures, takes an unused session parameter

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


[jira] Commented: (FELIX-2455) [gogo API] the Function interface used for Closures, takes an unused session parameter

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-2455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12883587#action_12883587 ] 

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

How do you plan to access session variables (both read and write modes) if you don't pass the session as an argument on the function execution ?

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


[jira] Commented: (FELIX-2455) [gogo API] the Function interface used for Closures, takes an unused session parameter

Posted by "Derek Baum (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Commented: (FELIX-2455) [gogo API] the Function interface used for Closures, takes an unused session parameter

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Resolved: (FELIX-2455) [gogo API] the Function interface used for Closures, takes an unused session parameter

Posted by "Derek Baum (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-2455?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Derek Baum resolved FELIX-2455.
-------------------------------

    Resolution: Not A Problem

not a problem - other implementations of Function may use the session parameter.


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