Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TryWithResourcesFilter does not work with Java 11+ #689

Closed
Vampire opened this issue Oct 2, 2019 · 4 comments
Closed

TryWithResourcesFilter does not work with Java 11+ #689

Vampire opened this issue Oct 2, 2019 · 4 comments

Comments

@Vampire
Copy link
Contributor

Vampire commented Oct 2, 2019

With this code:

Properties versionProperties = new Properties();
try (InputStream versionPropertiesStream = versionPropertiesResource.openStream()) {
    versionProperties.load(versionPropertiesStream);
} catch (IOException ignored) {
}

in Java 8, 9 and 10, the TryWithResourcesFilter properly filters out the mutants.
Starting with Java 11 this is no longer the case:
grafik
grafik

@Vampire
Copy link
Contributor Author

Vampire commented Oct 2, 2019

Btw. @hcoles you should maybe also checkin the sources for the pre-compiled test classes and / or additionally test them freshly compiled.
Currently it is hard to add the test cases for Java 11 compiler.
At least unless one has the sources or decompiles the precompiled ones and then recompiles them.

@Vampire
Copy link
Contributor Author

Vampire commented Oct 2, 2019

Also tested with 12 and 13, same result

@Vampire
Copy link
Contributor Author

Vampire commented Oct 3, 2019

Hm, besides that the sequence of bytecodes seems to have changed slightly, the bytecodes are not split between the try and catch line, so the current tactic of recognizing the bytecode sequence and ignoring all mutants on that line might not work properly.
The modified sequence (5 instructions less) still matches the catch line number.
But the mutants are not all on the catch line anymore.
But this might also be a different additional problem, as looking at the opcodeStack for line 79 in the TryWithResourcesMethodVisitor, I only see one INVOKEVIRTUAL and one ASTORE which should be my openStream() call and the assignment I think.
This makes me wonder why the 5 NO_COVERAGE mutants are reported for line 79 instead of 81.
I think I'll stop investigation here and let it for you, as you are more familiar with this.

@hcoles
Copy link
Owner

hcoles commented Feb 16, 2021

Clsoing as this is being fixed under #766

@hcoles hcoles closed this as completed Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants