diff --git a/build.gradle b/build.gradle
index 306f2488..a5b59090 100644
--- a/build.gradle
+++ b/build.gradle
@@ -6,6 +6,7 @@ group = "org.hamcrest"
version = "2.2-SNAPSHOT"
subprojects {
+ apply plugin: 'checkstyle'
apply plugin: 'java-library'
sourceCompatibility = JavaVersion.VERSION_1_7
@@ -18,6 +19,27 @@ subprojects {
mavenCentral()
}
+ checkstyle {
+
+ project.ext.checkstyleVersion = '6.18'
+ //works with a JDK 7 version which is supposed to be supported although
+ //deprecated, see /~https://github.com/hamcrest/JavaHamcrest/pull/211 for
+ //the discussion about the support
+
+ sourceSets = [ project.sourceSets.main, project.sourceSets.test ]
+ ignoreFailures = false
+ configFile = file("${project.rootDir}/checkstyle.xml")
+
+ configurations {
+ checkstyle
+ }
+
+ dependencies{
+ assert project.hasProperty("checkstyleVersion")
+ checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}"
+ }
+ }
+
test {
testLogging {
exceptionFormat = 'full'
diff --git a/checkstyle.xml b/checkstyle.xml
new file mode 100644
index 00000000..c1dbabf3
--- /dev/null
+++ b/checkstyle.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java b/hamcrest/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java
index f12f57c4..f79afdc6 100644
--- a/hamcrest/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java
+++ b/hamcrest/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java
@@ -44,7 +44,7 @@ public static Matcher> hasSize(Matcher super Integ
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Matcher> hasSize(int size) {
- return (Matcher)IsCollectionWithSize.hasSize(equalTo(size));
+ return (Matcher)IsCollectionWithSize.hasSize(equalTo(size));
}
}
diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java
index 221bd47b..ed62aa29 100644
--- a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java
+++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java
@@ -129,7 +129,7 @@ public static Matcher> contains(Matcher super E>...
// required for JDK 1.6
//noinspection RedundantTypeArguments
final List> nullSafeWithExplicitTypeMatchers = NullSafety.nullSafe(itemMatchers);
- return contains(nullSafeWithExplicitTypeMatchers);
+ return contains(nullSafeWithExplicitTypeMatchers);
}
/**
diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInOrderTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInOrderTest.java
index 14ae6f58..e71abbfd 100644
--- a/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInOrderTest.java
+++ b/hamcrest/src/test/java/org/hamcrest/collection/IsIterableContainingInOrderTest.java
@@ -55,7 +55,7 @@ public void testHasAReadableDescription() {
}
public void testCanHandleNullMatchers() {
- assertMatches(contains(null, null), asList(null, null));
+ assertMatches(contains(null, null), asList(null, null));
}
public static class WithValue {
diff --git a/hamcrest/src/test/java/org/hamcrest/object/HasToStringTest.java b/hamcrest/src/test/java/org/hamcrest/object/HasToStringTest.java
index 5c75ae7d..122e19b5 100644
--- a/hamcrest/src/test/java/org/hamcrest/object/HasToStringTest.java
+++ b/hamcrest/src/test/java/org/hamcrest/object/HasToStringTest.java
@@ -26,30 +26,30 @@ public String toString() {
@Test public void
matchesWhenUtilisingANestedMatcher() {
- final Matcher