Skip to content

Commit 62d9600

Browse files
committed
Clean up warnings in Gradle build
1 parent ef06bf4 commit 62d9600

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

spring-core/src/test/java/org/springframework/core/annotation/AnnotatedElementUtilsTests.java

+8-6
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
import org.springframework.core.annotation.AnnotationUtilsTests.WebMapping;
4848
import org.springframework.core.testfixture.stereotype.Component;
4949
import org.springframework.core.testfixture.stereotype.Indexed;
50-
import org.springframework.lang.NonNullApi;
5150
import org.springframework.util.MultiValueMap;
5251

5352
import static java.util.Arrays.asList;
@@ -237,10 +236,11 @@ void isAnnotatedOnClassWithMetaDepth() {
237236
}
238237

239238
@Test
239+
@SuppressWarnings("deprecation")
240240
void isAnnotatedForPlainTypes() {
241241
assertThat(isAnnotated(Order.class, Documented.class)).isTrue();
242-
assertThat(isAnnotated(NonNullApi.class, Documented.class)).isTrue();
243-
assertThat(isAnnotated(NonNullApi.class, Nonnull.class)).isTrue();
242+
assertThat(isAnnotated(org.springframework.lang.NonNullApi.class, Documented.class)).isTrue();
243+
assertThat(isAnnotated(org.springframework.lang.NonNullApi.class, Nonnull.class)).isTrue();
244244
assertThat(isAnnotated(ParametersAreNonnullByDefault.class, Nonnull.class)).isTrue();
245245
}
246246

@@ -277,10 +277,11 @@ void hasAnnotationOnClassWithMetaDepth() {
277277
}
278278

279279
@Test
280+
@SuppressWarnings("deprecation")
280281
void hasAnnotationForPlainTypes() {
281282
assertThat(hasAnnotation(Order.class, Documented.class)).isTrue();
282-
assertThat(hasAnnotation(NonNullApi.class, Documented.class)).isTrue();
283-
assertThat(hasAnnotation(NonNullApi.class, Nonnull.class)).isTrue();
283+
assertThat(hasAnnotation(org.springframework.lang.NonNullApi.class, Documented.class)).isTrue();
284+
assertThat(hasAnnotation(org.springframework.lang.NonNullApi.class, Nonnull.class)).isTrue();
284285
assertThat(hasAnnotation(ParametersAreNonnullByDefault.class, Nonnull.class)).isTrue();
285286
}
286287

@@ -344,9 +345,10 @@ void getAllAnnotationAttributesOnClassWithMultipleComposedAnnotations() {
344345
}
345346

346347
@Test
348+
@SuppressWarnings("deprecation")
347349
void getAllAnnotationAttributesOnLangType() {
348350
MultiValueMap<String, Object> attributes = getAllAnnotationAttributes(
349-
NonNullApi.class, Nonnull.class.getName());
351+
org.springframework.lang.NonNullApi.class, Nonnull.class.getName());
350352
assertThat(attributes).as("Annotation attributes map for @Nonnull on NonNullApi").isNotNull();
351353
assertThat(attributes.get("when")).as("value for NonNullApi").isEqualTo(List.of(When.ALWAYS));
352354
}

spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletAnnotationControllerHandlerMethodTests.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -2905,7 +2905,7 @@ public View resolveViewName(final String viewName, Locale locale) throws Excepti
29052905
tb = (TestBean) model.get("myCommand");
29062906
}
29072907
if (tb.getName() != null && tb.getName().endsWith("myDefaultName")) {
2908-
assertThat(tb.getDate().getYear()).isEqualTo(107);
2908+
assertThat(tb.getDate()).hasYear(2007);
29092909
}
29102910
Errors errors = (Errors) model.get(BindingResult.MODEL_KEY_PREFIX + "testBean");
29112911
if (errors == null) {
@@ -2915,8 +2915,7 @@ public View resolveViewName(final String viewName, Locale locale) throws Excepti
29152915
throw new IllegalStateException();
29162916
}
29172917
if (model.containsKey("ITestBean")) {
2918-
boolean condition = model.get(BindingResult.MODEL_KEY_PREFIX + "ITestBean") instanceof Errors;
2919-
assertThat(condition).isTrue();
2918+
assertThat(model.get(BindingResult.MODEL_KEY_PREFIX + "ITestBean")).isInstanceOf(Errors.class);
29202919
}
29212920
@SuppressWarnings("unchecked")
29222921
List<TestBean> testBeans = (List<TestBean>) model.get("testBeanList");
@@ -2939,8 +2938,8 @@ static class ModelExposingViewResolver implements ViewResolver {
29392938
@Override
29402939
public View resolveViewName(String viewName, Locale locale) {
29412940
return (model, request, response) -> {
2942-
request.setAttribute("viewName", viewName);
2943-
request.getSession().setAttribute("model", model);
2941+
request.setAttribute("viewName", viewName);
2942+
request.getSession().setAttribute("model", model);
29442943
};
29452944
}
29462945
}

0 commit comments

Comments
 (0)