Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Listing of an AgentID with a subclass of NamedParameter causes a MissingPropertyException #253

Open
notthetup opened this issue Aug 30, 2022 · 0 comments
Assignees
Labels

Comments

@notthetup
Copy link
Collaborator

notthetup commented Aug 30, 2022

When using subclasses of org.arl.fjage.param.NamedParameter which are exposed by an Agent, when listing the AgentID in a Groovy shell (like the one provided by the ShellAgent), a MissingPropertyException is thrown.

For example,org.arl.fjage.sentuator.ConfigParam from fjage-sentuator is a subclass of org.arl.fjage.param.NamedParameter.

https://github.com/org-arl/fjage-sentuator/blob/master/src/main/groovy/org/arl/fjage/sentuator/ConfigParam.groovy

> mysentuator

When but when listing an Agent which exposes a ConfigParam, like say a Sentuator on a groovy shell, nothing gets printed on the shell and an Exception is logged.

1661770440607|WARNING|org.arl.fjage.shell.ShellAgent/audio@48:lambda$run$0|Exec failure: groovy.lang.MissingPropertyException: No such property: name for class: org.arl.fjage.sentuator.ConfigParam

This is due to AgentID.metaClass.getAllParameters in GroovyExtensions using the .name field on the NamedParameter. This works for all NamedParameter since the field exists (but is private) so Groovy allows access to it but since ConfigParam is defined in another Jar, it fails.

The fix should be to use the .name() method instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant