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

Main parameter does not support IStringConverterInstanceFactory #538

Open
antonio-rodriges opened this issue Jul 21, 2022 · 1 comment
Open
Labels
bug Bug

Comments

@antonio-rodriges
Copy link

antonio-rodriges commented Jul 21, 2022

JCommander can accept

IStringConverterInstanceFactory

But it does not work for the main parameter

com.beust.jcommander.ParameterException: Could not invoke null
    Reason: Can not set <....>.Name field ><.....>.Name to java.lang.String
	at com.beust.jcommander.Parameterized.set(Parameterized.java:273)
	at com.beust.jcommander.JCommander$MainParameter.addValue(JCommander.java:108)
	at com.beust.jcommander.JCommander.parseValues(JCommander.java:789)
	at com.beust.jcommander.JCommander.parse(JCommander.java:363)
	at com.beust.jcommander.JCommander.parse(JCommander.java:342)

A workaround is to specify a dummy converter class for the main parameter that cannot be instantiated (e.g. an abstract class with a private constructor), see #380 (comment)

Related issue: #380

@mkarg
Copy link
Collaborator

mkarg commented Apr 28, 2024

Is this still an issue in current release 1.83? If so, could you please provide a unit test which proofs your claim? Thanks!

@mkarg mkarg added the bug Bug label Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug
Projects
None yet
Development

No branches or pull requests

2 participants