jacoco / jacoco/jacoco

CLI wrongly interprets non-existing options

Open
#1,490 0 comments 0 reactions 1 assignee View on GitHub

@Godin is already working on this.

Since May 30, 2026.

component: cli type: bug :bug:
Dominant language
Java
Stars
4.6k
Forks
1.2k
Avg merge
1d 9h
Merged PRs (30d)
23

Description

Execution of

java -jar jacoco-0.8.10/lib/jacococli.jar report --excludes

leads to

"--excludes" is not a valid option

as expected.

However execution of

java -jar jacoco-0.8.10/lib/jacococli.jar report --classfiles Example.class --html report --sourcefiles . --excludes=bar

unexpectedly leads to

Exception in thread "main" java.io.UnsupportedEncodingException: bar

i.e. --excludes=bar is interpreted as --encoding bar.

Execution of

java -jar jacoco-0.8.10/lib/jacococli.jar report --classfiles Example.class --html report --foo=bar

unexpectedly leads to creation of a file bar containing XML report, i.e. --foo=bar is interpreted as --xml.

Seems that this happens due to the following code in args4j
https://github.com/kohsuke/args4j/blob/args4j-site-2.0.28/args4j/src/org/kohsuke/args4j/CmdLineParser.java#L586-L599
https://github.com/kohsuke/args4j/blob/args4j-site-2.0.28/args4j/src/org/kohsuke/args4j/CmdLineParser.java#L481-L483

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.