EmptyLineSeparatorCheck.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 java.util.ArrayList;
23
import java.util.List;
24
25
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
26
import com.puppycrawl.tools.checkstyle.api.DetailAST;
27
import com.puppycrawl.tools.checkstyle.api.FileContents;
28
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
29
import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
30
import com.puppycrawl.tools.checkstyle.utils.JavadocUtils;
31
32
/**
33
 * Checks for empty line separators after header, package, all import declarations,
34
 * fields, constructors, methods, nested classes,
35
 * static initializers and instance initializers.
36
 *
37
 * <p> By default the check will check the following statements:
38
 *  {@link TokenTypes#PACKAGE_DEF PACKAGE_DEF},
39
 *  {@link TokenTypes#IMPORT IMPORT},
40
 *  {@link TokenTypes#CLASS_DEF CLASS_DEF},
41
 *  {@link TokenTypes#INTERFACE_DEF INTERFACE_DEF},
42
 *  {@link TokenTypes#STATIC_INIT STATIC_INIT},
43
 *  {@link TokenTypes#INSTANCE_INIT INSTANCE_INIT},
44
 *  {@link TokenTypes#METHOD_DEF METHOD_DEF},
45
 *  {@link TokenTypes#CTOR_DEF CTOR_DEF},
46
 *  {@link TokenTypes#VARIABLE_DEF VARIABLE_DEF}.
47
 * </p>
48
 *
49
 * <p>
50
 * Example of declarations without empty line separator:
51
 * </p>
52
 *
53
 * <pre>
54
 * ///////////////////////////////////////////////////
55
 * //HEADER
56
 * ///////////////////////////////////////////////////
57
 * package com.puppycrawl.tools.checkstyle.whitespace;
58
 * import java.io.Serializable;
59
 * class Foo
60
 * {
61
 *     public static final int FOO_CONST = 1;
62
 *     public void foo() {} //should be separated from previous statement.
63
 * }
64
 * </pre>
65
 *
66
 * <p> An example of how to configure the check with default parameters is:
67
 * </p>
68
 *
69
 * <pre>
70
 * &lt;module name="EmptyLineSeparator"/&gt;
71
 * </pre>
72
 *
73
 * <p>
74
 * Example of declarations with empty line separator
75
 * that is expected by the Check by default:
76
 * </p>
77
 *
78
 * <pre>
79
 * ///////////////////////////////////////////////////
80
 * //HEADER
81
 * ///////////////////////////////////////////////////
82
 *
83
 * package com.puppycrawl.tools.checkstyle.whitespace;
84
 *
85
 * import java.io.Serializable;
86
 *
87
 * class Foo
88
 * {
89
 *     public static final int FOO_CONST = 1;
90
 *
91
 *     public void foo() {}
92
 * }
93
 * </pre>
94
 * <p> An example how to check empty line after
95
 * {@link TokenTypes#VARIABLE_DEF VARIABLE_DEF} and
96
 * {@link TokenTypes#METHOD_DEF METHOD_DEF}:
97
 * </p>
98
 *
99
 * <pre>
100
 * &lt;module name="EmptyLineSeparator"&gt;
101
 *    &lt;property name="tokens" value="VARIABLE_DEF, METHOD_DEF"/&gt;
102
 * &lt;/module&gt;
103
 * </pre>
104
 *
105
 * <p>
106
 * An example how to allow no empty line between fields:
107
 * </p>
108
 * <pre>
109
 * &lt;module name="EmptyLineSeparator"&gt;
110
 *    &lt;property name="allowNoEmptyLineBetweenFields" value="true"/&gt;
111
 * &lt;/module&gt;
112
 * </pre>
113
 *
114
 * <p>
115
 * Example of declarations with multiple empty lines between class members (allowed by default):
116
 * </p>
117
 *
118
 * <pre>
119
 * ///////////////////////////////////////////////////
120
 * //HEADER
121
 * ///////////////////////////////////////////////////
122
 *
123
 *
124
 * package com.puppycrawl.tools.checkstyle.whitespace;
125
 *
126
 *
127
 *
128
 * import java.io.Serializable;
129
 *
130
 *
131
 * class Foo
132
 * {
133
 *     public static final int FOO_CONST = 1;
134
 *
135
 *
136
 *
137
 *     public void foo() {}
138
 * }
139
 * </pre>
140
 * <p>
141
 * An example how to disallow multiple empty lines between class members:
142
 * </p>
143
 * <pre>
144
 * &lt;module name="EmptyLineSeparator"&gt;
145
 *    &lt;property name="allowMultipleEmptyLines" value="false"/&gt;
146
 * &lt;/module&gt;
147
 * </pre>
148
 *
149
 * <p>
150
 * An example how to disallow multiple empty line inside methods, constructors, etc.:
151
 * </p>
152
 * <pre>
153
 * &lt;module name="EmptyLineSeparator"&gt;
154
 *    &lt;property name="allowMultipleEmptyLinesInsideClassMembers" value="false"/&gt;
155
 * &lt;/module&gt;
156
 * </pre>
157
 *
158
 * <p> The check is valid only for statements that have body:
159
 * {@link TokenTypes#CLASS_DEF},
160
 * {@link TokenTypes#INTERFACE_DEF},
161
 * {@link TokenTypes#ENUM_DEF},
162
 * {@link TokenTypes#STATIC_INIT},
163
 * {@link TokenTypes#INSTANCE_INIT},
164
 * {@link TokenTypes#METHOD_DEF},
165
 * {@link TokenTypes#CTOR_DEF}
166
 * </p>
167
 * <p>
168
 * Example of declarations with multiple empty lines inside method:
169
 * </p>
170
 *
171
 * <pre>
172
 * ///////////////////////////////////////////////////
173
 * //HEADER
174
 * ///////////////////////////////////////////////////
175
 *
176
 * package com.puppycrawl.tools.checkstyle.whitespace;
177
 *
178
 * class Foo
179
 * {
180
 *
181
 *     public void foo() {
182
 *
183
 *
184
 *          System.out.println(1); // violation since method has 2 empty lines subsequently
185
 *     }
186
 * }
187
 * </pre>
188
 * @author maxvetrenko
189
 * @author <a href="mailto:nesterenko-aleksey@list.ru">Aleksey Nesterenko</a>
190
 */
191
public class EmptyLineSeparatorCheck extends AbstractCheck {
192
193
    /**
194
     * A key is pointing to the warning message empty.line.separator in "messages.properties"
195
     * file.
196
     */
197
    public static final String MSG_SHOULD_BE_SEPARATED = "empty.line.separator";
198
199
    /**
200
     * A key is pointing to the warning message empty.line.separator.multiple.lines
201
     *  in "messages.properties"
202
     * file.
203
     */
204
    public static final String MSG_MULTIPLE_LINES = "empty.line.separator.multiple.lines";
205
206
    /**
207
     * A key is pointing to the warning message empty.line.separator.lines.after
208
     * in "messages.properties" file.
209
     */
210
    public static final String MSG_MULTIPLE_LINES_AFTER =
211
            "empty.line.separator.multiple.lines.after";
212
213
    /**
214
     * A key is pointing to the warning message empty.line.separator.multiple.lines.inside
215
     * in "messages.properties" file.
216
     */
217
    public static final String MSG_MULTIPLE_LINES_INSIDE =
218
            "empty.line.separator.multiple.lines.inside";
219
220
    /** Allows no empty line between fields. */
221
    private boolean allowNoEmptyLineBetweenFields;
222
223
    /** Allows multiple empty lines between class members. */
224
    private boolean allowMultipleEmptyLines = true;
225
226
    /** Allows multiple empty lines inside class members. */
227
    private boolean allowMultipleEmptyLinesInsideClassMembers = true;
228
229
    /**
230
     * Allow no empty line between fields.
231
     * @param allow
232
     *        User's value.
233
     */
234
    public final void setAllowNoEmptyLineBetweenFields(boolean allow) {
235
        allowNoEmptyLineBetweenFields = allow;
236
    }
237
238
    /**
239
     * Allow multiple empty lines between class members.
240
     * @param allow User's value.
241
     */
242
    public void setAllowMultipleEmptyLines(boolean allow) {
243
        allowMultipleEmptyLines = allow;
244
    }
245
246
    /**
247
     * Allow multiple empty lines inside class members.
248
     * @param allow User's value.
249
     */
250
    public void setAllowMultipleEmptyLinesInsideClassMembers(boolean allow) {
251
        allowMultipleEmptyLinesInsideClassMembers = allow;
252
    }
253
254
    @Override
255
    public boolean isCommentNodesRequired() {
256 1 1. isCommentNodesRequired : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED
        return true;
257
    }
258
259
    @Override
260
    public int[] getDefaultTokens() {
261 1 1. getDefaultTokens : mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::getDefaultTokens to ( if (x != null) null else throw new RuntimeException ) → KILLED
        return getAcceptableTokens();
262
    }
263
264
    @Override
265
    public int[] getAcceptableTokens() {
266 1 1. getAcceptableTokens : mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::getAcceptableTokens to ( if (x != null) null else throw new RuntimeException ) → KILLED
        return new int[] {
267
            TokenTypes.PACKAGE_DEF,
268
            TokenTypes.IMPORT,
269
            TokenTypes.CLASS_DEF,
270
            TokenTypes.INTERFACE_DEF,
271
            TokenTypes.ENUM_DEF,
272
            TokenTypes.STATIC_INIT,
273
            TokenTypes.INSTANCE_INIT,
274
            TokenTypes.METHOD_DEF,
275
            TokenTypes.CTOR_DEF,
276
            TokenTypes.VARIABLE_DEF,
277
        };
278
    }
279
280
    @Override
281
    public int[] getRequiredTokens() {
282 1 1. getRequiredTokens : mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::getRequiredTokens to ( if (x != null) null else throw new RuntimeException ) → KILLED
        return CommonUtils.EMPTY_INT_ARRAY;
283
    }
284
285
    @Override
286
    public void visitToken(DetailAST ast) {
287 1 1. visitToken : negated conditional → KILLED
        if (hasMultipleLinesBefore(ast)) {
288 1 1. visitToken : removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::log → KILLED
            log(ast.getLineNo(), MSG_MULTIPLE_LINES, ast.getText());
289
        }
290 1 1. visitToken : negated conditional → KILLED
        if (!allowMultipleEmptyLinesInsideClassMembers) {
291 1 1. visitToken : removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::processMultipleLinesInside → KILLED
            processMultipleLinesInside(ast);
292
        }
293
294
        DetailAST nextToken = ast.getNextSibling();
295 2 1. visitToken : negated conditional → KILLED
2. visitToken : negated conditional → KILLED
        while (nextToken != null && isComment(nextToken)) {
296
            nextToken = nextToken.getNextSibling();
297
        }
298 1 1. visitToken : negated conditional → KILLED
        if (nextToken != null) {
299
            final int astType = ast.getType();
300
            switch (astType) {
301
                case TokenTypes.VARIABLE_DEF:
302 1 1. visitToken : removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::processVariableDef → KILLED
                    processVariableDef(ast, nextToken);
303
                    break;
304
                case TokenTypes.IMPORT:
305 1 1. visitToken : removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::processImport → KILLED
                    processImport(ast, nextToken, astType);
306
                    break;
307
                case TokenTypes.PACKAGE_DEF:
308 1 1. visitToken : removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::processPackage → KILLED
                    processPackage(ast, nextToken);
309
                    break;
310
                default:
311 1 1. visitToken : negated conditional → KILLED
                    if (nextToken.getType() == TokenTypes.RCURLY) {
312 1 1. visitToken : negated conditional → KILLED
                        if (hasNotAllowedTwoEmptyLinesBefore(nextToken)) {
313 1 1. visitToken : removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::log → KILLED
                            log(ast.getLineNo(), MSG_MULTIPLE_LINES_AFTER, ast.getText());
314
                        }
315
                    }
316 1 1. visitToken : negated conditional → KILLED
                    else if (!hasEmptyLineAfter(ast)) {
317 1 1. visitToken : removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::log → KILLED
                        log(nextToken.getLineNo(), MSG_SHOULD_BE_SEPARATED,
318
                            nextToken.getText());
319
                    }
320
            }
321
        }
322
    }
323
324
    /**
325
     * Log violation in case there are multiple empty lines inside constructor,
326
     * initialization block or method.
327
     * @param ast the ast to check.
328
     */
329
    private void processMultipleLinesInside(DetailAST ast) {
330
        final int astType = ast.getType();
331 2 1. processMultipleLinesInside : negated conditional → KILLED
2. processMultipleLinesInside : negated conditional → KILLED
        if (astType != TokenTypes.CLASS_DEF && isClassMemberBlock(astType)) {
332
            final List<Integer> emptyLines = getEmptyLines(ast);
333
            final List<Integer> emptyLinesToLog = getEmptyLinesToLog(emptyLines);
334
335 1 1. processMultipleLinesInside : negated conditional → KILLED
            for (Integer lineNo : emptyLinesToLog) {
336
                // Checkstyle counts line numbers from 0 but IDE from 1
337 2 1. processMultipleLinesInside : Replaced integer addition with subtraction → KILLED
2. processMultipleLinesInside : removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::log → KILLED
                log(lineNo + 1, MSG_MULTIPLE_LINES_INSIDE);
338
            }
339
        }
340
    }
341
342
    /**
343
     * Whether the AST is a class member block.
344
     * @param astType the AST to check.
345
     * @return true if the AST is a class member block.
346
     */
347
    private static boolean isClassMemberBlock(int astType) {
348 5 1. isClassMemberBlock : negated conditional → KILLED
2. isClassMemberBlock : negated conditional → KILLED
3. isClassMemberBlock : negated conditional → KILLED
4. isClassMemberBlock : negated conditional → KILLED
5. isClassMemberBlock : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED
        return astType == TokenTypes.STATIC_INIT
349
                || astType == TokenTypes.INSTANCE_INIT
350
                || astType == TokenTypes.METHOD_DEF
351
                || astType == TokenTypes.CTOR_DEF;
352
    }
353
354
    /**
355
     * Get list of empty lines.
356
     * @param ast the ast to check.
357
     * @return list of line numbers for empty lines.
358
     */
359
    private List<Integer> getEmptyLines(DetailAST ast) {
360
        final DetailAST lastToken = ast.getLastChild().getLastChild();
361
        int lastTokenLineNo = 0;
362 1 1. getEmptyLines : negated conditional → KILLED
        if (lastToken != null) {
363
            // -1 as count starts from 0
364
            // -2 as last token line cannot be empty, because it is a RCURLY
365 1 1. getEmptyLines : Replaced integer subtraction with addition → KILLED
            lastTokenLineNo = lastToken.getLineNo() - 2;
366
        }
367
        final List<Integer> emptyLines = new ArrayList<>();
368
        final FileContents fileContents = getFileContents();
369
370 3 1. getEmptyLines : changed conditional boundary → KILLED
2. getEmptyLines : Changed increment from 1 to -1 → KILLED
3. getEmptyLines : negated conditional → KILLED
        for (int lineNo = ast.getLineNo(); lineNo <= lastTokenLineNo; lineNo++) {
371 1 1. getEmptyLines : negated conditional → KILLED
            if (fileContents.lineIsBlank(lineNo)) {
372
                emptyLines.add(lineNo);
373
            }
374
        }
375 1 1. getEmptyLines : mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::getEmptyLines to ( if (x != null) null else throw new RuntimeException ) → KILLED
        return emptyLines;
376
    }
377
378
    /**
379
     * Get list of empty lines to log.
380
     * @param emptyLines list of empty lines.
381
     * @return list of empty lines to log.
382
     */
383
    private static List<Integer> getEmptyLinesToLog(List<Integer> emptyLines) {
384
        final List<Integer> emptyLinesToLog = new ArrayList<>();
385 2 1. getEmptyLinesToLog : changed conditional boundary → KILLED
2. getEmptyLinesToLog : negated conditional → KILLED
        if (emptyLines.size() >= 2) {
386
            int previousEmptyLineNo = emptyLines.get(0);
387 1 1. getEmptyLinesToLog : negated conditional → KILLED
            for (int emptyLineNo : emptyLines) {
388 2 1. getEmptyLinesToLog : Replaced integer addition with subtraction → KILLED
2. getEmptyLinesToLog : negated conditional → KILLED
                if (previousEmptyLineNo + 1 == emptyLineNo) {
389
                    emptyLinesToLog.add(emptyLineNo);
390
                }
391
                previousEmptyLineNo = emptyLineNo;
392
            }
393
        }
394 1 1. getEmptyLinesToLog : mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::getEmptyLinesToLog to ( if (x != null) null else throw new RuntimeException ) → KILLED
        return emptyLinesToLog;
395
    }
396
397
    /**
398
     * Whether the token has not allowed multiple empty lines before.
399
     * @param ast the ast to check.
400
     * @return true if the token has not allowed multiple empty lines before.
401
     */
402
    private boolean hasMultipleLinesBefore(DetailAST ast) {
403
        boolean result = false;
404 1 1. hasMultipleLinesBefore : negated conditional → KILLED
        if ((ast.getType() != TokenTypes.VARIABLE_DEF
405 1 1. hasMultipleLinesBefore : negated conditional → KILLED
            || isTypeField(ast))
406 1 1. hasMultipleLinesBefore : negated conditional → KILLED
                && hasNotAllowedTwoEmptyLinesBefore(ast)) {
407
            result = true;
408
        }
409 1 1. hasMultipleLinesBefore : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED
        return result;
410
    }
411
412
    /**
413
     * Process Package.
414
     * @param ast token
415
     * @param nextToken next token
416
     */
417
    private void processPackage(DetailAST ast, DetailAST nextToken) {
418 3 1. processPackage : changed conditional boundary → KILLED
2. processPackage : negated conditional → KILLED
3. processPackage : negated conditional → KILLED
        if (ast.getLineNo() > 1 && !hasEmptyLineBefore(ast)) {
419 1 1. processPackage : negated conditional → KILLED
            if (getFileContents().getFileName().endsWith("package-info.java")) {
420 2 1. processPackage : negated conditional → KILLED
2. processPackage : negated conditional → KILLED
                if (ast.getFirstChild().getChildCount() == 0 && !isPrecededByJavadoc(ast)) {
421 1 1. processPackage : removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::log → KILLED
                    log(ast.getLineNo(), MSG_SHOULD_BE_SEPARATED, ast.getText());
422
                }
423
            }
424
            else {
425 1 1. processPackage : removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::log → KILLED
                log(ast.getLineNo(), MSG_SHOULD_BE_SEPARATED, ast.getText());
426
            }
427
        }
428 1 1. processPackage : negated conditional → KILLED
        if (!hasEmptyLineAfter(ast)) {
429 1 1. processPackage : removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::log → KILLED
            log(nextToken.getLineNo(), MSG_SHOULD_BE_SEPARATED, nextToken.getText());
430
        }
431
    }
432
433
    /**
434
     * Process Import.
435
     * @param ast token
436
     * @param nextToken next token
437
     * @param astType token Type
438
     */
439
    private void processImport(DetailAST ast, DetailAST nextToken, int astType) {
440 2 1. processImport : negated conditional → KILLED
2. processImport : negated conditional → KILLED
        if (astType != nextToken.getType() && !hasEmptyLineAfter(ast)) {
441 1 1. processImport : removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::log → KILLED
            log(nextToken.getLineNo(), MSG_SHOULD_BE_SEPARATED, nextToken.getText());
442
        }
443
    }
444
445
    /**
446
     * Process Variable.
447
     * @param ast token
448
     * @param nextToken next Token
449
     */
450
    private void processVariableDef(DetailAST ast, DetailAST nextToken) {
451 2 1. processVariableDef : negated conditional → KILLED
2. processVariableDef : negated conditional → KILLED
        if (isTypeField(ast) && !hasEmptyLineAfter(ast)
452 1 1. processVariableDef : negated conditional → KILLED
                && isViolatingEmptyLineBetweenFieldsPolicy(nextToken)) {
453 1 1. processVariableDef : removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::log → KILLED
            log(nextToken.getLineNo(), MSG_SHOULD_BE_SEPARATED,
454
                    nextToken.getText());
455
        }
456
    }
457
458
    /**
459
     * Checks whether token placement violates policy of empty line between fields.
460
     * @param detailAST token to be analyzed
461
     * @return true if policy is violated and warning should be raised; false otherwise
462
     */
463
    private boolean isViolatingEmptyLineBetweenFieldsPolicy(DetailAST detailAST) {
464 2 1. isViolatingEmptyLineBetweenFieldsPolicy : negated conditional → KILLED
2. isViolatingEmptyLineBetweenFieldsPolicy : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED
        return allowNoEmptyLineBetweenFields
465 1 1. isViolatingEmptyLineBetweenFieldsPolicy : negated conditional → KILLED
                    && detailAST.getType() != TokenTypes.VARIABLE_DEF
466 2 1. isViolatingEmptyLineBetweenFieldsPolicy : negated conditional → KILLED
2. isViolatingEmptyLineBetweenFieldsPolicy : negated conditional → KILLED
                    && detailAST.getType() != TokenTypes.RCURLY
467
                || !allowNoEmptyLineBetweenFields
468 1 1. isViolatingEmptyLineBetweenFieldsPolicy : negated conditional → KILLED
                    && detailAST.getType() != TokenTypes.RCURLY;
469
    }
470
471
    /**
472
     * Checks if a token has empty two previous lines and multiple empty lines is not allowed.
473
     * @param token DetailAST token
474
     * @return true, if token has empty two lines before and allowMultipleEmptyLines is false
475
     */
476
    private boolean hasNotAllowedTwoEmptyLinesBefore(DetailAST token) {
477 3 1. hasNotAllowedTwoEmptyLinesBefore : negated conditional → KILLED
2. hasNotAllowedTwoEmptyLinesBefore : negated conditional → KILLED
3. hasNotAllowedTwoEmptyLinesBefore : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED
        return !allowMultipleEmptyLines && hasEmptyLineBefore(token)
478 1 1. hasNotAllowedTwoEmptyLinesBefore : negated conditional → KILLED
                && isPrePreviousLineEmpty(token);
479
    }
480
481
    /**
482
     * Checks if a token has empty pre-previous line.
483
     * @param token DetailAST token.
484
     * @return true, if token has empty lines before.
485
     */
486
    private boolean isPrePreviousLineEmpty(DetailAST token) {
487
        boolean result = false;
488
        final int lineNo = token.getLineNo();
489
        // 3 is the number of the pre-previous line because the numbering starts from zero.
490
        final int number = 3;
491 2 1. isPrePreviousLineEmpty : changed conditional boundary → KILLED
2. isPrePreviousLineEmpty : negated conditional → KILLED
        if (lineNo >= number) {
492 1 1. isPrePreviousLineEmpty : Replaced integer subtraction with addition → KILLED
            final String prePreviousLine = getLines()[lineNo - number];
493
            result = CommonUtils.isBlank(prePreviousLine);
494
        }
495 1 1. isPrePreviousLineEmpty : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED
        return result;
496
    }
497
498
    /**
499
     * Checks if token have empty line after.
500
     * @param token token.
501
     * @return true if token have empty line after.
502
     */
503
    private boolean hasEmptyLineAfter(DetailAST token) {
504
        DetailAST lastToken = token.getLastChild().getLastChild();
505 1 1. hasEmptyLineAfter : negated conditional → KILLED
        if (lastToken == null) {
506
            lastToken = token.getLastChild();
507
        }
508
        DetailAST nextToken = token.getNextSibling();
509 1 1. hasEmptyLineAfter : negated conditional → KILLED
        if (isComment(nextToken)) {
510
            nextToken = nextToken.getNextSibling();
511
        }
512
        // Start of the next token
513
        final int nextBegin = nextToken.getLineNo();
514
        // End of current token.
515
        final int currentEnd = lastToken.getLineNo();
516 3 1. hasEmptyLineAfter : Replaced integer addition with subtraction → KILLED
2. hasEmptyLineAfter : Replaced integer subtraction with addition → KILLED
3. hasEmptyLineAfter : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED
        return hasEmptyLine(currentEnd + 1, nextBegin - 1);
517
    }
518
519
    /**
520
     * Checks, whether there are empty lines within the specified line range. Line numbering is
521
     * started from 1 for parameter values
522
     * @param startLine number of the first line in the range
523
     * @param endLine number of the second line in the range
524
     * @return {@code true} if found any blank line within the range, {@code false}
525
     *         otherwise
526
     */
527
    private boolean hasEmptyLine(int startLine, int endLine) {
528
        // Initial value is false - blank line not found
529
        boolean result = false;
530 2 1. hasEmptyLine : changed conditional boundary → KILLED
2. hasEmptyLine : negated conditional → KILLED
        if (startLine <= endLine) {
531
            final FileContents fileContents = getFileContents();
532 3 1. hasEmptyLine : changed conditional boundary → KILLED
2. hasEmptyLine : Changed increment from 1 to -1 → KILLED
3. hasEmptyLine : negated conditional → KILLED
            for (int line = startLine; line <= endLine; line++) {
533
                // Check, if the line is blank. Lines are numbered from 0, so subtract 1
534 2 1. hasEmptyLine : Replaced integer subtraction with addition → KILLED
2. hasEmptyLine : negated conditional → KILLED
                if (fileContents.lineIsBlank(line - 1)) {
535
                    result = true;
536
                    break;
537
                }
538
            }
539
        }
540 1 1. hasEmptyLine : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED
        return result;
541
    }
542
543
    /**
544
     * Checks if a token has a empty line before.
545
     * @param token token.
546
     * @return true, if token have empty line before.
547
     */
548
    private boolean hasEmptyLineBefore(DetailAST token) {
549
        boolean result = false;
550
        final int lineNo = token.getLineNo();
551 1 1. hasEmptyLineBefore : negated conditional → KILLED
        if (lineNo != 1) {
552
            // [lineNo - 2] is the number of the previous line as the numbering starts from zero.
553 1 1. hasEmptyLineBefore : Replaced integer subtraction with addition → KILLED
            final String lineBefore = getLines()[lineNo - 2];
554
            result = CommonUtils.isBlank(lineBefore);
555
        }
556 1 1. hasEmptyLineBefore : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED
        return result;
557
    }
558
559
    /**
560
     * Check if token is preceded by javadoc comment.
561
     * @param token token for check.
562
     * @return true, if token is preceded by javadoc comment.
563
     */
564
    private static boolean isPrecededByJavadoc(DetailAST token) {
565
        boolean result = false;
566
        final DetailAST previous = token.getPreviousSibling();
567 1 1. isPrecededByJavadoc : negated conditional → KILLED
        if (previous.getType() == TokenTypes.BLOCK_COMMENT_BEGIN
568 1 1. isPrecededByJavadoc : negated conditional → KILLED
                && JavadocUtils.isJavadocComment(previous.getFirstChild().getText())) {
569
            result = true;
570
        }
571 1 1. isPrecededByJavadoc : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED
        return result;
572
    }
573
574
    /**
575
     * Check if token is a comment.
576
     * @param ast ast node
577
     * @return true, if given ast is comment.
578
     */
579
    private static boolean isComment(DetailAST ast) {
580 2 1. isComment : negated conditional → KILLED
2. isComment : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED
        return ast.getType() == TokenTypes.SINGLE_LINE_COMMENT
581 1 1. isComment : negated conditional → KILLED
                   || ast.getType() == TokenTypes.BLOCK_COMMENT_BEGIN;
582
    }
583
584
    /**
585
     * If variable definition is a type field.
586
     * @param variableDef variable definition.
587
     * @return true variable definition is a type field.
588
     */
589
    private static boolean isTypeField(DetailAST variableDef) {
590
        final int parentType = variableDef.getParent().getParent().getType();
591 2 1. isTypeField : negated conditional → KILLED
2. isTypeField : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED
        return parentType == TokenTypes.CLASS_DEF;
592
    }
593
}

Mutations

256

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

261

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

266

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

282

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

287

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

288

1.1
Location : visitToken
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPrePreviousLineIsEmpty(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::log → KILLED

290

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

291

1.1
Location : visitToken
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPreviousLineEmptiness(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::processMultipleLinesInside → KILLED

295

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

2.2
Location : visitToken
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowMultipleImportSeparatedFromPackage(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

298

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

302

1.1
Location : visitToken
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowNoEmptyLineBetweenFields(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::processVariableDef → KILLED

305

1.1
Location : visitToken
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowNoEmptyLineBetweenFields(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::processImport → KILLED

308

1.1
Location : visitToken
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowMultipleImportSeparatedFromPackage(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::processPackage → KILLED

311

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

312

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

313

1.1
Location : visitToken
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testMultipleEmptyLinesBetweenClassMembers(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::log → KILLED

316

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

317

1.1
Location : visitToken
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowNoEmptyLineBetweenFields(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::log → KILLED

331

1.1
Location : processMultipleLinesInside
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPreviousLineEmptiness(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

2.2
Location : processMultipleLinesInside
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPreviousLineEmptiness(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

335

1.1
Location : processMultipleLinesInside
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPreviousLineEmptiness(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

337

1.1
Location : processMultipleLinesInside
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPreviousLineEmptiness(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
Replaced integer addition with subtraction → KILLED

2.2
Location : processMultipleLinesInside
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPreviousLineEmptiness(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::log → KILLED

348

1.1
Location : isClassMemberBlock
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPreviousLineEmptiness(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

2.2
Location : isClassMemberBlock
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPreviousLineEmptiness(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

3.3
Location : isClassMemberBlock
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPreviousLineEmptiness(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

4.4
Location : isClassMemberBlock
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPreviousLineEmptiness(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

5.5
Location : isClassMemberBlock
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPreviousLineEmptiness(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED

362

1.1
Location : getEmptyLines
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPreviousLineEmptiness(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

365

1.1
Location : getEmptyLines
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPreviousLineEmptiness(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
Replaced integer subtraction with addition → KILLED

370

1.1
Location : getEmptyLines
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPreviousLineEmptiness(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
changed conditional boundary → KILLED

2.2
Location : getEmptyLines
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPreviousLineEmptiness(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
Changed increment from 1 to -1 → KILLED

3.3
Location : getEmptyLines
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPreviousLineEmptiness(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

371

1.1
Location : getEmptyLines
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPreviousLineEmptiness(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

375

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

385

1.1
Location : getEmptyLinesToLog
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPreviousLineEmptiness(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
changed conditional boundary → KILLED

2.2
Location : getEmptyLinesToLog
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPreviousLineEmptiness(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

387

1.1
Location : getEmptyLinesToLog
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPreviousLineEmptiness(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

388

1.1
Location : getEmptyLinesToLog
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPreviousLineEmptiness(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
Replaced integer addition with subtraction → KILLED

2.2
Location : getEmptyLinesToLog
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPreviousLineEmptiness(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

394

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

404

1.1
Location : hasMultipleLinesBefore
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testFormerArrayIndexOutOfBounds(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

405

1.1
Location : hasMultipleLinesBefore
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testMultipleEmptyLinesBetweenClassMembers(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

406

1.1
Location : hasMultipleLinesBefore
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testFormerArrayIndexOutOfBounds(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

409

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

418

1.1
Location : processPackage
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testFormerArrayIndexOutOfBounds(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
changed conditional boundary → KILLED

2.2
Location : processPackage
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testFormerArrayIndexOutOfBounds(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

3.3
Location : processPackage
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testHeader(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

419

1.1
Location : processPackage
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowPackageAnnotation(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

420

1.1
Location : processPackage
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testDisAllowBlockCommentBeforePackage(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

2.2
Location : processPackage
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testDisAllowBlockCommentBeforePackage(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

421

1.1
Location : processPackage
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testDisAllowBlockCommentBeforePackage(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::log → KILLED

425

1.1
Location : processPackage
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testHeader(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::log → KILLED

428

1.1
Location : processPackage
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testFormerArrayIndexOutOfBounds(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

429

1.1
Location : processPackage
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowMultipleImportSeparatedFromPackage(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::log → KILLED

440

1.1
Location : processImport
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowMultipleImportSeparatedFromPackage(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

2.2
Location : processImport
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowMultipleImportSeparatedFromPackage(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

441

1.1
Location : processImport
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowNoEmptyLineBetweenFields(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::log → KILLED

451

1.1
Location : processVariableDef
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowNoEmptyLineBetweenFields(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

2.2
Location : processVariableDef
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowMultipleEmptyLinesInsideClassMembers(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

452

1.1
Location : processVariableDef
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowMultipleFieldInClass(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

453

1.1
Location : processVariableDef
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowNoEmptyLineBetweenFields(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
removed call to com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck::log → KILLED

464

1.1
Location : isViolatingEmptyLineBetweenFieldsPolicy
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowNoEmptyLineBetweenFields(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

2.2
Location : isViolatingEmptyLineBetweenFieldsPolicy
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowMultipleFieldInClass(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED

465

1.1
Location : isViolatingEmptyLineBetweenFieldsPolicy
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowMultipleFieldInClass(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

466

1.1
Location : isViolatingEmptyLineBetweenFieldsPolicy
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowMultipleFieldInClass(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

2.2
Location : isViolatingEmptyLineBetweenFieldsPolicy
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowMultipleFieldInClass(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

468

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

477

1.1
Location : hasNotAllowedTwoEmptyLinesBefore
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPrePreviousLineIsEmpty(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

2.2
Location : hasNotAllowedTwoEmptyLinesBefore
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowMultipleImportSeparatedFromPackage(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

3.3
Location : hasNotAllowedTwoEmptyLinesBefore
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testFormerArrayIndexOutOfBounds(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED

478

1.1
Location : hasNotAllowedTwoEmptyLinesBefore
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testFormerArrayIndexOutOfBounds(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

491

1.1
Location : isPrePreviousLineEmpty
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPrePreviousLineIsEmpty(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
changed conditional boundary → KILLED

2.2
Location : isPrePreviousLineEmpty
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testPrePreviousLineEmptiness(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

492

1.1
Location : isPrePreviousLineEmpty
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testFormerArrayIndexOutOfBounds(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
Replaced integer subtraction with addition → KILLED

495

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

505

1.1
Location : hasEmptyLineAfter
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testFormerArrayIndexOutOfBounds(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

509

1.1
Location : hasEmptyLineAfter
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testFormerArrayIndexOutOfBounds(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

516

1.1
Location : hasEmptyLineAfter
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testFormerArrayIndexOutOfBounds(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
Replaced integer addition with subtraction → KILLED

2.2
Location : hasEmptyLineAfter
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowMultipleImportSeparatedFromPackage(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
Replaced integer subtraction with addition → KILLED

3.3
Location : hasEmptyLineAfter
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testFormerArrayIndexOutOfBounds(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED

530

1.1
Location : hasEmptyLine
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testFormerArrayIndexOutOfBounds(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
changed conditional boundary → KILLED

2.2
Location : hasEmptyLine
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testFormerArrayIndexOutOfBounds(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

532

1.1
Location : hasEmptyLine
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testFormerArrayIndexOutOfBounds(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
changed conditional boundary → KILLED

2.2
Location : hasEmptyLine
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowNoEmptyLineBetweenFields(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
Changed increment from 1 to -1 → KILLED

3.3
Location : hasEmptyLine
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testFormerArrayIndexOutOfBounds(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

534

1.1
Location : hasEmptyLine
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testFormerArrayIndexOutOfBounds(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
Replaced integer subtraction with addition → KILLED

2.2
Location : hasEmptyLine
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testFormerArrayIndexOutOfBounds(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

540

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

551

1.1
Location : hasEmptyLineBefore
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testFormerArrayIndexOutOfBounds(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

553

1.1
Location : hasEmptyLineBefore
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowMultipleImportSeparatedFromPackage(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
Replaced integer subtraction with addition → KILLED

556

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

567

1.1
Location : isPrecededByJavadoc
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowJavadocBeforePackage(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

568

1.1
Location : isPrecededByJavadoc
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testDisAllowBlockCommentBeforePackage(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

571

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

580

1.1
Location : isComment
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowMultipleImportSeparatedFromPackage(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

2.2
Location : isComment
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowMultipleImportSeparatedFromPackage(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED

581

1.1
Location : isComment
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowMultipleImportSeparatedFromPackage(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

591

1.1
Location : isTypeField
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowNoEmptyLineBetweenFields(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
negated conditional → KILLED

2.2
Location : isTypeField
Killed by : com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest.testAllowNoEmptyLineBetweenFields(com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheckTest)
replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED

Active mutators

Tests examined


Report generated by PIT 1.2.4