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

Resolve Pitest Issues - JavadocMethodCheck (4) #7925

Closed
rnveach opened this issue Mar 20, 2020 · 4 comments · Fixed by #8008
Closed

Resolve Pitest Issues - JavadocMethodCheck (4) #7925

rnveach opened this issue Mar 20, 2020 · 4 comments · Fixed by #8008

Comments

@rnveach
Copy link
Member

rnveach commented Mar 20, 2020

Child issue of #7797 ,

"JavadocMethodCheck.java.html:<td class='covered'><pre><span class='survived'> if (child.getType() == TokenTypes.TYPE_PARAMETER) {</span></pre></td></tr>"

@hembhagat99
Copy link
Contributor

I am on it

@hembhagat99
Copy link
Contributor

hembhagat99 commented Apr 28, 2020

@rnveach
Pitest Report on clean checkstyle master

https://developerhb.github.io/Checkstyle/Issue%207295-PitestIssue-JavadocMethodCheck/pitest-report/202004281038/com.puppycrawl.tools.checkstyle.checks.javadoc/JavadocMethodCheck.java.html

For this issue the line is if (child.getType() == TokenTypes.TYPE_PARAMETER) {
and mutation is negated conditional → SURVIVED

I have hardcoded the mutation in a new branch and uploaded the branch to my forked checkstyle repo.


HardCoded Mutation - hembhagat99@50299fd


Pitest-Regression Report:
https://developerhb.github.io/pitest-regression/index.html

Here, mutation deals with Param Tags. So, I have used default configuration as the default value of allowMissingParamTags is false.

I have run the regression on three projects.

  1. checkstyle-sonar
  2. guava
  3. orekit

So far no changes are detected.

hembhagat99 added a commit to hembhagat99/checkstyle that referenced this issue Apr 28, 2020
@hembhagat99
Copy link
Contributor

@rnveach
I can probably explain why we don't need the following condition,
if (child.getType() == TokenTypes.TYPE_PARAMETER) {

Here is the full code of function which uses this condition,

private void processTypeParams(DetailAST ast) {
        final DetailAST params =
            ast.findFirstToken(TokenTypes.TYPE_PARAMETERS);

        final Map<String, ClassInfo> paramsMap = new HashMap<>();
        currentTypeParams.push(paramsMap);

        if (params != null) {
            for (DetailAST child = params.getFirstChild();
                 child != null;
                 child = child.getNextSibling()) {
                if (child.getType() != TokenTypes.TYPE_PARAMETER) {
                    final DetailAST bounds =
                        child.findFirstToken(TokenTypes.TYPE_UPPER_BOUNDS);
                    if (bounds != null) {
                        final FullIdent name =
                            FullIdent.createFullIdentBelow(bounds);
                        final ClassInfo classInfo =
                            createClassInfo(new Token(name), currentClassName);
                        final String alias =
                                child.findFirstToken(TokenTypes.IDENT).getText();
                        paramsMap.put(alias, classInfo);
                    }
                }
            }
        }
    }

TYPE_PARAMETERS can have following childs,

  1. GENERIC_START (<)
  2. TYPE_PARAMETER
  3. COMMA (,)
  4. GENERIC_END (>)

So, our condition checks whether the child is of type TYPE_PARAMETER. Only then we need to do the further process.

The next statement is,

final DetailAST bounds =
                        child.findFirstToken(TokenTypes.TYPE_UPPER_BOUNDS);
if (bounds != null) {

It gets the TYPE_UPPER_BOUNDS of the child and checks if its not null. In case of <, , and > it would lead to null. So, the child of TYPE_PARAMETERS other than TYPE_PARAMETER are filtered by the statement if(bound!=null) {.

So, we don't need the previous condition.

hembhagat99 added a commit to hembhagat99/checkstyle that referenced this issue May 17, 2020
@romani
Copy link
Member

romani commented May 19, 2020

fixed in scope of #7980

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants