hcoles / pitest

State of the art mutation testing system for the JVM
Apache License 2.0
1.67k stars 358 forks source link

Tests without mutations fail (possibly related to Java 9 Modules) #1164

Open turing85 opened 1 year ago

turing85 commented 1 year ago

Reproducer:

Noteworthy:

Logs of stdout and sterr are attached, run was done with --define verbose='true'.

hcoles commented 1 year ago

Yes, the issue is the java 9 module system. Before 9, service loader looked for a properties file to identify implementations, after 9 it also looks at module-info.

Pitest doesn't currently support module path. At some point it will have to, but a significant proportion of its user base is still stuck on java 8 and maintaining backwards compatibilty would be complicated if the build relied on java 9 features.

As a workaround you could add the legacy property file entries and then I believe the tests should run green.

turing85 commented 1 year ago

Yes, the issue is the java 9 module system. Before 9, service loader looked for a properties file to identify implementations, after 9 it also looks at module-info.

Pitest doesn't currently support module path. At some point it will have to, but a significant proportion of its user base is still stuck on java 8 and maintaining backwards compatibilty would be complicated if the build relied on java 9 features.

Hm, I see. do we have this limitation documented somewhere?

As a workaround you could add the legacy property file entries and then I believe the tests should run green.

What exactly do you mean by this? Could you link to an example or a documentation page? Found it (docs.oracle.com). And yes, you're right; this fixes the issue.

verhasi commented 1 year ago

I just ran into this issue also. I have checked the documentation/FAQ especially the "My tests normally run green but PIT says the suite isn’t green" section. Finally, I have figured it out and applied the same workaround as proposed here. Until you fix it, I suppose the FAQ could be extended with a short description.