Skip to content

Commit

Permalink
Issue checkstyle#11604: separates detail ast from xpath
Browse files Browse the repository at this point in the history
  • Loading branch information
rnveach committed Oct 17, 2022
1 parent 21d1219 commit f07c620
Show file tree
Hide file tree
Showing 18 changed files with 715 additions and 613 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6239,39 +6239,7 @@
</checkerFrameworkError>

<checkerFrameworkError unstable="false">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractNode.java</fileName>
<specifier>initialization.fields.uninitialized</specifier>
<message>the constructor does not initialize fields: children</message>
<lineContent>protected AbstractNode(TreeInfo treeInfo) {</lineContent>
</checkerFrameworkError>

<checkerFrameworkError unstable="false">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractNode.java</fileName>
<specifier>not.interned</specifier>
<message>attempting to use a non-@Interned comparison operand</message>
<lineContent>return this == nodeInfo;</lineContent>
</checkerFrameworkError>

<checkerFrameworkError unstable="false">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractNode.java</fileName>
<specifier>not.interned</specifier>
<message>attempting to use a non-@Interned comparison operand</message>
<lineContent>return this == nodeInfo;</lineContent>
</checkerFrameworkError>

<checkerFrameworkError unstable="false">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/AttributeNode.java</fileName>
<specifier>argument</specifier>
<message>incompatible argument for parameter treeInfo of AbstractNode.</message>
<lineContent>super(null);</lineContent>
<details>
found : null (NullType)
required: @Initialized @NonNull TreeInfo
</details>
</checkerFrameworkError>

<checkerFrameworkError unstable="false">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/ElementNode.java</fileName>
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractElementNode.java</fileName>
<specifier>argument</specifier>
<message>incompatible argument for parameter name of AttributeNode.</message>
<lineContent>private static final AttributeNode ATTRIBUTE_NODE_UNINITIALIZED = new AttributeNode(null, null);</lineContent>
Expand All @@ -6282,7 +6250,7 @@
</checkerFrameworkError>

<checkerFrameworkError unstable="false">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/ElementNode.java</fileName>
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractElementNode.java</fileName>
<specifier>argument</specifier>
<message>incompatible argument for parameter nodes of OfNodes.</message>
<lineContent>getChildren().toArray(EMPTY_ABSTRACT_NODE_ARRAY));</lineContent>
Expand All @@ -6293,7 +6261,7 @@
</checkerFrameworkError>

<checkerFrameworkError unstable="false">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/ElementNode.java</fileName>
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractElementNode.java</fileName>
<specifier>argument</specifier>
<message>incompatible argument for parameter nodes of OfNodes.</message>
<lineContent>getFollowingSiblings().toArray(EMPTY_ABSTRACT_NODE_ARRAY));</lineContent>
Expand All @@ -6304,7 +6272,7 @@
</checkerFrameworkError>

<checkerFrameworkError unstable="false">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/ElementNode.java</fileName>
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractElementNode.java</fileName>
<specifier>argument</specifier>
<message>incompatible argument for parameter value of AttributeNode.</message>
<lineContent>private static final AttributeNode ATTRIBUTE_NODE_UNINITIALIZED = new AttributeNode(null, null);</lineContent>
Expand All @@ -6315,32 +6283,21 @@
</checkerFrameworkError>

<checkerFrameworkError unstable="false">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/ElementNode.java</fileName>
<specifier>assignment</specifier>
<message>incompatible types in assignment.</message>
<lineContent>attributeNode = null;</lineContent>
<details>
found : null (NullType)
required: @Initialized @NonNull AttributeNode
</details>
</checkerFrameworkError>

<checkerFrameworkError unstable="false">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/ElementNode.java</fileName>
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractElementNode.java</fileName>
<specifier>not.interned</specifier>
<message>attempting to use a non-@Interned comparison operand</message>
<lineContent>if (attributeNode == ATTRIBUTE_NODE_UNINITIALIZED) {</lineContent>
</checkerFrameworkError>

<checkerFrameworkError unstable="false">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/ElementNode.java</fileName>
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractElementNode.java</fileName>
<specifier>not.interned</specifier>
<message>attempting to use a non-@Interned comparison operand</message>
<lineContent>if (attributeNode == ATTRIBUTE_NODE_UNINITIALIZED) {</lineContent>
</checkerFrameworkError>

<checkerFrameworkError unstable="false">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/ElementNode.java</fileName>
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractElementNode.java</fileName>
<specifier>return</specifier>
<message>incompatible types in return.</message>
<lineContent>return result;</lineContent>
Expand All @@ -6351,21 +6308,42 @@
</checkerFrameworkError>

<checkerFrameworkError unstable="false">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/ElementNode.java</fileName>
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractElementNode.java</fileName>
<specifier>toarray.nullable.elements.not.newarray</specifier>
<message>call of toArray on collection of non-null elements yields an array of possibly-null elements; omit the argument to toArray or make it an explicit array constructor</message>
<lineContent>getChildren().toArray(EMPTY_ABSTRACT_NODE_ARRAY));</lineContent>
</checkerFrameworkError>

<checkerFrameworkError unstable="false">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/ElementNode.java</fileName>
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractElementNode.java</fileName>
<specifier>toarray.nullable.elements.not.newarray</specifier>
<message>call of toArray on collection of non-null elements yields an array of possibly-null elements; omit the argument to toArray or make it an explicit array constructor</message>
<lineContent>getFollowingSiblings().toArray(EMPTY_ABSTRACT_NODE_ARRAY));</lineContent>
</checkerFrameworkError>

<checkerFrameworkError unstable="false">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/RootNode.java</fileName>
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractNode.java</fileName>
<specifier>initialization.fields.uninitialized</specifier>
<message>the constructor does not initialize fields: children</message>
<lineContent>protected AbstractNode(TreeInfo treeInfo) {</lineContent>
</checkerFrameworkError>

<checkerFrameworkError unstable="false">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractNode.java</fileName>
<specifier>not.interned</specifier>
<message>attempting to use a non-@Interned comparison operand</message>
<lineContent>return this == nodeInfo;</lineContent>
</checkerFrameworkError>

<checkerFrameworkError unstable="false">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractNode.java</fileName>
<specifier>not.interned</specifier>
<message>attempting to use a non-@Interned comparison operand</message>
<lineContent>return this == nodeInfo;</lineContent>
</checkerFrameworkError>

<checkerFrameworkError unstable="false">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractRootNode.java</fileName>
<specifier>argument</specifier>
<message>incompatible argument for parameter nodes of OfNodes.</message>
<lineContent>getChildren().toArray(EMPTY_ABSTRACT_NODE_ARRAY));</lineContent>
Expand All @@ -6376,7 +6354,7 @@
</checkerFrameworkError>

<checkerFrameworkError unstable="false">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/RootNode.java</fileName>
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractRootNode.java</fileName>
<specifier>return</specifier>
<message>incompatible types in return.</message>
<lineContent>return null;</lineContent>
Expand All @@ -6387,12 +6365,34 @@
</checkerFrameworkError>

<checkerFrameworkError unstable="false">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/RootNode.java</fileName>
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractRootNode.java</fileName>
<specifier>toarray.nullable.elements.not.newarray</specifier>
<message>call of toArray on collection of non-null elements yields an array of possibly-null elements; omit the argument to toArray or make it an explicit array constructor</message>
<lineContent>getChildren().toArray(EMPTY_ABSTRACT_NODE_ARRAY));</lineContent>
</checkerFrameworkError>

<checkerFrameworkError unstable="false">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/AttributeNode.java</fileName>
<specifier>argument</specifier>
<message>incompatible argument for parameter treeInfo of AbstractNode.</message>
<lineContent>super(null);</lineContent>
<details>
found : null (NullType)
required: @Initialized @NonNull TreeInfo
</details>
</checkerFrameworkError>

<checkerFrameworkError unstable="false">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/ElementNode.java</fileName>
<specifier>return</specifier>
<message>incompatible types in return.</message>
<lineContent>return result;</lineContent>
<details>
type of expression: @Initialized @Nullable AttributeNode
method return type: @Initialized @NonNull AttributeNode
</details>
</checkerFrameworkError>

<checkerFrameworkError unstable="false">
<fileName>checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/xpath/XpathQueryGenerator.java</fileName>
<specifier>argument</specifier>
Expand Down
70 changes: 17 additions & 53 deletions .ci/pitest-suppressions/pitest-xpath-suppressions.xml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<suppressedMutations>
<mutation unstable="false">
<sourceFile>DescendantIterator.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.xpath.iterators.DescendantIterator</mutatedClass>
<mutatedMethod>&lt;init&gt;</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator</mutator>
<description>Removed assignment to member variable descendantEnum</description>
<lineContent>descendantEnum = null;</lineContent>
<sourceFile>AbstractElementNode.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.xpath.AbstractElementNode</mutatedClass>
<mutatedMethod>getPrecedingSiblings</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator</mutator>
<description>replaced call to java/util/Collections::unmodifiableList with argument</description>
<lineContent>return Collections.unmodifiableList(siblings.subList(0, indexAmongSiblings));</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>ElementNode.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.xpath.ElementNode</mutatedClass>
<mutatedMethod>getAttributeNode</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator</mutator>
<description>Removed assignment to member variable attributeNode</description>
<lineContent>attributeNode = null;</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>ElementNode.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.xpath.ElementNode</mutatedClass>
<sourceFile>AbstractElementNode.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.xpath.AbstractElementNode</mutatedClass>
<mutatedMethod>iterateAxis</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.RemoveSwitchMutator_8</mutator>
<description>RemoveSwitch 8 mutation</description>
<lineContent>switch (axisNumber) {</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>DescendantIterator.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.xpath.iterators.DescendantIterator</mutatedClass>
<mutatedMethod>&lt;init&gt;</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator</mutator>
<description>Removed assignment to member variable descendantEnum</description>
<lineContent>descendantEnum = null;</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>FollowingIterator.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.xpath.iterators.FollowingIterator</mutatedClass>
Expand Down Expand Up @@ -90,42 +90,6 @@
<lineContent>return detailAst.getColumnNo();</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>RootNode.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.xpath.RootNode</mutatedClass>
<mutatedMethod>iterateAxis</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.RemoveSwitchMutator_1</mutator>
<description>RemoveSwitch 1 mutation</description>
<lineContent>switch (axisNumber) {</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>RootNode.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.xpath.RootNode</mutatedClass>
<mutatedMethod>iterateAxis</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.RemoveSwitchMutator_2</mutator>
<description>RemoveSwitch 2 mutation</description>
<lineContent>switch (axisNumber) {</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>RootNode.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.xpath.RootNode</mutatedClass>
<mutatedMethod>iterateAxis</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.RemoveSwitchMutator_5</mutator>
<description>RemoveSwitch 5 mutation</description>
<lineContent>switch (axisNumber) {</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>RootNode.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.xpath.RootNode</mutatedClass>
<mutatedMethod>iterateAxis</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.RemoveSwitchMutator_8</mutator>
<description>RemoveSwitch 8 mutation</description>
<lineContent>switch (axisNumber) {</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>XpathQueryGenerator.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.xpath.XpathQueryGenerator</mutatedClass>
Expand Down

0 comments on commit f07c620

Please sign in to comment.