From 483985b173bd365883a5b0d184e1b9877668f50f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Wed, 8 Jan 2025 18:38:48 +0100 Subject: [PATCH] Suppress serialization warnings This commit suppresses serialization warnings triggered by the upgrade of javac from 17 to 23. See gh-34220 --- .../org/springframework/aop/framework/AdvisedSupport.java | 5 +++++ .../aop/target/AbstractBeanFactoryBasedTargetSource.java | 3 ++- .../src/main/java/org/springframework/util/MimeType.java | 1 + .../springframework/util/UnmodifiableMultiValueMap.java | 3 +++ .../test/context/MergedContextConfiguration.java | 7 ++++++- 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/AdvisedSupport.java b/spring-aop/src/main/java/org/springframework/aop/framework/AdvisedSupport.java index 72a9d07d41e..617dd7234e5 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/AdvisedSupport.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/AdvisedSupport.java @@ -79,24 +79,28 @@ public class AdvisedSupport extends ProxyConfig implements Advised { /** Package-protected to allow direct access for efficiency. */ + @SuppressWarnings("serial") TargetSource targetSource = EMPTY_TARGET_SOURCE; /** Whether the Advisors are already filtered for the specific target class. */ private boolean preFiltered = false; /** The AdvisorChainFactory to use. */ + @SuppressWarnings("serial") private AdvisorChainFactory advisorChainFactory = DefaultAdvisorChainFactory.INSTANCE; /** * Interfaces to be implemented by the proxy. Held in List to keep the order * of registration, to create JDK proxy with specified order of interfaces. */ + @SuppressWarnings("serial") private List> interfaces = new ArrayList<>(); /** * List of Advisors. If an Advice is added, it will be wrapped * in an Advisor before being added to this List. */ + @SuppressWarnings("serial") private List advisors = new ArrayList<>(); /** @@ -105,6 +109,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised { * @since 6.0.10 * @see #reduceToAdvisorKey */ + @SuppressWarnings("serial") private List advisorKey = this.advisors; /** Cache with Method as key and advisor chain List as value. */ diff --git a/spring-aop/src/main/java/org/springframework/aop/target/AbstractBeanFactoryBasedTargetSource.java b/spring-aop/src/main/java/org/springframework/aop/target/AbstractBeanFactoryBasedTargetSource.java index 55930b639f0..ab40e00cce5 100644 --- a/spring-aop/src/main/java/org/springframework/aop/target/AbstractBeanFactoryBasedTargetSource.java +++ b/spring-aop/src/main/java/org/springframework/aop/target/AbstractBeanFactoryBasedTargetSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 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. @@ -69,6 +69,7 @@ public abstract class AbstractBeanFactoryBasedTargetSource implements TargetSour * BeanFactory that owns this TargetSource. We need to hold onto this * reference so that we can create new prototype instances as necessary. */ + @SuppressWarnings("serial") private @Nullable BeanFactory beanFactory; diff --git a/spring-core/src/main/java/org/springframework/util/MimeType.java b/spring-core/src/main/java/org/springframework/util/MimeType.java index 4ced66b0103..20d51a5b0a4 100644 --- a/spring-core/src/main/java/org/springframework/util/MimeType.java +++ b/spring-core/src/main/java/org/springframework/util/MimeType.java @@ -101,6 +101,7 @@ public class MimeType implements Comparable, Serializable { private final String subtype; + @SuppressWarnings("serial") private final Map parameters; private transient @Nullable Charset resolvedCharset; diff --git a/spring-core/src/main/java/org/springframework/util/UnmodifiableMultiValueMap.java b/spring-core/src/main/java/org/springframework/util/UnmodifiableMultiValueMap.java index b7b8ff7778b..7cd5f5ab154 100644 --- a/spring-core/src/main/java/org/springframework/util/UnmodifiableMultiValueMap.java +++ b/spring-core/src/main/java/org/springframework/util/UnmodifiableMultiValueMap.java @@ -47,6 +47,7 @@ final class UnmodifiableMultiValueMap implements MultiValueMap, Serial private static final long serialVersionUID = -8697084563854098920L; + @SuppressWarnings("serial") private final MultiValueMap delegate; private transient @Nullable Set keySet; @@ -264,6 +265,7 @@ final class UnmodifiableMultiValueMap implements MultiValueMap, Serial private static final long serialVersionUID = 2407578793783925203L; + @SuppressWarnings("serial") private final Set>> delegate; @SuppressWarnings("unchecked") @@ -512,6 +514,7 @@ final class UnmodifiableMultiValueMap implements MultiValueMap, Serial private static final long serialVersionUID = 5518377583904339588L; + @SuppressWarnings("serial") private final Collection> delegate; public UnmodifiableValueCollection(Collection> delegate) { diff --git a/spring-test/src/main/java/org/springframework/test/context/MergedContextConfiguration.java b/spring-test/src/main/java/org/springframework/test/context/MergedContextConfiguration.java index 4815180f7e5..99eea9824f0 100644 --- a/spring-test/src/main/java/org/springframework/test/context/MergedContextConfiguration.java +++ b/spring-test/src/main/java/org/springframework/test/context/MergedContextConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 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. @@ -89,20 +89,25 @@ public class MergedContextConfiguration implements Serializable { private final Class[] classes; + @SuppressWarnings("serial") private final Set>> contextInitializerClasses; private final String[] activeProfiles; + @SuppressWarnings("serial") private final List propertySourceDescriptors; private final String[] propertySourceLocations; private final String[] propertySourceProperties; + @SuppressWarnings("serial") private final Set contextCustomizers; + @SuppressWarnings("serial") private final ContextLoader contextLoader; + @SuppressWarnings("serial") private final @Nullable CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate; private final @Nullable MergedContextConfiguration parent;