JavadocOptionFile set up

I am extending org.gradle.api.tasks.javadoc.Javadoc task and I would like to set certain options to be passed to the javadoc generating tool.

I tried using options.addStringOption(‘foobar’)

I would like this to become -foobar that we pass, sadly, after looking into StringJavadocOptionFileOption (and AbstractListJavadocOptionFileOption that it extends) I found that it in fact does not print anything given that I did not pass any value to the string option. How do I work around this? Everything that would allow me to do this live in org.gradle.external.javadoc.internal. Any suggestions?

Anyone had any suggestions?