JCommander should be Kotlin aware
It would be nice, if using Kotlin I could write the following
class Args {
@Parameter
lateinit var file: File
}
Currently this will fail, as it seems that JCommand tries to read from file to see if there is an default value.
With the new version of Kotlin (1.2 I think) you can check if the lateinit marked variable was already initialized. E.g. in the above case JCommander could detect, that file
a) is not initialized
b) and therefore should be a required attribute.
JCommander will not fail on this case. It leaves that property uninitialized if there was no argument passed for it.
The application code will fail if it will try to access the uninitialized property after the arguments are parsed though. You can set required = true in the annotation, to make the parameter required.
It might be worth considering if JCommander should be changed to have lateinit @Parameters required by default though. Since those will throw an exception if accessed non-initialized.