forked from checkstyle/checkstyle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue checkstyle#8179: Inability to use xpath for violation for Empty…
…LineSeparator Check
- Loading branch information
Showing
16 changed files
with
288 additions
and
29 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
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
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
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
98 changes: 98 additions & 0 deletions
98
.../checkstyle/checks/whitespace/emptylineseparator/InputEmptyLineSeparatorNewMethodDef.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,98 @@ | ||
package com.puppycrawl.tools.checkstyle.checks.whitespace.emptylineseparator; | ||
|
||
import java.util.Collection; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
/** | ||
* Config: | ||
* allowMultipleEmptyLinesInsideClassMembers = false | ||
*/ | ||
public class InputEmptyLineSeparatorNewMethodDef { | ||
HashMap<String, String> myMap = | ||
new HashMap<>(); | ||
|
||
void processOne() { // ok | ||
|
||
int a; | ||
|
||
int b; | ||
|
||
new Map() { | ||
@Override | ||
public int size() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public boolean isEmpty() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean containsKey(Object key) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean containsValue(Object value) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public Object get(Object key) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Object put(Object key, Object value) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Object remove(Object key) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void putAll(Map m) { | ||
|
||
} | ||
|
||
@Override | ||
public void clear() { | ||
|
||
} | ||
|
||
@Override | ||
public Set<Object> keySet() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Collection<Object> values() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Set<Entry<Object, Object>> entrySet() { | ||
return null; | ||
// violation | ||
|
||
|
||
|
||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return 0; | ||
} | ||
}.putAll(myMap); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...style/checks/whitespace/emptylineseparator/InputEmptyLineSeparatorPostFixCornerCases.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 @@ | ||
package com.puppycrawl.tools.checkstyle.checks.whitespace.emptylineseparator; | ||
|
||
/** | ||
* Config: | ||
* allowMultipleEmptyLinesInsideClassMembers = false | ||
*/ | ||
public class InputEmptyLineSeparatorPostFixCornerCases { | ||
|
||
protected void foo1() throws Exception { | ||
int a = 25; | ||
// violation | ||
|
||
|
||
foo(a); | ||
} | ||
|
||
void foo(int a) { | ||
System.out.println(a); | ||
} | ||
|
||
protected void foo() { | ||
|
||
Object[] defaults = new Object[] { | ||
"String One", | ||
// violation | ||
|
||
|
||
"String Two", | ||
|
||
}; | ||
} | ||
|
||
protected void foo2() { | ||
Object[] defaults = new Object[] { | ||
"String One", 13, | ||
|
||
|
||
"String Two", // violation above this line. | ||
}; | ||
} | ||
} |
Oops, something went wrong.