You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Peter Kriens (JIRA)" <ji...@apache.org> on 2011/03/29 19:41:05 UTC

[jira] [Created] (FELIX-2894) Gogo does not handles options but not parameters

Gogo does not handles options but not parameters
------------------------------------------------

                 Key: FELIX-2894
                 URL: https://issues.apache.org/jira/browse/FELIX-2894
             Project: Felix
          Issue Type: Bug
          Components: Gogo Runtime
            Reporter: Peter Kriens


If you create a function with a parameter then the correct method cannot be found:

public void xyz( @Parameter( names="-v", absentValue="absent") String string ) { return string; }

This method is not found for xyz -v abc

There were two bugs in the code:

- annotation values can never be null but null was checked for the presentValue to see if it was not there.
- After handling the parameters the new length of the command line was checked against the xargs. However, this still contained the parameter name + value. So the size was too high to match.

I've added a check for the Parameter.UNSPECIFIED when checking the status of presentValue and I removed the check for the length of xargs, only types is relevant I think. However, might need some other pair of eyes


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (FELIX-2894) Gogo does not handles options but not parameters

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

Peter Kriens updated FELIX-2894:
--------------------------------


Committed a fix but I think this needs better looking. The xargs list gets modified because with parameters, entries are removed. As it should be. However, I do not completely understand why xargs is checked. I've removed the check and all test cases run but it would be nice if someone looked deeper. Maybe when I work on 147 again I can take a deeper look.

> Gogo does not handles options but not parameters
> ------------------------------------------------
>
>                 Key: FELIX-2894
>                 URL: https://issues.apache.org/jira/browse/FELIX-2894
>             Project: Felix
>          Issue Type: Bug
>          Components: Gogo Runtime
>            Reporter: Peter Kriens
>
> If you create a function with a parameter then the correct method cannot be found:
> public void xyz( @Parameter( names="-v", absentValue="absent") String string ) { return string; }
> This method is not found for xyz -v abc
> There were two bugs in the code:
> - annotation values can never be null but null was checked for the presentValue to see if it was not there.
> - After handling the parameters the new length of the command line was checked against the xargs. However, this still contained the parameter name + value. So the size was too high to match.
> I've added a check for the Parameter.UNSPECIFIED when checking the status of presentValue and I removed the check for the length of xargs, only types is relevant I think. However, might need some other pair of eyes

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Assigned] (FELIX-2894) Gogo does not handles options but not parameters

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

Derek Baum reassigned FELIX-2894:
---------------------------------

    Assignee: Derek Baum

> Gogo does not handles options but not parameters
> ------------------------------------------------
>
>                 Key: FELIX-2894
>                 URL: https://issues.apache.org/jira/browse/FELIX-2894
>             Project: Felix
>          Issue Type: Bug
>          Components: Gogo Runtime
>            Reporter: Peter Kriens
>            Assignee: Derek Baum
>
> If you create a function with a parameter then the correct method cannot be found:
> public void xyz( @Parameter( names="-v", absentValue="absent") String string ) { return string; }
> This method is not found for xyz -v abc
> There were two bugs in the code:
> - annotation values can never be null but null was checked for the presentValue to see if it was not there.
> - After handling the parameters the new length of the command line was checked against the xargs. However, this still contained the parameter name + value. So the size was too high to match.
> I've added a check for the Parameter.UNSPECIFIED when checking the status of presentValue and I removed the check for the length of xargs, only types is relevant I think. However, might need some other pair of eyes

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (FELIX-2894) Gogo does not handles options but not parameters

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

Derek Baum resolved FELIX-2894.
-------------------------------

       Resolution: Fixed
    Fix Version/s: gogo.runtime-0.10.0

added new testcases for argument coercion, including Parameters.
Refactored Reflective.java to simplify code.

> Gogo does not handles options but not parameters
> ------------------------------------------------
>
>                 Key: FELIX-2894
>                 URL: https://issues.apache.org/jira/browse/FELIX-2894
>             Project: Felix
>          Issue Type: Bug
>          Components: Gogo Runtime
>            Reporter: Peter Kriens
>            Assignee: Derek Baum
>             Fix For: gogo.runtime-0.10.0
>
>
> If you create a function with a parameter then the correct method cannot be found:
> public void xyz( @Parameter( names="-v", absentValue="absent") String string ) { return string; }
> This method is not found for xyz -v abc
> There were two bugs in the code:
> - annotation values can never be null but null was checked for the presentValue to see if it was not there.
> - After handling the parameters the new length of the command line was checked against the xargs. However, this still contained the parameter name + value. So the size was too high to match.
> I've added a check for the Parameter.UNSPECIFIED when checking the status of presentValue and I removed the check for the length of xargs, only types is relevant I think. However, might need some other pair of eyes

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (FELIX-2894) Gogo does not handles options but not parameters

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

Derek Baum commented on FELIX-2894:
-----------------------------------

The code currently committed to resolve this issue (has wrong issue id in comment so is not listed in subversion commits tab)

    r1086855 | pkriens | 2011-03-30 07:40:15 +0100 (Wed, 30 Mar 2011) | 1 line

    FELIX-2984 Invalid handling of parameters (options were ok). It works now and the tests are running but I am not confident this
    code is correct yet. Will probably have to rewrite this.

causes another problem:

no error is generated if too many args are supplied, as long as the initial args are ok

e.g. before this change, specifying too many args causes an error, as expected:

g! addcommand 1 2 3 4
gogo: IllegalArgumentException: Cannot coerce addcommand(String, String, String, String) to any of [(String, Object, String), (String, Object), (String, Object, Class)]


after this change, no error is issued:

g! addcommand 1 2 3 4
g! 

> Gogo does not handles options but not parameters
> ------------------------------------------------
>
>                 Key: FELIX-2894
>                 URL: https://issues.apache.org/jira/browse/FELIX-2894
>             Project: Felix
>          Issue Type: Bug
>          Components: Gogo Runtime
>            Reporter: Peter Kriens
>
> If you create a function with a parameter then the correct method cannot be found:
> public void xyz( @Parameter( names="-v", absentValue="absent") String string ) { return string; }
> This method is not found for xyz -v abc
> There were two bugs in the code:
> - annotation values can never be null but null was checked for the presentValue to see if it was not there.
> - After handling the parameters the new length of the command line was checked against the xargs. However, this still contained the parameter name + value. So the size was too high to match.
> I've added a check for the Parameter.UNSPECIFIED when checking the status of presentValue and I removed the check for the length of xargs, only types is relevant I think. However, might need some other pair of eyes

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Work started] (FELIX-2894) Gogo does not handles options but not parameters

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

Work on FELIX-2894 started by Derek Baum.

> Gogo does not handles options but not parameters
> ------------------------------------------------
>
>                 Key: FELIX-2894
>                 URL: https://issues.apache.org/jira/browse/FELIX-2894
>             Project: Felix
>          Issue Type: Bug
>          Components: Gogo Runtime
>            Reporter: Peter Kriens
>            Assignee: Derek Baum
>
> If you create a function with a parameter then the correct method cannot be found:
> public void xyz( @Parameter( names="-v", absentValue="absent") String string ) { return string; }
> This method is not found for xyz -v abc
> There were two bugs in the code:
> - annotation values can never be null but null was checked for the presentValue to see if it was not there.
> - After handling the parameters the new length of the command line was checked against the xargs. However, this still contained the parameter name + value. So the size was too high to match.
> I've added a check for the Parameter.UNSPECIFIED when checking the status of presentValue and I removed the check for the length of xargs, only types is relevant I think. However, might need some other pair of eyes

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira