Skip to content

Commit

Permalink
Allow static imports of Collections and Collectors (#186)
Browse files Browse the repository at this point in the history
Collectors and Collections are classes that are pleasant to use as static imports. We can avoid boilerplate by allowing their use, and disallowing them is not helpful because the method names aren't likely to be confused with other things.

Example usage

```java
return foos.stream().flatMap(Collection::stream).collect(toList());
```

```java
when(foo.doSomething()).thenReturn(emptyMap());
```
  • Loading branch information
j-baker authored and uschi2000 committed Jun 16, 2017
1 parent e2a6a81 commit 7ddd526
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
<module name="AvoidStarImport"/> <!-- Java Style Guide: No wildcard imports -->
<module name="AvoidStaticImport"> <!-- Java Style Guide: No static imports -->
<property name="excludes" value="
java.util.Collections.*,java.util.Collectors.*,
org.junit.Assert.*,org.junit.Assume.*,
org.hamcrest.CoreMatchers.*,org.hamcrest.Matchers.*,org.hamcrest.MatcherAssert.*,
org.hamcrest.core.AllOf.*,org.hamcrest.core.Is.*,org.hamcrest.core.StringContains.*,org.hamcrest.core.IsEqual.*,
Expand Down

0 comments on commit 7ddd526

Please sign in to comment.