How to configure PIT for java project in eclipse

51 views
Skip to first unread message

Alain Fernandez

unread,
Mar 21, 2022, 5:35:17 PMMar 21
to PIT Users
I am new to PIT and I am trying to use it for few day, but without success. Whatever I try to use it in a Java project with a module-info.java or not, or from an eclipse plug-in. I always got some errors.
I am using eclipse 2022-03, and I installed PIT in eclipse as recommanded by https://github.com/pitest/pitclipse

Then I wrote a very simple Java class, a kind of hello world example, and the corresponding JUnit 4 test class. My test is running ok, but I cannot success to run PIT. In the case of my java project without module-info.java, I click on 'Run as PIT' in the popup menu on my test class and I got the following error:

22:12:15 PIT >> INFO : ---------------------------------------------------------------------------
22:12:15 PIT >> INFO : Enabled (+) and disabled (-) features.
22:12:15 PIT >> INFO : -----------------------------------------
22:12:15 PIT >> INFO : +FANN           Filters mutations in classes and methods with matching annotations of class or runtime retention
22:12:15 PIT >> INFO :   [annotation]    Annotation to avoid (full package name not required)
22:12:15 PIT >> INFO : +FFBLOCK        Filters mutations in code duplicated by finally block inlining
22:12:15 PIT >> INFO : +FFEACH         Filters mutations in compiler generated code that implements for each loops
22:12:15 PIT >> INFO : +FFLOOP         Filters any mutations to increments in for loops as they may cause timeouts
22:12:15 PIT >> INFO : +FINFINC        Filters mutations to increments that may cause infinite loops
22:12:15 PIT >> INFO : +FINFIT         Filters mutations that may cause infinite loops by removing calls to iterator.next
22:12:15 PIT >> INFO : +FINULL         Filters mutations in compiler generated code that checks for null by calling getClass
22:12:15 PIT >> INFO : +FKOTLIN        Filters out junk mutations in bytecode created by compiler for kotlin language features
22:12:15 PIT >> INFO : +FLOGCALL       Filters mutations in code that makes calls to logging frameworks
22:12:15 PIT >> INFO : +FMRNULL        Filters mutations in compiler generated code that inserts Objects.requireNonNull for method references
22:12:15 PIT >> INFO : +FRETEQUIV      Filters return vals mutants with bytecode equivalent to the unmutated class
22:12:15 PIT >> INFO : +FSEQUIVEQUALS  Filters equivalent mutations that affect only performance in short cutting equals methods
22:12:15 PIT >> INFO : +FSTATI         Filters mutations in static initializers and code called only from them
22:12:15 PIT >> INFO : +FSTATINIT      Filters mutations in static initializers and code called only from them
22:12:15 PIT >> INFO : +FTRYWR         Filters mutations in code generated for try with resources statements
22:12:15 PIT >> INFO : -CLASSLIMIT     Limits the maximum number of mutations per class
22:12:15 PIT >> INFO :   [limit]         Integer value for maximum mutations to create per class
22:12:15 PIT >> INFO : -EXPORT         Exports mutants bytecode and other details to disk
22:12:15 PIT >> INFO : ---------------------------------------------------------------------------
22:12:16 PIT >> FINE : Running report with ReportOptions [targetClasses=[testing.example.bank.SimpleBankAccount, testing.example.bank.SimpleBankAccountTest], excludedMethods=[], excludedClasses=[*Test], excludedTestClasses=[], codePaths=[], reportDir=C:\WS_TDD_CI_2\.metadata\.plugins\org.pitest.pitclipse.core\html_results, historyInputLocation=null, historyOutputLocation=null, sourceDirs=[C:\WS_TDD_CI_2\testing.example.bank.nomodule\src, C:\WS_TDD_CI_2\testing.example.bank.nomodule\tests], classPathElements=[C:\bin\eclipse\2022-03\eclipse\plugins\org.pitest_1.4.11.v20210506-1200, C:\bin\eclipse\2022-03\eclipse\plugins\org.pitest.pitclipse.runner_2.1.2.v20210506-1200.jar, C:\bin\eclipse\2022-03\eclipse\plugins\org.pitest.pitclipse.runner_2.1.2.v20210506-1200.jar\bin, C:\bin\eclipse\2022-03\eclipse\plugins\org.pitest_1.4.11.v20210506-1200\lib\pitest.jar, C:\bin\eclipse\2022-03\eclipse\plugins\org.pitest_1.4.11.v20210506-1200\lib\pitest-entry.jar, C:\bin\eclipse\2022-03\eclipse\plugins\org.pitest_1.4.11.v20210506-1200\lib\pitest-command-line.jar, C:\bin\eclipse\2022-03\eclipse\plugins\org.pitest_1.4.11.v20210506-1200\lib\pitest-html-report.jar, C:\bin\eclipse\2022-03\eclipse\plugins\com.google.guava_30.1.0.v20210127-2300.jar, C:\bin\eclipse\2022-03\eclipse\plugins\org.pitest.pitclipse.listeners_2.1.2.v20210506-1200.jar, C:\bin\eclipse\2022-03\eclipse\plugins\org.pitest.pitclipse.listeners_2.1.2.v20210506-1200.jar\bin, C:\WS_TDD_CI_2\testing.example.bank.nomodule\bin, C:\bin\eclipse\2022-03\eclipse\plugins\org.junit_4.13.2.v20211018-1956.jar, C:\bin\eclipse\2022-03\eclipse\plugins\org.hamcrest.core_1.3.0.v20180420-1519.jar], mutators=[DEFAULTS], features=[], dependencyAnalysisMaxDistance=-1, jvmArgs=[-Djava.awt.headless=true], numberOfThreads=4, timeoutFactor=1.25, timeoutConstant=3000, targetTests=[^testing\.example\.bank\.SimpleBankAccountTest$], loggingClasses=[java.util.logging, org.apache.log4j, org.slf4j, org.apache.commons.logging, org.apache.logging.log4j], maxMutationsPerClass=0, verbose=true, failWhenNoMutations=false, outputs=[HTML, PITCLIPSE_MUTATIONS, PITCLIPSE_SUMMARY], groupConfig=TestGroupConfig [excludedGroups=[], includedGroups=[]], fullMutationMatrix=false, mutationUnitSize=0, shouldCreateTimestampedReports=true, detectInlinedCode=false, exportLineCoverage=false, mutationThreshold=0, coverageThreshold=0, mutationEngine=gregor, javaExecutable=null, includeLaunchClasspath=true, properties={}, maxSurvivors=-1, excludedRunners=[], includedTestMethods=[], testPlugin=junit, useClasspathJar=false, skipFailingTests=false]
22:12:16 PIT >> FINE : System class path is C:\bin\eclipse\2022-03\eclipse\plugins\org.pitest_1.4.11.v20210506-1200;C:\bin\eclipse\2022-03\eclipse\plugins\org.pitest.pitclipse.runner_2.1.2.v20210506-1200.jar;C:\bin\eclipse\2022-03\eclipse\plugins\org.pitest.pitclipse.runner_2.1.2.v20210506-1200.jar\bin;C:\bin\eclipse\2022-03\eclipse\plugins\org.pitest_1.4.11.v20210506-1200\lib\pitest.jar;C:\bin\eclipse\2022-03\eclipse\plugins\org.pitest_1.4.11.v20210506-1200\lib\pitest-entry.jar;C:\bin\eclipse\2022-03\eclipse\plugins\org.pitest_1.4.11.v20210506-1200\lib\pitest-command-line.jar;C:\bin\eclipse\2022-03\eclipse\plugins\org.pitest_1.4.11.v20210506-1200\lib\pitest-html-report.jar;C:\bin\eclipse\2022-03\eclipse\plugins\com.google.guava_30.1.0.v20210127-2300.jar;C:\bin\eclipse\2022-03\eclipse\plugins\org.pitest.pitclipse.listeners_2.1.2.v20210506-1200.jar;C:\bin\eclipse\2022-03\eclipse\plugins\org.pitest.pitclipse.listeners_2.1.2.v20210506-1200.jar\bin;C:\WS_TDD_CI_2\testing.example.bank.nomodule\bin;C:\bin\eclipse\2022-03\eclipse\plugins\org.junit_4.13.2.v20211018-1956.jar;C:\bin\eclipse\2022-03\eclipse\plugins\org.hamcrest.core_1.3.0.v20180420-1519.jar
22:12:16 PIT >> FINE : Maximum available memory is 2030 mb
Exception in thread "main" java.lang.IllegalArgumentException: Unsupported class file major version 61
        at org.pitest.reloc.asm.ClassReader.<init>(ClassReader.java:196)
        at org.pitest.reloc.asm.ClassReader.<init>(ClassReader.java:177)
        at org.pitest.reloc.asm.ClassReader.<init>(ClassReader.java:163)
        at org.pitest.classinfo.ClassInfoVisitor.getClassInfo(ClassInfoVisitor.java:41)
        at org.pitest.classinfo.Repository.nameToClassInfo(Repository.java:70)
        at org.pitest.classinfo.Repository.fetchClass(Repository.java:60)
        at org.pitest.classinfo.NameToClassInfo.apply(NameToClassInfo.java:17)
        at org.pitest.classinfo.NameToClassInfo.apply(NameToClassInfo.java:7)
        at java.base/java.util.function.Function.lambda$andThen$1(Function.java:88)
        at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
        at org.pitest.classpath.CodeSource.getCode(CodeSource.java:43)
        at org.pitest.mutationtest.verify.DefaultBuildVerifier.verify(DefaultBuildVerifier.java:32)
        at org.pitest.mutationtest.tooling.MutationCoverage.verifyBuildSuitableForMutationTesting(MutationCoverage.java:223)
        at org.pitest.mutationtest.tooling.MutationCoverage.runReport(MutationCoverage.java:111)
        at org.pitest.mutationtest.tooling.EntryPoint.execute(EntryPoint.java:120)
        at org.pitest.mutationtest.tooling.EntryPoint.execute(EntryPoint.java:50)
        at org.pitest.mutationtest.commandline.MutationCoverageReport.runReport(MutationCoverageReport.java:87)
        at org.pitest.mutationtest.commandline.MutationCoverageReport.main(MutationCoverageReport.java:45)
        at org.pitest.pitclipse.runner.PitRunner.lambda$1(PitRunner.java:59)
        at com.google.common.base.Present.transform(Present.java:75)
        at org.pitest.pitclipse.runner.PitRunner.main(PitRunner.java:46)
Reply all
Reply to author
Forward
0 new messages