DescendantTokenCheck.java

1
////////////////////////////////////////////////////////////////////////////////
2
// checkstyle: Checks Java source code for adherence to a set of rules.
3
// Copyright (C) 2001-2017 the original author or authors.
4
//
5
// This library is free software; you can redistribute it and/or
6
// modify it under the terms of the GNU Lesser General Public
7
// License as published by the Free Software Foundation; either
8
// version 2.1 of the License, or (at your option) any later version.
9
//
10
// This library is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
// Lesser General Public License for more details.
14
//
15
// You should have received a copy of the GNU Lesser General Public
16
// License along with this library; if not, write to the Free Software
17
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
////////////////////////////////////////////////////////////////////////////////
19
20
package com.puppycrawl.tools.checkstyle.checks;
21
22
import java.util.Arrays;
23
import java.util.Set;
24
25
import antlr.collections.AST;
26
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
27
import com.puppycrawl.tools.checkstyle.api.DetailAST;
28
import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
29
import com.puppycrawl.tools.checkstyle.utils.TokenUtils;
30
31
/**
32
 * <p>
33
 * Checks for restricted tokens beneath other tokens.
34
 * </p>
35
 * <p>
36
 * Examples of how to configure the check:
37
 * </p>
38
 * <pre>
39
 * &lt;!-- String literal equality check --&gt;
40
 * &lt;module name="DescendantToken"&gt;
41
 *     &lt;property name="tokens" value="EQUAL,NOT_EQUAL"/&gt;
42
 *     &lt;property name="limitedTokens" value="STRING_LITERAL"/&gt;
43
 *     &lt;property name="maximumNumber" value="0"/&gt;
44
 *     &lt;property name="maximumDepth" value="1"/&gt;
45
 * &lt;/module&gt;
46
 *
47
 * &lt;!-- Switch with no default --&gt;
48
 * &lt;module name="DescendantToken"&gt;
49
 *     &lt;property name="tokens" value="LITERAL_SWITCH"/&gt;
50
 *     &lt;property name="maximumDepth" value="2"/&gt;
51
 *     &lt;property name="limitedTokens" value="LITERAL_DEFAULT"/&gt;
52
 *     &lt;property name="minimumNumber" value="1"/&gt;
53
 * &lt;/module&gt;
54
 *
55
 * &lt;!-- Assert statement may have side effects --&gt;
56
 * &lt;module name="DescendantToken"&gt;
57
 *     &lt;property name="tokens" value="LITERAL_ASSERT"/&gt;
58
 *     &lt;property name="limitedTokens" value="ASSIGN,DEC,INC,POST_DEC,
59
 *     POST_INC,PLUS_ASSIGN,MINUS_ASSIGN,STAR_ASSIGN,DIV_ASSIGN,MOD_ASSIGN,
60
 *     BSR_ASSIGN,SR_ASSIGN,SL_ASSIGN,BAND_ASSIGN,BXOR_ASSIGN,BOR_ASSIGN,
61
 *     METHOD_CALL"/&gt;
62
 *     &lt;property name="maximumNumber" value="0"/&gt;
63
 * &lt;/module&gt;
64
 *
65
 * &lt;!-- Initializer in for performs no setup - use while instead? --&gt;
66
 * &lt;module name="DescendantToken"&gt;
67
 *     &lt;property name="tokens" value="FOR_INIT"/&gt;
68
 *     &lt;property name="limitedTokens" value="EXPR"/&gt;
69
 *     &lt;property name="minimumNumber" value="1"/&gt;
70
 * &lt;/module&gt;
71
 *
72
 * &lt;!-- Condition in for performs no check --&gt;
73
 * &lt;module name="DescendantToken"&gt;
74
 *     &lt;property name="tokens" value="FOR_CONDITION"/&gt;
75
 *     &lt;property name="limitedTokens" value="EXPR"/&gt;
76
 *     &lt;property name="minimumNumber" value="1"/&gt;
77
 * &lt;/module&gt;
78
 *
79
 * &lt;!-- Switch within switch --&gt;
80
 * &lt;module name="DescendantToken"&gt;
81
 *     &lt;property name="tokens" value="LITERAL_SWITCH"/&gt;
82
 *     &lt;property name="limitedTokens" value="LITERAL_SWITCH"/&gt;
83
 *     &lt;property name="maximumNumber" value="0"/&gt;
84
 *     &lt;property name="minimumDepth" value="1"/&gt;
85
 * &lt;/module&gt;
86
 *
87
 * &lt;!-- Return from within a catch or finally block --&gt;
88
 * &lt;module name="DescendantToken"&gt;
89
 *     &lt;property name="tokens" value="LITERAL_FINALLY,LITERAL_CATCH"/&gt;
90
 *     &lt;property name="limitedTokens" value="LITERAL_RETURN"/&gt;
91
 *     &lt;property name="maximumNumber" value="0"/&gt;
92
 * &lt;/module&gt;
93
 *
94
 * &lt;!-- Try within catch or finally block --&gt;
95
 * &lt;module name="DescendantToken"&gt;
96
 *     &lt;property name="tokens" value="LITERAL_CATCH,LITERAL_FINALLY"/&gt;
97
 *     &lt;property name="limitedTokens" value="LITERAL_TRY"/&gt;
98
 *     &lt;property name="maximumNumber" value="0"/&gt;
99
 * &lt;/module&gt;
100
 *
101
 * &lt;!-- Too many cases within a switch --&gt;
102
 * &lt;module name="DescendantToken"&gt;
103
 *     &lt;property name="tokens" value="LITERAL_SWITCH"/&gt;
104
 *     &lt;property name="limitedTokens" value="LITERAL_CASE"/&gt;
105
 *     &lt;property name="maximumDepth" value="2"/&gt;
106
 *     &lt;property name="maximumNumber" value="10"/&gt;
107
 * &lt;/module&gt;
108
 *
109
 * &lt;!-- Too many local variables within a method --&gt;
110
 * &lt;module name="DescendantToken"&gt;
111
 *     &lt;property name="tokens" value="METHOD_DEF"/&gt;
112
 *     &lt;property name="limitedTokens" value="VARIABLE_DEF"/&gt;
113
 *     &lt;property name="maximumDepth" value="2"/&gt;
114
 *     &lt;property name="maximumNumber" value="10"/&gt;
115
 * &lt;/module&gt;
116
 *
117
 * &lt;!-- Too many returns from within a method --&gt;
118
 * &lt;module name="DescendantToken"&gt;
119
 *     &lt;property name="tokens" value="METHOD_DEF"/&gt;
120
 *     &lt;property name="limitedTokens" value="LITERAL_RETURN"/&gt;
121
 *     &lt;property name="maximumNumber" value="3"/&gt;
122
 * &lt;/module&gt;
123
 *
124
 * &lt;!-- Too many fields within an interface --&gt;
125
 * &lt;module name="DescendantToken"&gt;
126
 *     &lt;property name="tokens" value="INTERFACE_DEF"/&gt;
127
 *     &lt;property name="limitedTokens" value="VARIABLE_DEF"/&gt;
128
 *     &lt;property name="maximumDepth" value="2"/&gt;
129
 *     &lt;property name="maximumNumber" value="0"/&gt;
130
 * &lt;/module&gt;
131
 *
132
 * &lt;!-- Limit the number of exceptions a method can throw --&gt;
133
 * &lt;module name="DescendantToken"&gt;
134
 *     &lt;property name="tokens" value="LITERAL_THROWS"/&gt;
135
 *     &lt;property name="limitedTokens" value="IDENT"/&gt;
136
 *     &lt;property name="maximumNumber" value="1"/&gt;
137
 * &lt;/module&gt;
138
 *
139
 * &lt;!-- Limit the number of expressions in a method --&gt;
140
 * &lt;module name="DescendantToken"&gt;
141
 *     &lt;property name="tokens" value="METHOD_DEF"/&gt;
142
 *     &lt;property name="limitedTokens" value="EXPR"/&gt;
143
 *     &lt;property name="maximumNumber" value="200"/&gt;
144
 * &lt;/module&gt;
145
 *
146
 * &lt;!-- Disallow empty statements --&gt;
147
 * &lt;module name="DescendantToken"&gt;
148
 *     &lt;property name="tokens" value="EMPTY_STAT"/&gt;
149
 *     &lt;property name="limitedTokens" value="EMPTY_STAT"/&gt;
150
 *     &lt;property name="maximumNumber" value="0"/&gt;
151
 *     &lt;property name="maximumDepth" value="0"/&gt;
152
 *     &lt;property name="maximumMessage"
153
 *         value="Empty statement is not allowed."/&gt;
154
 * &lt;/module&gt;
155
 *
156
 * &lt;!-- Too many fields within a class --&gt;
157
 * &lt;module name="DescendantToken"&gt;
158
 *     &lt;property name="tokens" value="CLASS_DEF"/&gt;
159
 *     &lt;property name="limitedTokens" value="VARIABLE_DEF"/&gt;
160
 *     &lt;property name="maximumDepth" value="2"/&gt;
161
 *     &lt;property name="maximumNumber" value="10"/&gt;
162
 * &lt;/module&gt;
163
 * </pre>
164
 *
165
 * @author Tim Tyler &lt;tim@tt1.org&gt;
166
 * @author Rick Giles
167
 */
168
public class DescendantTokenCheck extends AbstractCheck {
169
170
    /**
171
     * A key is pointing to the warning message text in "messages.properties"
172
     * file.
173
     */
174
    public static final String MSG_KEY_MIN = "descendant.token.min";
175
176
    /**
177
     * A key is pointing to the warning message text in "messages.properties"
178
     * file.
179
     */
180
    public static final String MSG_KEY_MAX = "descendant.token.max";
181
182
    /**
183
     * A key is pointing to the warning message text in "messages.properties"
184
     * file.
185
     */
186
    public static final String MSG_KEY_SUM_MIN = "descendant.token.sum.min";
187
188
    /**
189
     * A key is pointing to the warning message text in "messages.properties"
190
     * file.
191
     */
192
    public static final String MSG_KEY_SUM_MAX = "descendant.token.sum.max";
193
194
    /** Minimum depth. */
195
    private int minimumDepth;
196
    /** Maximum depth. */
197
    private int maximumDepth = Integer.MAX_VALUE;
198
    /** Minimum number. */
199
    private int minimumNumber;
200
    /** Maximum number. */
201
    private int maximumNumber = Integer.MAX_VALUE;
202
    /** Whether to sum the number of tokens found. */
203
    private boolean sumTokenCounts;
204
    /** Limited tokens. */
205
    private int[] limitedTokens = CommonUtils.EMPTY_INT_ARRAY;
206
    /** Error message when minimum count not reached. */
207
    private String minimumMessage;
208
    /** Error message when maximum count exceeded. */
209
    private String maximumMessage;
210
211
    /**
212
     * Counts of descendant tokens.
213
     * Indexed by (token ID - 1) for performance.
214
     */
215
    private int[] counts = CommonUtils.EMPTY_INT_ARRAY;
216
217
    @Override
218
    public int[] getDefaultTokens() {
219 1 1. getDefaultTokens : mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck::getDefaultTokens to ( if (x != null) null else throw new RuntimeException ) → KILLED
        return CommonUtils.EMPTY_INT_ARRAY;
220
    }
221
222
    @Override
223
    public int[] getRequiredTokens() {
224 1 1. getRequiredTokens : mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck::getRequiredTokens to ( if (x != null) null else throw new RuntimeException ) → KILLED
        return CommonUtils.EMPTY_INT_ARRAY;
225
    }
226
227
    @Override
228
    public void visitToken(DetailAST ast) {
229
        //reset counts
230 1 1. visitToken : removed call to java/util/Arrays::fill → KILLED
        Arrays.fill(counts, 0);
231 1 1. visitToken : removed call to com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck::countTokens → KILLED
        countTokens(ast, 0);
232
233 1 1. visitToken : negated conditional → KILLED
        if (sumTokenCounts) {
234 1 1. visitToken : removed call to com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck::logAsTotal → KILLED
            logAsTotal(ast);
235
        }
236
        else {
237 1 1. visitToken : removed call to com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck::logAsSeparated → KILLED
            logAsSeparated(ast);
238
        }
239
    }
240
241
    /**
242
     * Log violations for each Token.
243
     * @param ast token
244
     */
245
    private void logAsSeparated(DetailAST ast) {
246
        // name of this token
247
        final String name = TokenUtils.getTokenName(ast.getType());
248
249 3 1. logAsSeparated : changed conditional boundary → KILLED
2. logAsSeparated : Changed increment from 1 to -1 → KILLED
3. logAsSeparated : negated conditional → KILLED
        for (int element : limitedTokens) {
250 1 1. logAsSeparated : Replaced integer subtraction with addition → KILLED
            final int tokenCount = counts[element - 1];
251 2 1. logAsSeparated : changed conditional boundary → KILLED
2. logAsSeparated : negated conditional → KILLED
            if (tokenCount < minimumNumber) {
252
                final String descendantName = TokenUtils.getTokenName(element);
253
254 1 1. logAsSeparated : negated conditional → KILLED
                if (minimumMessage == null) {
255
                    minimumMessage = MSG_KEY_MIN;
256
                }
257 1 1. logAsSeparated : removed call to com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck::log → KILLED
                log(ast.getLineNo(), ast.getColumnNo(),
258
                        minimumMessage,
259
                        String.valueOf(tokenCount),
260
                        String.valueOf(minimumNumber),
261
                        name,
262
                        descendantName);
263
            }
264 2 1. logAsSeparated : changed conditional boundary → KILLED
2. logAsSeparated : negated conditional → KILLED
            if (tokenCount > maximumNumber) {
265
                final String descendantName = TokenUtils.getTokenName(element);
266
267 1 1. logAsSeparated : negated conditional → KILLED
                if (maximumMessage == null) {
268
                    maximumMessage = MSG_KEY_MAX;
269
                }
270 1 1. logAsSeparated : removed call to com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck::log → KILLED
                log(ast.getLineNo(), ast.getColumnNo(),
271
                        maximumMessage,
272
                        String.valueOf(tokenCount),
273
                        String.valueOf(maximumNumber),
274
                        name,
275
                        descendantName);
276
            }
277
        }
278
    }
279
280
    /**
281
     * Log validation as one violation.
282
     * @param ast current token
283
     */
284
    private void logAsTotal(DetailAST ast) {
285
        // name of this token
286
        final String name = TokenUtils.getTokenName(ast.getType());
287
288
        int total = 0;
289 3 1. logAsTotal : changed conditional boundary → KILLED
2. logAsTotal : Changed increment from 1 to -1 → KILLED
3. logAsTotal : negated conditional → KILLED
        for (int element : limitedTokens) {
290 2 1. logAsTotal : Replaced integer subtraction with addition → KILLED
2. logAsTotal : Replaced integer addition with subtraction → KILLED
            total += counts[element - 1];
291
        }
292 2 1. logAsTotal : changed conditional boundary → KILLED
2. logAsTotal : negated conditional → KILLED
        if (total < minimumNumber) {
293 1 1. logAsTotal : negated conditional → KILLED
            if (minimumMessage == null) {
294
                minimumMessage = MSG_KEY_SUM_MIN;
295
            }
296 1 1. logAsTotal : removed call to com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck::log → KILLED
            log(ast.getLineNo(), ast.getColumnNo(),
297
                    minimumMessage,
298
                    String.valueOf(total),
299
                    String.valueOf(minimumNumber), name);
300
        }
301 2 1. logAsTotal : changed conditional boundary → KILLED
2. logAsTotal : negated conditional → KILLED
        if (total > maximumNumber) {
302 1 1. logAsTotal : negated conditional → KILLED
            if (maximumMessage == null) {
303
                maximumMessage = MSG_KEY_SUM_MAX;
304
            }
305 1 1. logAsTotal : removed call to com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck::log → KILLED
            log(ast.getLineNo(), ast.getColumnNo(),
306
                    maximumMessage,
307
                    String.valueOf(total),
308
                    String.valueOf(maximumNumber), name);
309
        }
310
    }
311
312
    /**
313
     * Counts the number of occurrences of descendant tokens.
314
     * @param ast the root token for descendants.
315
     * @param depth the maximum depth of the counted descendants.
316
     */
317
    private void countTokens(AST ast, int depth) {
318 2 1. countTokens : changed conditional boundary → KILLED
2. countTokens : negated conditional → KILLED
        if (depth <= maximumDepth) {
319
            //update count
320 2 1. countTokens : changed conditional boundary → KILLED
2. countTokens : negated conditional → KILLED
            if (depth >= minimumDepth) {
321
                final int type = ast.getType();
322 2 1. countTokens : changed conditional boundary → KILLED
2. countTokens : negated conditional → KILLED
                if (type <= counts.length) {
323 2 1. countTokens : Replaced integer subtraction with addition → KILLED
2. countTokens : Replaced integer addition with subtraction → KILLED
                    counts[type - 1]++;
324
                }
325
            }
326
            AST child = ast.getFirstChild();
327 1 1. countTokens : Replaced integer addition with subtraction → KILLED
            final int nextDepth = depth + 1;
328 1 1. countTokens : negated conditional → KILLED
            while (child != null) {
329 1 1. countTokens : removed call to com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck::countTokens → KILLED
                countTokens(child, nextDepth);
330
                child = child.getNextSibling();
331
            }
332
        }
333
    }
334
335
    @Override
336
    public int[] getAcceptableTokens() {
337
        // Any tokens set by property 'tokens' are acceptable
338
        final Set<String> tokenNames = getTokenNames();
339
        final int[] result = new int[tokenNames.size()];
340
        int index = 0;
341 1 1. getAcceptableTokens : negated conditional → KILLED
        for (String name : tokenNames) {
342
            result[index] = TokenUtils.getTokenId(name);
343 1 1. getAcceptableTokens : Changed increment from 1 to -1 → KILLED
            index++;
344
        }
345 1 1. getAcceptableTokens : mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck::getAcceptableTokens to ( if (x != null) null else throw new RuntimeException ) → KILLED
        return result;
346
    }
347
348
    /**
349
     * Sets the tokens which occurrence as descendant is limited.
350
     * @param limitedTokensParam - list of tokens to ignore.
351
     */
352
    public void setLimitedTokens(String... limitedTokensParam) {
353
        limitedTokens = new int[limitedTokensParam.length];
354
355
        int maxToken = 0;
356 3 1. setLimitedTokens : changed conditional boundary → KILLED
2. setLimitedTokens : Changed increment from 1 to -1 → KILLED
3. setLimitedTokens : negated conditional → KILLED
        for (int i = 0; i < limitedTokensParam.length; i++) {
357
            limitedTokens[i] = TokenUtils.getTokenId(limitedTokensParam[i]);
358 3 1. setLimitedTokens : changed conditional boundary → KILLED
2. setLimitedTokens : Replaced integer addition with subtraction → KILLED
3. setLimitedTokens : negated conditional → KILLED
            if (limitedTokens[i] >= maxToken + 1) {
359
                maxToken = limitedTokens[i];
360
            }
361
        }
362
        counts = new int[maxToken];
363
    }
364
365
    /**
366
     * Sets the minimum depth for descendant counts.
367
     * @param minimumDepth the minimum depth for descendant counts.
368
     */
369
    public void setMinimumDepth(int minimumDepth) {
370
        this.minimumDepth = minimumDepth;
371
    }
372
373
    /**
374
     * Sets the maximum depth for descendant counts.
375
     * @param maximumDepth the maximum depth for descendant counts.
376
     */
377
    public void setMaximumDepth(int maximumDepth) {
378
        this.maximumDepth = maximumDepth;
379
    }
380
381
    /**
382
     * Sets a minimum count for descendants.
383
     * @param minimumNumber the minimum count for descendants.
384
     */
385
    public void setMinimumNumber(int minimumNumber) {
386
        this.minimumNumber = minimumNumber;
387
    }
388
389
    /**
390
      * Sets a maximum count for descendants.
391
      * @param maximumNumber the maximum count for descendants.
392
      */
393
    public void setMaximumNumber(int maximumNumber) {
394
        this.maximumNumber = maximumNumber;
395
    }
396
397
    /**
398
     * Sets the error message for minimum count not reached.
399
     * @param message the error message for minimum count not reached.
400
     *     Used as a {@code MessageFormat} pattern with arguments
401
     *     <ul>
402
     *     <li>{0} - token count</li>
403
     *     <li>{1} - minimum number</li>
404
     *     <li>{2} - name of token</li>
405
     *     <li>{3} - name of limited token</li>
406
     *     </ul>
407
     */
408
    public void setMinimumMessage(String message) {
409
        minimumMessage = message;
410
    }
411
412
    /**
413
     * Sets the error message for maximum count exceeded.
414
     * @param message the error message for maximum count exceeded.
415
     *     Used as a {@code MessageFormat} pattern with arguments
416
     * <ul>
417
     * <li>{0} - token count</li>
418
     * <li>{1} - maximum number</li>
419
     * <li>{2} - name of token</li>
420
     * <li>{3} - name of limited token</li>
421
     * </ul>
422
     */
423
424
    public void setMaximumMessage(String message) {
425
        maximumMessage = message;
426
    }
427
428
    /**
429
     * Sets whether to use the sum of the tokens found, rather than the
430
     * individual counts.
431
     * @param sum whether to use the sum.
432
     */
433
    public void setSumTokenCounts(boolean sum) {
434
        sumTokenCounts = sum;
435
    }
436
}

Mutations

219

1.1
Location : getDefaultTokens
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testDefault(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck::getDefaultTokens to ( if (x != null) null else throw new RuntimeException ) → KILLED

224

1.1
Location : getRequiredTokens
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testDefault(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck::getRequiredTokens to ( if (x != null) null else throw new RuntimeException ) → KILLED

230

1.1
Location : visitToken
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testMissingSwitchDefault(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
removed call to java/util/Arrays::fill → KILLED

231

1.1
Location : visitToken
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenNative(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
removed call to com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck::countTokens → KILLED

233

1.1
Location : visitToken
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testMaxTokenTypeReverseOrder(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
negated conditional → KILLED

234

1.1
Location : visitToken
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testWithSumLessThenMinCustomMsg(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
removed call to com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck::logAsTotal → KILLED

237

1.1
Location : visitToken
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenNative(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
removed call to com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck::logAsSeparated → KILLED

249

1.1
Location : logAsSeparated
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenNative(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
changed conditional boundary → KILLED

2.2
Location : logAsSeparated
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenNative(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
Changed increment from 1 to -1 → KILLED

3.3
Location : logAsSeparated
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenNative(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
negated conditional → KILLED

250

1.1
Location : logAsSeparated
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenNative(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
Replaced integer subtraction with addition → KILLED

251

1.1
Location : logAsSeparated
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testMinimumDepth(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
changed conditional boundary → KILLED

2.2
Location : logAsSeparated
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenNative(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
negated conditional → KILLED

254

1.1
Location : logAsSeparated
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testMinimumNumber(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
negated conditional → KILLED

257

1.1
Location : logAsSeparated
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testMinimumNumber(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
removed call to com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck::log → KILLED

264

1.1
Location : logAsSeparated
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testMinimumDepth(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
changed conditional boundary → KILLED

2.2
Location : logAsSeparated
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenNative(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
negated conditional → KILLED

267

1.1
Location : logAsSeparated
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenNative(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
negated conditional → KILLED

270

1.1
Location : logAsSeparated
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenNative(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
removed call to com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck::log → KILLED

289

1.1
Location : logAsTotal
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testWithSumLessThenMinCustomMsg(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
changed conditional boundary → KILLED

2.2
Location : logAsTotal
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testWithSumLessThenMinCustomMsg(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
Changed increment from 1 to -1 → KILLED

3.3
Location : logAsTotal
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testWithSumLessThenMinDefMsg(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
negated conditional → KILLED

290

1.1
Location : logAsTotal
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testWithSumLessThenMinCustomMsg(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
Replaced integer subtraction with addition → KILLED

2.2
Location : logAsTotal
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testWithSumLessThenMinDefMsg(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
Replaced integer addition with subtraction → KILLED

292

1.1
Location : logAsTotal
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testWithSumDefaultMsg(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
changed conditional boundary → KILLED

2.2
Location : logAsTotal
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testWithSumLessThenMinCustomMsg(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
negated conditional → KILLED

293

1.1
Location : logAsTotal
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testWithSumLessThenMinCustomMsg(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
negated conditional → KILLED

296

1.1
Location : logAsTotal
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testWithSumLessThenMinCustomMsg(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
removed call to com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck::log → KILLED

301

1.1
Location : logAsTotal
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testWithSumDefaultMsg(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
changed conditional boundary → KILLED

2.2
Location : logAsTotal
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testWithSumLessThenMinCustomMsg(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
negated conditional → KILLED

302

1.1
Location : logAsTotal
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testWithSumDefaultMsg(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
negated conditional → KILLED

305

1.1
Location : logAsTotal
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testWithSumDefaultMsg(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
removed call to com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck::log → KILLED

318

1.1
Location : countTokens
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenNative(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
changed conditional boundary → KILLED

2.2
Location : countTokens
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenNative(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
negated conditional → KILLED

320

1.1
Location : countTokens
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenNative(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
changed conditional boundary → KILLED

2.2
Location : countTokens
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenNative(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
negated conditional → KILLED

322

1.1
Location : countTokens
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenNative(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
changed conditional boundary → KILLED

2.2
Location : countTokens
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenNative(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
negated conditional → KILLED

323

1.1
Location : countTokens
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenNative(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
Replaced integer subtraction with addition → KILLED

2.2
Location : countTokens
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenNative(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
Replaced integer addition with subtraction → KILLED

327

1.1
Location : countTokens
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testMaxTokenTypeReverseOrder(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
Replaced integer addition with subtraction → KILLED

328

1.1
Location : countTokens
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenNative(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
negated conditional → KILLED

329

1.1
Location : countTokens
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testMaxTokenTypeReverseOrder(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
removed call to com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck::countTokens → KILLED

341

1.1
Location : getAcceptableTokens
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenNative(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
negated conditional → KILLED

343

1.1
Location : getAcceptableTokens
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenDefault(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
Changed increment from 1 to -1 → KILLED

345

1.1
Location : getAcceptableTokens
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenNative(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck::getAcceptableTokens to ( if (x != null) null else throw new RuntimeException ) → KILLED

356

1.1
Location : setLimitedTokens
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenNative(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
changed conditional boundary → KILLED

2.2
Location : setLimitedTokens
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenNative(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
Changed increment from 1 to -1 → KILLED

3.3
Location : setLimitedTokens
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenNative(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
negated conditional → KILLED

358

1.1
Location : setLimitedTokens
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testMaxTokenType(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
changed conditional boundary → KILLED

2.2
Location : setLimitedTokens
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testMaxTokenTypeReverseOrder(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
Replaced integer addition with subtraction → KILLED

3.3
Location : setLimitedTokens
Killed by : com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest.testIllegalTokenNative(com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheckTest)
negated conditional → KILLED

Active mutators

Tests examined


Report generated by PIT 1.2.2