NoWhitespaceAfterCheck.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.whitespace;
21
22
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
23
import com.puppycrawl.tools.checkstyle.api.DetailAST;
24
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
25
import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
26
27
/**
28
 * <p>
29
 * Checks that there is no whitespace after a token.
30
 * More specifically, it checks that it is not followed by whitespace,
31
 * or (if linebreaks are allowed) all characters on the line after are
32
 * whitespace. To forbid linebreaks after a token, set property
33
 * allowLineBreaks to false.
34
 * </p>
35
  * <p> By default the check will check the following operators:
36
 *  {@link TokenTypes#ARRAY_INIT ARRAY_INIT},
37
 *  {@link TokenTypes#AT AT},
38
 *  {@link TokenTypes#BNOT BNOT},
39
 *  {@link TokenTypes#DEC DEC},
40
 *  {@link TokenTypes#DOT DOT},
41
 *  {@link TokenTypes#INC INC},
42
 *  {@link TokenTypes#LNOT LNOT},
43
 *  {@link TokenTypes#UNARY_MINUS UNARY_MINUS},
44
 *  {@link TokenTypes#UNARY_PLUS UNARY_PLUS},
45
 *  {@link TokenTypes#TYPECAST TYPECAST},
46
 *  {@link TokenTypes#ARRAY_DECLARATOR ARRAY_DECLARATOR},
47
 *  {@link TokenTypes#INDEX_OP INDEX_OP}.
48
 * </p>
49
 * <p>
50
 * The check processes
51
 * {@link TokenTypes#ARRAY_DECLARATOR ARRAY_DECLARATOR},
52
 * {@link TokenTypes#INDEX_OP INDEX_OP}
53
 * specially from other tokens. Actually it is checked that there is
54
 * no whitespace before this tokens, not after them.
55
 * Spaces after the {@link TokenTypes#ANNOTATIONS ANNOTATIONS}
56
 * before {@link TokenTypes#ARRAY_DECLARATOR ARRAY_DECLARATOR}
57
 * and {@link TokenTypes#INDEX_OP INDEX_OP} will be ignored.
58
 * </p>
59
 * <p>
60
 * An example of how to configure the check is:
61
 * </p>
62
 * <pre>
63
 * &lt;module name="NoWhitespaceAfter"/&gt;
64
 * </pre>
65
 * <p> An example of how to configure the check to forbid linebreaks after
66
 * a {@link TokenTypes#DOT DOT} token is:
67
 * </p>
68
 * <pre>
69
 * &lt;module name="NoWhitespaceAfter"&gt;
70
 *     &lt;property name="tokens" value="DOT"/&gt;
71
 *     &lt;property name="allowLineBreaks" value="false"/&gt;
72
 * &lt;/module&gt;
73
 * </pre>
74
 * <p>
75
 * If the annotation is between the type and the array, the check will skip validation for spaces:
76
 * </p>
77
 * <pre>
78
 * public void foo(final char @NotNull [] param) {} // No violation
79
 * </pre>
80
 * @author Rick Giles
81
 * @author lkuehne
82
 * @author <a href="mailto:nesterenko-aleksey@list.ru">Aleksey Nesterenko</a>
83
 * @author attatrol
84
 */
85
public class NoWhitespaceAfterCheck extends AbstractCheck {
86
87
    /**
88
     * A key is pointing to the warning message text in "messages.properties"
89
     * file.
90
     */
91
    public static final String MSG_KEY = "ws.followed";
92
93
    /** Whether whitespace is allowed if the AST is at a linebreak. */
94
    private boolean allowLineBreaks = true;
95
96
    @Override
97
    public int[] getDefaultTokens() {
98 1 1. getDefaultTokens : mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck::getDefaultTokens to ( if (x != null) null else throw new RuntimeException ) → KILLED
        return new int[] {
99
            TokenTypes.ARRAY_INIT,
100
            TokenTypes.AT,
101
            TokenTypes.INC,
102
            TokenTypes.DEC,
103
            TokenTypes.UNARY_MINUS,
104
            TokenTypes.UNARY_PLUS,
105
            TokenTypes.BNOT,
106
            TokenTypes.LNOT,
107
            TokenTypes.DOT,
108
            TokenTypes.ARRAY_DECLARATOR,
109
            TokenTypes.INDEX_OP,
110
        };
111
    }
112
113
    @Override
114
    public int[] getAcceptableTokens() {
115 1 1. getAcceptableTokens : mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck::getAcceptableTokens to ( if (x != null) null else throw new RuntimeException ) → KILLED
        return new int[] {
116
            TokenTypes.ARRAY_INIT,
117
            TokenTypes.AT,
118
            TokenTypes.INC,
119
            TokenTypes.DEC,
120
            TokenTypes.UNARY_MINUS,
121
            TokenTypes.UNARY_PLUS,
122
            TokenTypes.BNOT,
123
            TokenTypes.LNOT,
124
            TokenTypes.DOT,
125
            TokenTypes.TYPECAST,
126
            TokenTypes.ARRAY_DECLARATOR,
127
            TokenTypes.INDEX_OP,
128
            TokenTypes.LITERAL_SYNCHRONIZED,
129
            TokenTypes.METHOD_REF,
130
        };
131
    }
132
133
    @Override
134
    public int[] getRequiredTokens() {
135 1 1. getRequiredTokens : mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck::getRequiredTokens to ( if (x != null) null else throw new RuntimeException ) → KILLED
        return CommonUtils.EMPTY_INT_ARRAY;
136
    }
137
138
    /**
139
     * Control whether whitespace is flagged at linebreaks.
140
     * @param allowLineBreaks whether whitespace should be
141
     *     flagged at linebreaks.
142
     */
143
    public void setAllowLineBreaks(boolean allowLineBreaks) {
144
        this.allowLineBreaks = allowLineBreaks;
145
    }
146
147
    @Override
148
    public void visitToken(DetailAST ast) {
149
        final DetailAST whitespaceFollowedAst = getWhitespaceFollowedNode(ast);
150
151 1 1. visitToken : negated conditional → KILLED
        if (whitespaceFollowedAst.getNextSibling() == null
152 1 1. visitToken : negated conditional → KILLED
                || whitespaceFollowedAst.getNextSibling().getType() != TokenTypes.ANNOTATIONS) {
153
            final int whitespaceColumnNo = getPositionAfter(whitespaceFollowedAst);
154
            final int whitespaceLineNo = whitespaceFollowedAst.getLineNo();
155
156 1 1. visitToken : negated conditional → KILLED
            if (hasTrailingWhitespace(ast, whitespaceColumnNo, whitespaceLineNo)) {
157 1 1. visitToken : removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck::log → KILLED
                log(whitespaceLineNo, whitespaceColumnNo,
158
                        MSG_KEY, whitespaceFollowedAst.getText());
159
            }
160
        }
161
    }
162
163
    /**
164
     * For a visited ast node returns node that should be checked
165
     * for not being followed by whitespace.
166
     * @param ast
167
     *        , visited node.
168
     * @return node before ast.
169
     */
170
    private static DetailAST getWhitespaceFollowedNode(DetailAST ast) {
171
        final DetailAST whitespaceFollowedAst;
172
        switch (ast.getType()) {
173
            case TokenTypes.TYPECAST:
174
                whitespaceFollowedAst = ast.findFirstToken(TokenTypes.RPAREN);
175
                break;
176
            case TokenTypes.ARRAY_DECLARATOR:
177
                whitespaceFollowedAst = getArrayDeclaratorPreviousElement(ast);
178
                break;
179
            case TokenTypes.INDEX_OP:
180
                whitespaceFollowedAst = getIndexOpPreviousElement(ast);
181
                break;
182
            default:
183
                whitespaceFollowedAst = ast;
184
        }
185 1 1. getWhitespaceFollowedNode : mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck::getWhitespaceFollowedNode to ( if (x != null) null else throw new RuntimeException ) → KILLED
        return whitespaceFollowedAst;
186
    }
187
188
    /**
189
     * Gets position after token (place of possible redundant whitespace).
190
     * @param ast Node representing token.
191
     * @return position after token.
192
     */
193
    private static int getPositionAfter(DetailAST ast) {
194
        final int after;
195
        //If target of possible redundant whitespace is in method definition.
196 1 1. getPositionAfter : negated conditional → KILLED
        if (ast.getType() == TokenTypes.IDENT
197 1 1. getPositionAfter : negated conditional → KILLED
                && ast.getNextSibling() != null
198 1 1. getPositionAfter : negated conditional → KILLED
                && ast.getNextSibling().getType() == TokenTypes.LPAREN) {
199
            final DetailAST methodDef = ast.getParent();
200
            final DetailAST endOfParams = methodDef.findFirstToken(TokenTypes.RPAREN);
201 1 1. getPositionAfter : Replaced integer addition with subtraction → KILLED
            after = endOfParams.getColumnNo() + 1;
202
        }
203
        else {
204 1 1. getPositionAfter : Replaced integer addition with subtraction → KILLED
            after = ast.getColumnNo() + ast.getText().length();
205
        }
206 1 1. getPositionAfter : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED
        return after;
207
    }
208
209
    /**
210
     * Checks if there is unwanted whitespace after the visited node.
211
     * @param ast
212
     *        , visited node.
213
     * @param whitespaceColumnNo
214
     *        , column number of a possible whitespace.
215
     * @param whitespaceLineNo
216
     *        , line number of a possible whitespace.
217
     * @return true if whitespace found.
218
     */
219
    private boolean hasTrailingWhitespace(DetailAST ast,
220
        int whitespaceColumnNo, int whitespaceLineNo) {
221
        final boolean result;
222
        final int astLineNo = ast.getLineNo();
223 1 1. hasTrailingWhitespace : Replaced integer subtraction with addition → KILLED
        final String line = getLine(astLineNo - 1);
224 3 1. hasTrailingWhitespace : changed conditional boundary → KILLED
2. hasTrailingWhitespace : negated conditional → KILLED
3. hasTrailingWhitespace : negated conditional → KILLED
        if (astLineNo == whitespaceLineNo && whitespaceColumnNo < line.length()) {
225
            result = Character.isWhitespace(line.charAt(whitespaceColumnNo));
226
        }
227
        else {
228 1 1. hasTrailingWhitespace : negated conditional → KILLED
            result = !allowLineBreaks;
229
        }
230 1 1. hasTrailingWhitespace : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED
        return result;
231
    }
232
233
    /**
234
     * Returns proper argument for getPositionAfter method, it is a token after
235
     * {@link TokenTypes#ARRAY_DECLARATOR ARRAY_DECLARATOR}, in can be {@link TokenTypes#RBRACK
236
     * RBRACK}, {@link TokenTypes#IDENT IDENT} or an array type definition (literal).
237
     * @param ast
238
     *        , {@link TokenTypes#ARRAY_DECLARATOR ARRAY_DECLARATOR} node.
239
     * @return previous node by text order.
240
     */
241
    private static DetailAST getArrayDeclaratorPreviousElement(DetailAST ast) {
242
        final DetailAST previousElement;
243
        final DetailAST firstChild = ast.getFirstChild();
244 1 1. getArrayDeclaratorPreviousElement : negated conditional → KILLED
        if (firstChild.getType() == TokenTypes.ARRAY_DECLARATOR) {
245
            // second or higher array index
246
            previousElement = firstChild.findFirstToken(TokenTypes.RBRACK);
247
        }
248
        else {
249
            // first array index, is preceded with identifier or type
250
            final DetailAST parent = getFirstNonArrayDeclaratorParent(ast);
251
            switch (parent.getType()) {
252
                // generics
253
                case TokenTypes.TYPE_ARGUMENT:
254
                    final DetailAST wildcard = parent.findFirstToken(TokenTypes.WILDCARD_TYPE);
255 1 1. getArrayDeclaratorPreviousElement : negated conditional → KILLED
                    if (wildcard == null) {
256
                        // usual generic type argument like <char[]>
257
                        previousElement = getTypeLastNode(ast);
258
                    }
259
                    else {
260
                        // constructions with wildcard like <? extends String[]>
261
                        previousElement = getTypeLastNode(ast.getFirstChild());
262
                    }
263
                    break;
264
                // 'new' is a special case with its own subtree structure
265
                case TokenTypes.LITERAL_NEW:
266
                    previousElement = getTypeLastNode(parent);
267
                    break;
268
                // mundane array declaration, can be either java style or C style
269
                case TokenTypes.TYPE:
270
                    previousElement = getPreviousNodeWithParentOfTypeAst(ast, parent);
271
                    break;
272
                // i.e. boolean[].class
273
                case TokenTypes.DOT:
274
                    previousElement = getTypeLastNode(ast);
275
                    break;
276
                // java 8 method reference
277
                case TokenTypes.METHOD_REF:
278
                    final DetailAST ident = getIdentLastToken(ast);
279 1 1. getArrayDeclaratorPreviousElement : negated conditional → KILLED
                    if (ident == null) {
280
                        //i.e. int[]::new
281
                        previousElement = ast.getFirstChild();
282
                    }
283
                    else {
284
                        previousElement = ident;
285
                    }
286
                    break;
287
                default:
288
                    throw new IllegalStateException("unexpected ast syntax " + parent);
289
            }
290
        }
291 1 1. getArrayDeclaratorPreviousElement : mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck::getArrayDeclaratorPreviousElement to ( if (x != null) null else throw new RuntimeException ) → KILLED
        return previousElement;
292
    }
293
294
    /**
295
     * Gets previous node for {@link TokenTypes#INDEX_OP INDEX_OP} token
296
     * for usage in getPositionAfter method, it is a simplified copy of
297
     * getArrayDeclaratorPreviousElement method.
298
     * @param ast
299
     *        , {@link TokenTypes#INDEX_OP INDEX_OP} node.
300
     * @return previous node by text order.
301
     */
302
    private static DetailAST getIndexOpPreviousElement(DetailAST ast) {
303
        final DetailAST result;
304
        final DetailAST firstChild = ast.getFirstChild();
305 1 1. getIndexOpPreviousElement : negated conditional → KILLED
        if (firstChild.getType() == TokenTypes.INDEX_OP) {
306
            // second or higher array index
307
            result = firstChild.findFirstToken(TokenTypes.RBRACK);
308
        }
309
        else {
310
            final DetailAST ident = getIdentLastToken(ast);
311 1 1. getIndexOpPreviousElement : negated conditional → KILLED
            if (ident == null) {
312
                final DetailAST rparen = ast.findFirstToken(TokenTypes.RPAREN);
313
                // construction like new int[]{1}[0]
314 1 1. getIndexOpPreviousElement : negated conditional → KILLED
                if (rparen == null) {
315
                    final DetailAST lastChild = firstChild.getLastChild();
316
                    result = lastChild.findFirstToken(TokenTypes.RCURLY);
317
                }
318
                // construction like ((byte[]) pixels)[0]
319
                else {
320
                    result = rparen;
321
                }
322
            }
323
            else {
324
                result = ident;
325
            }
326
        }
327 1 1. getIndexOpPreviousElement : mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck::getIndexOpPreviousElement to ( if (x != null) null else throw new RuntimeException ) → KILLED
        return result;
328
    }
329
330
    /**
331
     * Get node that owns {@link TokenTypes#ARRAY_DECLARATOR ARRAY_DECLARATOR} sequence.
332
     * @param ast
333
     *        , {@link TokenTypes#ARRAY_DECLARATOR ARRAY_DECLARATOR} node.
334
     * @return owner node.
335
     */
336
    private static DetailAST getFirstNonArrayDeclaratorParent(DetailAST ast) {
337
        DetailAST parent = ast.getParent();
338 1 1. getFirstNonArrayDeclaratorParent : negated conditional → KILLED
        while (parent.getType() == TokenTypes.ARRAY_DECLARATOR) {
339
            parent = parent.getParent();
340
        }
341 1 1. getFirstNonArrayDeclaratorParent : mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck::getFirstNonArrayDeclaratorParent to ( if (x != null) null else throw new RuntimeException ) → KILLED
        return parent;
342
    }
343
344
    /**
345
     * Searches parameter node for a type node.
346
     * Returns it or its last node if it has an extended structure.
347
     * @param ast
348
     *        , subject node.
349
     * @return type node.
350
     */
351
    private static DetailAST getTypeLastNode(DetailAST ast) {
352
        DetailAST result = ast.findFirstToken(TokenTypes.TYPE_ARGUMENTS);
353 1 1. getTypeLastNode : negated conditional → KILLED
        if (result == null) {
354
            result = getIdentLastToken(ast);
355 1 1. getTypeLastNode : negated conditional → KILLED
            if (result == null) {
356
                //primitive literal expected
357
                result = ast.getFirstChild();
358
            }
359
        }
360
        else {
361
            result = result.findFirstToken(TokenTypes.GENERIC_END);
362
        }
363 1 1. getTypeLastNode : mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck::getTypeLastNode to ( if (x != null) null else throw new RuntimeException ) → KILLED
        return result;
364
    }
365
366
    /**
367
     * Finds previous node by text order for an array declarator,
368
     * which parent type is {@link TokenTypes#TYPE TYPE}.
369
     * @param ast
370
     *        , array declarator node.
371
     * @param parent
372
     *        , its parent node.
373
     * @return previous node by text order.
374
     */
375
    private static DetailAST getPreviousNodeWithParentOfTypeAst(DetailAST ast, DetailAST parent) {
376
        final DetailAST previousElement;
377
        final DetailAST ident = getIdentLastToken(parent.getParent());
378
        final DetailAST lastTypeNode = getTypeLastNode(ast);
379
        // sometimes there are ident-less sentences
380
        // i.e. "(Object[]) null", but in casual case should be
381
        // checked whether ident or lastTypeNode has preceding position
382
        // determining if it is java style or C style
383 3 1. getPreviousNodeWithParentOfTypeAst : changed conditional boundary → KILLED
2. getPreviousNodeWithParentOfTypeAst : negated conditional → KILLED
3. getPreviousNodeWithParentOfTypeAst : negated conditional → KILLED
        if (ident == null || ident.getLineNo() > ast.getLineNo()) {
384
            previousElement = lastTypeNode;
385
        }
386 2 1. getPreviousNodeWithParentOfTypeAst : changed conditional boundary → KILLED
2. getPreviousNodeWithParentOfTypeAst : negated conditional → KILLED
        else if (ident.getLineNo() < ast.getLineNo()) {
387
            previousElement = ident;
388
        }
389
        //ident and lastTypeNode lay on one line
390
        else {
391 3 1. getPreviousNodeWithParentOfTypeAst : changed conditional boundary → SURVIVED
2. getPreviousNodeWithParentOfTypeAst : Replaced integer addition with subtraction → KILLED
3. getPreviousNodeWithParentOfTypeAst : negated conditional → KILLED
            if (ident.getColumnNo() >= ast.getColumnNo() + 1
392 2 1. getPreviousNodeWithParentOfTypeAst : changed conditional boundary → SURVIVED
2. getPreviousNodeWithParentOfTypeAst : negated conditional → KILLED
                || lastTypeNode.getColumnNo() > ident.getColumnNo()) {
393
                previousElement = lastTypeNode;
394
            }
395
            else {
396
                previousElement = ident;
397
            }
398
        }
399 1 1. getPreviousNodeWithParentOfTypeAst : mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck::getPreviousNodeWithParentOfTypeAst to ( if (x != null) null else throw new RuntimeException ) → KILLED
        return previousElement;
400
    }
401
402
    /**
403
     * Gets leftmost token of identifier.
404
     * @param ast
405
     *        , token possibly possessing an identifier.
406
     * @return leftmost token of identifier.
407
     */
408
    private static DetailAST getIdentLastToken(DetailAST ast) {
409
        // single identifier token as a name is the most common case
410
        DetailAST result = ast.findFirstToken(TokenTypes.IDENT);
411 1 1. getIdentLastToken : negated conditional → KILLED
        if (result == null) {
412
            final DetailAST dot = ast.findFirstToken(TokenTypes.DOT);
413
            // method call case
414 1 1. getIdentLastToken : negated conditional → KILLED
            if (dot == null) {
415
                final DetailAST methodCall = ast.findFirstToken(TokenTypes.METHOD_CALL);
416 1 1. getIdentLastToken : negated conditional → KILLED
                if (methodCall != null) {
417
                    result = methodCall.findFirstToken(TokenTypes.RPAREN);
418
                }
419
            }
420
            // qualified name case
421
            else {
422 1 1. getIdentLastToken : negated conditional → KILLED
                if (dot.findFirstToken(TokenTypes.DOT) == null) {
423
                    result = dot.getFirstChild().getNextSibling();
424
                }
425
                else {
426
                    result = dot.findFirstToken(TokenTypes.IDENT);
427
                }
428
            }
429
        }
430 1 1. getIdentLastToken : mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck::getIdentLastToken to ( if (x != null) null else throw new RuntimeException ) → KILLED
        return result;
431
    }
432
433
}

Mutations

98

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

115

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

135

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

151

1.1
Location : visitToken
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testArrayDeclarations3(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

152

1.1
Location : visitToken
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testSynchronized(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

156

1.1
Location : visitToken
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testSynchronized(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

157

1.1
Location : visitToken
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testSynchronized(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck::log → KILLED

185

1.1
Location : getWhitespaceFollowedNode
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testSynchronized(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck::getWhitespaceFollowedNode to ( if (x != null) null else throw new RuntimeException ) → KILLED

196

1.1
Location : getPositionAfter
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testArrayDeclarations2(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

197

1.1
Location : getPositionAfter
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testArrayDeclarations2(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

198

1.1
Location : getPositionAfter
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testMethodReference(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

201

1.1
Location : getPositionAfter
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testArrayDeclarations2(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
Replaced integer addition with subtraction → KILLED

204

1.1
Location : getPositionAfter
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testSynchronized(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
Replaced integer addition with subtraction → KILLED

206

1.1
Location : getPositionAfter
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testSynchronized(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED

223

1.1
Location : hasTrailingWhitespace
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testSynchronized(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
Replaced integer subtraction with addition → KILLED

224

1.1
Location : hasTrailingWhitespace
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testSynchronized(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
changed conditional boundary → KILLED

2.2
Location : hasTrailingWhitespace
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testSynchronized(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

3.3
Location : hasTrailingWhitespace
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testSynchronized(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

228

1.1
Location : hasTrailingWhitespace
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testSynchronized(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

230

1.1
Location : hasTrailingWhitespace
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testSynchronized(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED

244

1.1
Location : getArrayDeclaratorPreviousElement
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testVisitTokenSwitchReflection(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

255

1.1
Location : getArrayDeclaratorPreviousElement
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testMethodReference(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

279

1.1
Location : getArrayDeclaratorPreviousElement
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testMethodReference(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

291

1.1
Location : getArrayDeclaratorPreviousElement
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testArrayDeclarations3(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck::getArrayDeclaratorPreviousElement to ( if (x != null) null else throw new RuntimeException ) → KILLED

305

1.1
Location : getIndexOpPreviousElement
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testArrayDeclarations2(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

311

1.1
Location : getIndexOpPreviousElement
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testArrayDeclarations2(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

314

1.1
Location : getIndexOpPreviousElement
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testArrayDeclarations2(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

327

1.1
Location : getIndexOpPreviousElement
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testArrayDeclarations2(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck::getIndexOpPreviousElement to ( if (x != null) null else throw new RuntimeException ) → KILLED

338

1.1
Location : getFirstNonArrayDeclaratorParent
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testVisitTokenSwitchReflection(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

341

1.1
Location : getFirstNonArrayDeclaratorParent
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testVisitTokenSwitchReflection(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck::getFirstNonArrayDeclaratorParent to ( if (x != null) null else throw new RuntimeException ) → KILLED

353

1.1
Location : getTypeLastNode
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testArrayDeclarations3(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

355

1.1
Location : getTypeLastNode
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testArrayDeclarations3(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

363

1.1
Location : getTypeLastNode
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testArrayDeclarations3(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck::getTypeLastNode to ( if (x != null) null else throw new RuntimeException ) → KILLED

383

1.1
Location : getPreviousNodeWithParentOfTypeAst
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testArrayDeclarations2(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
changed conditional boundary → KILLED

2.2
Location : getPreviousNodeWithParentOfTypeAst
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testArrayDeclarations2(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

3.3
Location : getPreviousNodeWithParentOfTypeAst
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testArrayDeclarations2(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

386

1.1
Location : getPreviousNodeWithParentOfTypeAst
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testNpe(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
changed conditional boundary → KILLED

2.2
Location : getPreviousNodeWithParentOfTypeAst
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testNpe(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

391

1.1
Location : getPreviousNodeWithParentOfTypeAst
Killed by : none
changed conditional boundary → SURVIVED

2.2
Location : getPreviousNodeWithParentOfTypeAst
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testArrayDeclarations2(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
Replaced integer addition with subtraction → KILLED

3.3
Location : getPreviousNodeWithParentOfTypeAst
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testNpe(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

392

1.1
Location : getPreviousNodeWithParentOfTypeAst
Killed by : none
changed conditional boundary → SURVIVED

2.2
Location : getPreviousNodeWithParentOfTypeAst
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testArrayDeclarations2(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

399

1.1
Location : getPreviousNodeWithParentOfTypeAst
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testArrayDeclarations3(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck::getPreviousNodeWithParentOfTypeAst to ( if (x != null) null else throw new RuntimeException ) → KILLED

411

1.1
Location : getIdentLastToken
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testArrayDeclarations2(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

414

1.1
Location : getIdentLastToken
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testArrayDeclarations3(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

416

1.1
Location : getIdentLastToken
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testArrayDeclarations3(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

422

1.1
Location : getIdentLastToken
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testArrayDeclarations2(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
negated conditional → KILLED

430

1.1
Location : getIdentLastToken
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testArrayDeclarations3(com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest)
mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck::getIdentLastToken to ( if (x != null) null else throw new RuntimeException ) → KILLED

Active mutators

Tests examined


Report generated by PIT 1.2.4