jcommander
jcommander copied to clipboard
Example code in documentation does not compile
I keep bumping into example code that does not compile. :smiling_face_with_tear:
I have the following problems:
- Example classes should be either package private or public - for consistence https://jcommander.org/#_parameter_delegates has package private classes, while https://jcommander.org/#_more_complex_syntaxes_commands has public and private at the same time
- Example classes should never be private Is https://jcommander.org/#_internationalization or any example with a private class correct?
- Class members should be also package private or public - for consistence For example, https://jcommander.org/#_parameter_delegates won't work with private members
I would like to fix all of the above, but I would like a decision from the maintainers please!
Since these classes and members are used for configuration or applications, I would assume most of us put them in a dedicated package and make the classes and members public. So I would default to public classes and members. Let me know if I can fix all classes and members like that.
Thank you for the library, Greg
I would kindly ask for only changing the absolute essential minimum change, and to abstain from any non-essential refactoring. Having said that, what actually is not compiling?
The example classes if copied to dedicated files don't compile. This is because the visibility of the example classes.
The intention of this docs section is to have both code blocks (the upper and the lower) within the same main class (hence single file). If you do that, it compiles. This is not a bug, it is intention. But I see your point. You want to be able to copy-and-run the code. This is not the intention of the docs. It shall just showcase the use of the API. This is not a Java beginner tutorial. ;-)
@hogejo Closing this issue as you were not responsive since May.