From b33d2fe683967081527c8114351f2b1493e90d3c Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Wed, 24 Jun 2020 14:31:57 +0200 Subject: [PATCH] Clean up warnings in Gradle build, polishing, etc. --- .../AspectJExpressionPointcutTests.java | 10 +-- .../TrickyAspectJPointcutExpressionTests.java | 6 +- .../annotation/AspectProxyFactoryTests.java | 6 +- .../CustomizableTraceInterceptorTests.java | 2 +- .../namedparam/SqlParameterSourceUtils.java | 3 +- .../support/RSocketMessageHandler.java | 22 +++-- .../orm/hibernate5/HibernateTemplate.java | 90 ++++++++----------- .../MultipartHttpMessageWriterTests.java | 4 +- .../filter/ForwardedHeaderFilterTests.java | 5 +- .../web/servlet/view/RedirectViewTests.java | 1 - .../view/script/ScriptTemplateViewTests.java | 1 - 11 files changed, 67 insertions(+), 83 deletions(-) diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java index 008df78e64d..20f3106c624 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -198,8 +198,8 @@ public class AspectJExpressionPointcutTests { // not currently testable in a reliable fashion //assertDoesNotMatchStringClass(classFilter); - assertThat(methodMatcher.matches(setSomeNumber, TestBean.class, new Double(12))).as("Should match with setSomeNumber with Double input").isTrue(); - assertThat(methodMatcher.matches(setSomeNumber, TestBean.class, new Integer(11))).as("Should not match setSomeNumber with Integer input").isFalse(); + assertThat(methodMatcher.matches(setSomeNumber, TestBean.class, 12D)).as("Should match with setSomeNumber with Double input").isTrue(); + assertThat(methodMatcher.matches(setSomeNumber, TestBean.class, 11)).as("Should not match setSomeNumber with Integer input").isFalse(); assertThat(methodMatcher.matches(getAge, TestBean.class)).as("Should not match getAge").isFalse(); assertThat(methodMatcher.isRuntime()).as("Should be a runtime match").isTrue(); } @@ -224,10 +224,10 @@ public class AspectJExpressionPointcutTests { TestBean testBean = getAdvisedProxy(expression, interceptor); assertThat(interceptor.getCount()).as("Calls should be 0").isEqualTo(0); - testBean.setSomeNumber(new Double(30)); + testBean.setSomeNumber(30D); assertThat(interceptor.getCount()).as("Calls should be 1").isEqualTo(1); - testBean.setSomeNumber(new Integer(90)); + testBean.setSomeNumber(90); assertThat(interceptor.getCount()).as("Calls should be 1").isEqualTo(1); } diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/TrickyAspectJPointcutExpressionTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/TrickyAspectJPointcutExpressionTests.java index bac21dadf9f..7a6c7e93c7b 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/TrickyAspectJPointcutExpressionTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/TrickyAspectJPointcutExpressionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -91,9 +91,8 @@ public class TrickyAspectJPointcutExpressionTests { // Make sure the interface is loaded from the parent class loader loader.excludeClass(TestService.class.getName()); loader.excludeClass(TestException.class.getName()); - TestService other = (TestService) loader.loadClass(TestServiceImpl.class.getName()).newInstance(); + TestService other = (TestService) loader.loadClass(TestServiceImpl.class.getName()).getDeclaredConstructor().newInstance(); testAdvice(new DefaultPointcutAdvisor(pointcut, logAdvice), logAdvice, other, "TestServiceImpl"); - } private void testAdvice(Advisor advisor, LogUserAdvice logAdvice, TestService target, String message) @@ -127,7 +126,6 @@ public class TrickyAspectJPointcutExpressionTests { public SimpleThrowawayClassLoader(ClassLoader parent) { super(parent); } - } diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java index 30ac2adc43f..a00a27bb6de 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java @@ -83,6 +83,7 @@ public class AspectProxyFactoryTests { } @Test + @SuppressWarnings("unchecked") public void testSerializable() throws Exception { AspectJProxyFactory proxyFactory = new AspectJProxyFactory(new TestBean()); proxyFactory.addAspect(LoggingAspectOnVarargs.class); @@ -114,11 +115,11 @@ public class AspectProxyFactoryTests { @Test public void testWithNonSingletonAspectInstance() throws Exception { AspectJProxyFactory pf = new AspectJProxyFactory(); - assertThatIllegalArgumentException().isThrownBy(() -> - pf.addAspect(new PerThisAspect())); + assertThatIllegalArgumentException().isThrownBy(() -> pf.addAspect(new PerThisAspect())); } @Test // SPR-13328 + @SuppressWarnings("unchecked") public void testProxiedVarargsWithEnumArray() throws Exception { AspectJProxyFactory proxyFactory = new AspectJProxyFactory(new TestBean()); proxyFactory.addAspect(LoggingAspectOnVarargs.class); @@ -127,6 +128,7 @@ public class AspectProxyFactoryTests { } @Test // SPR-13328 + @SuppressWarnings("unchecked") public void testUnproxiedVarargsWithEnumArray() throws Exception { AspectJProxyFactory proxyFactory = new AspectJProxyFactory(new TestBean()); proxyFactory.addAspect(LoggingAspectOnSetter.class); diff --git a/spring-aop/src/test/java/org/springframework/aop/interceptor/CustomizableTraceInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/interceptor/CustomizableTraceInterceptorTests.java index d5fcae4bd3c..b98acc38e94 100644 --- a/spring-aop/src/test/java/org/springframework/aop/interceptor/CustomizableTraceInterceptorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/interceptor/CustomizableTraceInterceptorTests.java @@ -136,7 +136,7 @@ public class CustomizableTraceInterceptorTests { given(methodInvocation.getMethod()).willReturn(String.class.getMethod("toString", new Class[0])); given(methodInvocation.getThis()).willReturn(this); - given(methodInvocation.getArguments()).willReturn(new Object[]{"$ One \\$", new Long(2)}); + given(methodInvocation.getArguments()).willReturn(new Object[]{"$ One \\$", 2L}); given(methodInvocation.proceed()).willReturn("Hello!"); Log log = mock(Log.class); diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/SqlParameterSourceUtils.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/SqlParameterSourceUtils.java index bb9a000df3e..4ae12a9533a 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/SqlParameterSourceUtils.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/SqlParameterSourceUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,7 +44,6 @@ public abstract class SqlParameterSourceUtils { * @see BeanPropertySqlParameterSource * @see NamedParameterJdbcTemplate#batchUpdate(String, SqlParameterSource[]) */ - @SuppressWarnings("unchecked") public static SqlParameterSource[] createBatch(Object... candidates) { return createBatch(Arrays.asList(candidates)); } diff --git a/spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/RSocketMessageHandler.java b/spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/RSocketMessageHandler.java index 919e392d8dc..890bb3d99c6 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/RSocketMessageHandler.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/RSocketMessageHandler.java @@ -71,10 +71,9 @@ import org.springframework.util.StringUtils; * {@link SocketAcceptor} adapter to register with the * {@link io.rsocket.core.RSocketServer}. * - *

For a client, possibly in the same process as a server, consider - * consider using the static factory method - * {@link #responder(RSocketStrategies, Object...)} to obtain a client - * responder to be registered via + *

For a client, possibly in the same process as a server, consider using the + * static factory method {@link #responder(RSocketStrategies, Object...)} to + * obtain a client responder to be registered via * {@link org.springframework.messaging.rsocket.RSocketRequester.Builder#rsocketConnector * RSocketRequester.Builder}. * @@ -500,8 +499,8 @@ public class RSocketMessageHandler extends MessageMappingMessageHandler { * annotated handler methods. This is intended to be passed into * {@link org.springframework.messaging.rsocket.RSocketRequester.Builder#rsocketFactory}. *

In effect a shortcut to create and initialize - * {@code RSocketMessageHandler} with the given strategies and handlers, - * use {@link #responder()} to obtain the responder, and plug that into + * {@code RSocketMessageHandler} with the given strategies and handlers. + * Use {@link #responder()} to obtain the responder and plug that into * {@link io.rsocket.RSocketFactory.ClientRSocketFactory ClientRSocketFactory}. * For more advanced scenarios, e.g. discovering handlers through a custom * stereotype annotation, consider declaring {@code RSocketMessageHandler} @@ -509,15 +508,16 @@ public class RSocketMessageHandler extends MessageMappingMessageHandler { * @param strategies the strategies to set on the created * {@code RSocketMessageHandler} * @param candidateHandlers a list of Objects and/or Classes with annotated - * handler methods; used to call {@link #setHandlers(List)} with - * on the created {@code RSocketMessageHandler} + * handler methods; used to call {@link #setHandlers(List)} on the created + * {@code RSocketMessageHandler} * @return a configurer that may be passed into * {@link org.springframework.messaging.rsocket.RSocketRequester.Builder#rsocketFactory} - * @deprecated as of 5.2.6 following the deprecation of + * @deprecated as of 5.2.6 following the deprecation of * {@link io.rsocket.RSocketFactory.ClientRSocketFactory RSocketFactory.ClientRSocketFactory} - * in RSocket 1.0 RC7. + * in RSocket 1.0 RC7 */ @Deprecated + @SuppressWarnings("deprecation") public static org.springframework.messaging.rsocket.ClientRSocketFactoryConfigurer clientResponder( RSocketStrategies strategies, Object... candidateHandlers) { @@ -536,5 +536,3 @@ public class RSocketMessageHandler extends MessageMappingMessageHandler { }; } } - - diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate5/HibernateTemplate.java b/spring-orm/src/main/java/org/springframework/orm/hibernate5/HibernateTemplate.java index b025de49003..75978df75c3 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate5/HibernateTemplate.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate5/HibernateTemplate.java @@ -149,7 +149,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean * Set the Hibernate SessionFactory that should be used to create * Hibernate Sessions. */ - public void setSessionFactory(@Nullable SessionFactory sessionFactory) { + public void setSessionFactory(@Nullable SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } @@ -184,7 +184,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean * @see #enableFilters(Session) * @see Session#enableFilter(String) */ - public void setFilterNames(@Nullable String... filterNames) { + public void setFilterNames(@Nullable String... filterNames) { this.filterNames = filterNames; } @@ -465,9 +465,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean @Override @Nullable - public T get(final Class entityClass, final Serializable id, @Nullable final LockMode lockMode) - throws DataAccessException { - + public T get(Class entityClass, Serializable id, @Nullable LockMode lockMode) throws DataAccessException { return executeWithNativeSession(session -> { if (lockMode != null) { return session.get(entityClass, id, new LockOptions(lockMode)); @@ -486,9 +484,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean @Override @Nullable - public Object get(final String entityName, final Serializable id, @Nullable final LockMode lockMode) - throws DataAccessException { - + public Object get(String entityName, Serializable id, @Nullable LockMode lockMode) throws DataAccessException { return executeWithNativeSession(session -> { if (lockMode != null) { return session.get(entityName, id, new LockOptions(lockMode)); @@ -505,7 +501,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean } @Override - public T load(final Class entityClass, final Serializable id, @Nullable final LockMode lockMode) + public T load(Class entityClass, Serializable id, @Nullable LockMode lockMode) throws DataAccessException { return nonNull(executeWithNativeSession(session -> { @@ -524,9 +520,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean } @Override - public Object load(final String entityName, final Serializable id, @Nullable final LockMode lockMode) - throws DataAccessException { - + public Object load(String entityName, Serializable id, @Nullable LockMode lockMode) throws DataAccessException { return nonNull(executeWithNativeSession(session -> { if (lockMode != null) { return session.load(entityName, id, new LockOptions(lockMode)); @@ -539,7 +533,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean @Override @SuppressWarnings({"unchecked", "deprecation"}) - public List loadAll(final Class entityClass) throws DataAccessException { + public List loadAll(Class entityClass) throws DataAccessException { return nonNull(executeWithNativeSession((HibernateCallback>) session -> { Criteria criteria = session.createCriteria(entityClass); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); @@ -550,7 +544,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean @Override @SuppressWarnings({"deprecation"}) - public void load(final Object entity, final Serializable id) throws DataAccessException { + public void load(Object entity, Serializable id) throws DataAccessException { executeWithNativeSession(session -> { session.load(entity, id); return null; @@ -558,12 +552,12 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean } @Override - public void refresh(final Object entity) throws DataAccessException { + public void refresh(Object entity) throws DataAccessException { refresh(entity, null); } @Override - public void refresh(final Object entity, @Nullable final LockMode lockMode) throws DataAccessException { + public void refresh(Object entity, @Nullable LockMode lockMode) throws DataAccessException { executeWithNativeSession(session -> { if (lockMode != null) { session.refresh(entity, new LockOptions(lockMode)); @@ -576,14 +570,14 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean } @Override - public boolean contains(final Object entity) throws DataAccessException { + public boolean contains(Object entity) throws DataAccessException { Boolean result = executeWithNativeSession(session -> session.contains(entity)); Assert.state(result != null, "No contains result"); return result; } @Override - public void evict(final Object entity) throws DataAccessException { + public void evict(Object entity) throws DataAccessException { executeWithNativeSession(session -> { session.evict(entity); return null; @@ -616,7 +610,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean //------------------------------------------------------------------------- @Override - public void lock(final Object entity, final LockMode lockMode) throws DataAccessException { + public void lock(Object entity, LockMode lockMode) throws DataAccessException { executeWithNativeSession(session -> { session.buildLockRequest(new LockOptions(lockMode)).lock(entity); return null; @@ -624,7 +618,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean } @Override - public void lock(final String entityName, final Object entity, final LockMode lockMode) + public void lock(String entityName, Object entity, LockMode lockMode) throws DataAccessException { executeWithNativeSession(session -> { @@ -634,7 +628,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean } @Override - public Serializable save(final Object entity) throws DataAccessException { + public Serializable save(Object entity) throws DataAccessException { return nonNull(executeWithNativeSession(session -> { checkWriteOperationAllowed(session); return session.save(entity); @@ -642,7 +636,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean } @Override - public Serializable save(final String entityName, final Object entity) throws DataAccessException { + public Serializable save(String entityName, Object entity) throws DataAccessException { return nonNull(executeWithNativeSession(session -> { checkWriteOperationAllowed(session); return session.save(entityName, entity); @@ -655,7 +649,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean } @Override - public void update(final Object entity, @Nullable final LockMode lockMode) throws DataAccessException { + public void update(Object entity, @Nullable LockMode lockMode) throws DataAccessException { executeWithNativeSession(session -> { checkWriteOperationAllowed(session); session.update(entity); @@ -672,7 +666,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean } @Override - public void update(final String entityName, final Object entity, @Nullable final LockMode lockMode) + public void update(String entityName, Object entity, @Nullable LockMode lockMode) throws DataAccessException { executeWithNativeSession(session -> { @@ -686,7 +680,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean } @Override - public void saveOrUpdate(final Object entity) throws DataAccessException { + public void saveOrUpdate(Object entity) throws DataAccessException { executeWithNativeSession(session -> { checkWriteOperationAllowed(session); session.saveOrUpdate(entity); @@ -695,7 +689,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean } @Override - public void saveOrUpdate(final String entityName, final Object entity) throws DataAccessException { + public void saveOrUpdate(String entityName, Object entity) throws DataAccessException { executeWithNativeSession(session -> { checkWriteOperationAllowed(session); session.saveOrUpdate(entityName, entity); @@ -704,9 +698,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean } @Override - public void replicate(final Object entity, final ReplicationMode replicationMode) - throws DataAccessException { - + public void replicate(Object entity, ReplicationMode replicationMode) throws DataAccessException { executeWithNativeSession(session -> { checkWriteOperationAllowed(session); session.replicate(entity, replicationMode); @@ -715,7 +707,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean } @Override - public void replicate(final String entityName, final Object entity, final ReplicationMode replicationMode) + public void replicate(String entityName, Object entity, ReplicationMode replicationMode) throws DataAccessException { executeWithNativeSession(session -> { @@ -726,7 +718,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean } @Override - public void persist(final Object entity) throws DataAccessException { + public void persist(Object entity) throws DataAccessException { executeWithNativeSession(session -> { checkWriteOperationAllowed(session); session.persist(entity); @@ -735,7 +727,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean } @Override - public void persist(final String entityName, final Object entity) throws DataAccessException { + public void persist(String entityName, Object entity) throws DataAccessException { executeWithNativeSession(session -> { checkWriteOperationAllowed(session); session.persist(entityName, entity); @@ -745,7 +737,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean @Override @SuppressWarnings("unchecked") - public T merge(final T entity) throws DataAccessException { + public T merge(T entity) throws DataAccessException { return nonNull(executeWithNativeSession(session -> { checkWriteOperationAllowed(session); return (T) session.merge(entity); @@ -754,7 +746,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean @Override @SuppressWarnings("unchecked") - public T merge(final String entityName, final T entity) throws DataAccessException { + public T merge(String entityName, T entity) throws DataAccessException { return nonNull(executeWithNativeSession(session -> { checkWriteOperationAllowed(session); return (T) session.merge(entityName, entity); @@ -767,7 +759,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean } @Override - public void delete(final Object entity, @Nullable final LockMode lockMode) throws DataAccessException { + public void delete(Object entity, @Nullable LockMode lockMode) throws DataAccessException { executeWithNativeSession(session -> { checkWriteOperationAllowed(session); if (lockMode != null) { @@ -784,7 +776,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean } @Override - public void delete(final String entityName, final Object entity, @Nullable final LockMode lockMode) + public void delete(String entityName, Object entity, @Nullable LockMode lockMode) throws DataAccessException { executeWithNativeSession(session -> { @@ -798,7 +790,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean } @Override - public void deleteAll(final Collection entities) throws DataAccessException { + public void deleteAll(Collection entities) throws DataAccessException { executeWithNativeSession(session -> { checkWriteOperationAllowed(session); for (Object entity : entities) { @@ -835,8 +827,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean } @Override - @SuppressWarnings("unchecked") - public List findByCriteria(final DetachedCriteria criteria, final int firstResult, final int maxResults) + public List findByCriteria(DetachedCriteria criteria, int firstResult, int maxResults) throws DataAccessException { Assert.notNull(criteria, "DetachedCriteria must not be null"); @@ -870,8 +861,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean @Override @SuppressWarnings({"unchecked", "deprecation"}) - public List findByExample( - @Nullable final String entityName, final T exampleEntity, final int firstResult, final int maxResults) + public List findByExample(@Nullable String entityName, T exampleEntity, int firstResult, int maxResults) throws DataAccessException { Assert.notNull(exampleEntity, "Example entity must not be null"); @@ -898,7 +888,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean @Deprecated @Override @SuppressWarnings({"rawtypes", "unchecked", "deprecation"}) - public List find(final String queryString, @Nullable final Object... values) throws DataAccessException { + public List find(String queryString, @Nullable Object... values) throws DataAccessException { return nonNull(executeWithNativeSession((HibernateCallback>) session -> { org.hibernate.Query queryObject = queryObject( ReflectionUtils.invokeMethod(createQueryMethod, session, queryString)); @@ -923,7 +913,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean @Deprecated @Override @SuppressWarnings({"rawtypes", "unchecked", "deprecation"}) - public List findByNamedParam(final String queryString, final String[] paramNames, final Object[] values) + public List findByNamedParam(String queryString, String[] paramNames, Object[] values) throws DataAccessException { if (paramNames.length != values.length) { @@ -943,8 +933,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean @Deprecated @Override @SuppressWarnings({"rawtypes", "unchecked", "deprecation"}) - public List findByValueBean(final String queryString, final Object valueBean) - throws DataAccessException { + public List findByValueBean(String queryString, Object valueBean) throws DataAccessException { return nonNull(executeWithNativeSession((HibernateCallback>) session -> { org.hibernate.Query queryObject = queryObject( @@ -963,7 +952,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean @Deprecated @Override @SuppressWarnings({"rawtypes", "unchecked", "deprecation"}) - public List findByNamedQuery(final String queryName, @Nullable final Object... values) throws DataAccessException { + public List findByNamedQuery(String queryName, @Nullable Object... values) throws DataAccessException { return nonNull(executeWithNativeSession((HibernateCallback>) session -> { org.hibernate.Query queryObject = queryObject( ReflectionUtils.invokeMethod(getNamedQueryMethod, session, queryName)); @@ -989,7 +978,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean @Override @SuppressWarnings({"rawtypes", "unchecked", "deprecation"}) public List findByNamedQueryAndNamedParam( - final String queryName, @Nullable final String[] paramNames, @Nullable final Object[] values) + String queryName, @Nullable String[] paramNames, @Nullable Object[] values) throws DataAccessException { if (values != null && (paramNames == null || paramNames.length != values.length)) { @@ -1011,8 +1000,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean @Deprecated @Override @SuppressWarnings({"rawtypes", "unchecked", "deprecation"}) - public List findByNamedQueryAndValueBean(final String queryName, final Object valueBean) - throws DataAccessException { + public List findByNamedQueryAndValueBean(String queryName, Object valueBean) throws DataAccessException { return nonNull(executeWithNativeSession((HibernateCallback>) session -> { org.hibernate.Query queryObject = queryObject( @@ -1031,7 +1019,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean @Deprecated @Override @SuppressWarnings({"rawtypes", "deprecation"}) - public Iterator iterate(final String queryString, @Nullable final Object... values) throws DataAccessException { + public Iterator iterate(String queryString, @Nullable Object... values) throws DataAccessException { return nonNull(executeWithNativeSession((HibernateCallback>) session -> { org.hibernate.Query queryObject = queryObject( ReflectionUtils.invokeMethod(createQueryMethod, session, queryString)); @@ -1059,7 +1047,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean @Deprecated @Override @SuppressWarnings({"rawtypes", "deprecation"}) - public int bulkUpdate(final String queryString, @Nullable final Object... values) throws DataAccessException { + public int bulkUpdate(String queryString, @Nullable Object... values) throws DataAccessException { Integer result = executeWithNativeSession(session -> { org.hibernate.Query queryObject = queryObject( ReflectionUtils.invokeMethod(createQueryMethod, session, queryString)); diff --git a/spring-web/src/test/java/org/springframework/http/codec/multipart/MultipartHttpMessageWriterTests.java b/spring-web/src/test/java/org/springframework/http/codec/multipart/MultipartHttpMessageWriterTests.java index 047ce1996e8..6f5e5cc4884 100644 --- a/spring-web/src/test/java/org/springframework/http/codec/multipart/MultipartHttpMessageWriterTests.java +++ b/spring-web/src/test/java/org/springframework/http/codec/multipart/MultipartHttpMessageWriterTests.java @@ -27,7 +27,6 @@ import org.junit.jupiter.api.Test; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.core.publisher.Sinks; -import reactor.core.publisher.UnicastProcessor; import org.springframework.core.ResolvableType; import org.springframework.core.codec.StringDecoder; @@ -233,7 +232,8 @@ public class MultipartHttpMessageWriterTests extends AbstractLeakCheckingTests { @Test // SPR-16402 public void singleSubscriberWithStrings() { - UnicastProcessor processor = UnicastProcessor.create(); + @SuppressWarnings("deprecation") + reactor.core.publisher.UnicastProcessor processor = reactor.core.publisher.UnicastProcessor.create(); Flux.just("foo", "bar", "baz").subscribe(processor); MultipartBodyBuilder bodyBuilder = new MultipartBodyBuilder(); diff --git a/spring-web/src/test/java/org/springframework/web/filter/ForwardedHeaderFilterTests.java b/spring-web/src/test/java/org/springframework/web/filter/ForwardedHeaderFilterTests.java index 1c42f0ea8b9..cd1f6bbad89 100644 --- a/spring-web/src/test/java/org/springframework/web/filter/ForwardedHeaderFilterTests.java +++ b/spring-web/src/test/java/org/springframework/web/filter/ForwardedHeaderFilterTests.java @@ -64,10 +64,11 @@ public class ForwardedHeaderFilterTests { private final ForwardedHeaderFilter filter = new ForwardedHeaderFilter(); - private MockHttpServletRequest request; - + @SuppressWarnings("serial") private final MockFilterChain filterChain = new MockFilterChain(new HttpServlet() {}); + private MockHttpServletRequest request; + @BeforeEach @SuppressWarnings("serial") diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/RedirectViewTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/RedirectViewTests.java index 220fb300fef..50e0638500d 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/RedirectViewTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/RedirectViewTests.java @@ -138,7 +138,6 @@ public class RedirectViewTests { } @Test - @SuppressWarnings("AssertEqualsBetweenInconvertibleTypes") public void flashMap() throws Exception { RedirectView rv = new RedirectView(); rv.setUrl("https://url.somewhere.com/path"); diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/script/ScriptTemplateViewTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/script/ScriptTemplateViewTests.java index 848dc219f11..3e35cf26cb0 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/script/ScriptTemplateViewTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/script/ScriptTemplateViewTests.java @@ -304,7 +304,6 @@ public class ScriptTemplateViewTests { assertThat(accessor.getPropertyValue("sharedEngine")).isEqualTo(true); } - @SuppressWarnings("unchecked") @Test // gh-23258 public void engineSupplierWithNonSharedEngine() { this.configurer.setEngineSupplier(() -> mock(InvocableScriptEngine.class));