I'm using try-with-resources and JaCoCo reports a large number of missed branches. I'm using JaCoCo version 0.8.2, which includes the JAVAC.TRYWITH filter. I understand that this filter is unconditionally on, but it doesn't seem to be working.
A little research into the filter seems to indicate that this is for Java 11, and I'm using Java 8.
Is this the reason I'm seeing the missed branches?
Thanks.
-Mark
Thanks.
-Mark


Also, I found it interesting that the lazy initialization via ResourceHolder pattern shows lack of coverage. Here's a short example:
public class Foo {
private static class ResourceHolder {
private static final Foo INSTANCE = new Foo();
}
public static Foo getInstance() {
return ResourceHolder.INSTANCE;
}
// Remaining code not shown.
}
The line defining the class "ResourceHolder" is RED in the JaCoCo report. Perhaps because there is a default constructor that does not get called?
Two things:
1. I will try adding the private no-args constructor.
2. Your image revealed something I had not seen before - the JaCoCo version in the lower right corner of the page. I was not seeing this in my browser, probably because the window is so small. The version it is showing is 0.7.9.
I'm using an SBT plugin, and I was TOLD it used 0.8.2 for JaCoCo, so apparently something isn't configured properly, or that information was inaccurate.

Sorry to take up your time with something so trivial, but I appreciate your response.
Have a great remainder of the week!