Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #12345: fix NoWhitespaceAfterCheck false positive
- Loading branch information
Showing
5 changed files
with
70 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
.../checkstyle/checks/whitespace/nowhitespaceafter/InputNoWhitespaceAfterTestAssignment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
NoWhitespaceAfter | ||
allowLineBreaks = false | ||
tokens = (default)ARRAY_INIT, AT, INC, DEC, UNARY_MINUS, UNARY_PLUS, BNOT, LNOT, \ | ||
DOT, ARRAY_DECLARATOR, INDEX_OP | ||
*/ | ||
|
||
package com.puppycrawl.tools.checkstyle.checks.whitespace.nowhitespaceafter; // ^ 2 violations above | ||
|
||
public class InputNoWhitespaceAfterTestAssignment { | ||
|
||
Object o; | ||
static boolean b = true; | ||
|
||
void some() { | ||
Object oo = new Object[4]; | ||
Object[] oo2 = new Object[4]; | ||
this.o = ((Object[]) oo)[1]; // ok | ||
this.o = ((java.lang.Object[]) oo)[1]; // ok | ||
this.o = oo2[1]; | ||
QualifiedAssignment.o1 = ((Object[]) oo)[1]; // ok | ||
QualifiedAssignment.o1 = ((java.lang.Object[]) oo)[1]; // ok | ||
QualifiedAssignment.o1 = oo2[1]; | ||
QualifiedAssignment qa1 = null; | ||
QualifiedAssignment[] qa2 = null; | ||
int idx = 0; | ||
(qa1 = (QualifiedAssignment)qa2[idx]).o1 = (new QualifiedAssignment[idx][idx][idx])[idx]; | ||
(b ? (new QualifiedAssignment().q1 = new QualifiedAssignment()) : | ||
(QualifiedAssignment)(new QualifiedAssignment().q1 = new QualifiedAssignment())).q1 = | ||
(new QualifiedAssignment[new QualifiedAssignment().idx = (QualifiedAssignment.idx = | ||
QualifiedAssignment.idx)])[QualifiedAssignment.idx]; | ||
} | ||
} | ||
|
||
class QualifiedAssignment { | ||
static Object o1; | ||
static QualifiedAssignment q1; | ||
static int idx = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters