Suppress compiler errors reported by an error-prone checker ([]) for tests.
I wrote an error-prone checker([]) to check that injected constructors are not annotated with @Inject(optional=true) or with binding annotations. This CL annotates the intentional tests for such cases with @SuppressWarnings.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64575706
diff --git a/core/test/com/google/inject/OptionalBindingTest.java b/core/test/com/google/inject/OptionalBindingTest.java
index 46cff71..a62191c 100644
--- a/core/test/com/google/inject/OptionalBindingTest.java
+++ b/core/test/com/google/inject/OptionalBindingTest.java
@@ -255,6 +255,9 @@
}
static class HasOptionalConstructor {
+ // Suppress compiler errors by the error-prone checker InjectedConstructorAnnotations,
+ // which catches optional injected constructors.
+ @SuppressWarnings("InjectedConstructorAnnotations")
@Inject(optional=true)
HasOptionalConstructor() {}
}
diff --git a/core/test/com/google/inject/ProvisionExceptionTest.java b/core/test/com/google/inject/ProvisionExceptionTest.java
index e96a0f3..962794f 100644
--- a/core/test/com/google/inject/ProvisionExceptionTest.java
+++ b/core/test/com/google/inject/ProvisionExceptionTest.java
@@ -295,6 +295,9 @@
}
static class ConstructorWithBindingAnnotation {
+ // Suppress compiler errors by the error-prone checker InjectedConstructorAnnotations,
+ // which catches injected constructors with binding annotations.
+ @SuppressWarnings("InjectedConstructorAnnotations")
@Inject @Green ConstructorWithBindingAnnotation(String greenString) {}
}