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

Mutations

88

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

104

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

123

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

142

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

143

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

170

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

181

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

182

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

183

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

186

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

189

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

191

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

208

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

209

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

213

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

215

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

229

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

240

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

264

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

276

1.1
Location : getArrayDeclaratorPreviousElement
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::getArrayDeclaratorPreviousElement to ( if (x != null) null else throw new RuntimeException ) → KILLED

290

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

296

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

299

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

312

1.1
Location : getIndexOpPreviousElement
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheckTest.testDefault(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

323

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

326

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

338

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

340

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

348

1.1
Location : getTypeLastNode
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::getTypeLastNode to ( if (x != null) null else throw new RuntimeException ) → KILLED

368

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

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

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

371

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

376

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

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

377

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

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

384

1.1
Location : getPreviousNodeWithParentOfTypeAst
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::getPreviousNodeWithParentOfTypeAst to ( if (x != null) null else throw new RuntimeException ) → KILLED

396

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

399

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

401

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

407

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

415

1.1
Location : getIdentLastToken
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::getIdentLastToken to ( if (x != null) null else throw new RuntimeException ) → KILLED

Active mutators

Tests examined


Report generated by PIT 1.2.2