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 2011/06/07 21:45:58 UTC

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

    [ 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