Skip to content

Issue #13501: Kill mutation for JavaParser2#13658

Merged
romani merged 1 commit intocheckstyle:masterfrom
Kevin222004:JavaParser2
Aug 30, 2023
Merged

Issue #13501: Kill mutation for JavaParser2#13658
romani merged 1 commit intocheckstyle:masterfrom
Kevin222004:JavaParser2

Conversation

@Kevin222004
Copy link
Copy Markdown
Contributor

@Kevin222004 Kevin222004 commented Aug 28, 2023

Issue #13501: Kill mutation for JavaParser2

https://github.com/Kevin222004/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/JavaParser.java


Mutations

<mutation unstable="false">
<sourceFile>JavaParser.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.JavaParser</mutatedClass>
<mutatedMethod>parseFile</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator</mutator>
<description>replaced call to java/io/File::getAbsoluteFile with receiver</description>
<lineContent>final FileText text = new FileText(file.getAbsoluteFile(),</lineContent>
</mutation>


Explaination

https://github.com/Kevin222004/checkstyle/blob/7007bef1f43a621757ae0b885818cf8baa0e6ef1/src/main/java/com/puppycrawl/tools/checkstyle/JavaParser.java#L140

The code is mutated as to remove file.getAbsoluteFile() --> file getAbsoluteFile this method will give the absolute path of file.

As per my research, the file from the parameter is already an absolute file path. I also don't think that test case is even possible because if we provide only filename then it will become exception.


Regression

Copy link
Copy Markdown
Member

@romani romani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creation by File is more exact, that by absolute pass of it.

Copy link
Copy Markdown
Member

@rdiachenko rdiachenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@rdiachenko
Copy link
Copy Markdown
Member

rebased

@rdiachenko rdiachenko assigned romani and unassigned rdiachenko Aug 29, 2023
@romani romani merged commit acecbd4 into checkstyle:master Aug 30, 2023
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

Successfully merging this pull request may close these issues.

3 participants