Skip to content

Commit 7635ac3

Browse files
committed
Use uppercase for classpath-related static final field names
Closes gh-35525
1 parent 5ac3c40 commit 7635ac3

File tree

76 files changed

+451
-450
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+451
-450
lines changed

spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectJAdvisorBeanRegistrationAotProcessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ class AspectJAdvisorBeanRegistrationAotProcessor implements BeanRegistrationAotP
3939

4040
private static final String AJC_MAGIC = "ajc$";
4141

42-
private static final boolean aspectjPresent = ClassUtils.isPresent("org.aspectj.lang.annotation.Pointcut",
42+
private static final boolean ASPECTJ_PRESENT = ClassUtils.isPresent("org.aspectj.lang.annotation.Pointcut",
4343
AspectJAdvisorBeanRegistrationAotProcessor.class.getClassLoader());
4444

4545

4646
@Override
4747
public @Nullable BeanRegistrationAotContribution processAheadOfTime(RegisteredBean registeredBean) {
48-
if (aspectjPresent) {
48+
if (ASPECTJ_PRESENT) {
4949
Class<?> beanClass = registeredBean.getBeanClass();
5050
if (compiledByAjc(beanClass)) {
5151
return new AspectJAdvisorContribution(beanClass);

spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectJBeanFactoryInitializationAotProcessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@
4141
*/
4242
class AspectJBeanFactoryInitializationAotProcessor implements BeanFactoryInitializationAotProcessor {
4343

44-
private static final boolean aspectJPresent = ClassUtils.isPresent("org.aspectj.lang.annotation.Pointcut",
44+
private static final boolean ASPECTJ_PRESENT = ClassUtils.isPresent("org.aspectj.lang.annotation.Pointcut",
4545
AspectJBeanFactoryInitializationAotProcessor.class.getClassLoader());
4646

4747

4848
@Override
4949
public @Nullable BeanFactoryInitializationAotContribution processAheadOfTime(ConfigurableListableBeanFactory beanFactory) {
50-
if (aspectJPresent) {
50+
if (ASPECTJ_PRESENT) {
5151
return AspectDelegate.processAheadOfTime(beanFactory);
5252
}
5353
return null;

spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class CglibAopProxy implements AopProxy, Serializable {
9898

9999
private static final String COROUTINES_FLOW_CLASS_NAME = "kotlinx.coroutines.flow.Flow";
100100

101-
private static final boolean coroutinesReactorPresent = ClassUtils.isPresent(
101+
private static final boolean COROUTINES_REACTOR_PRESENT = ClassUtils.isPresent(
102102
"kotlinx.coroutines.reactor.MonoKt", CglibAopProxy.class.getClassLoader());
103103

104104
private static final GeneratorStrategy undeclaredThrowableStrategy =
@@ -435,7 +435,7 @@ private static boolean implementsInterface(Method method, Set<Class<?>> ifcs) {
435435
throw new AopInvocationException(
436436
"Null return value from advice does not match primitive return type for: " + method);
437437
}
438-
if (coroutinesReactorPresent && KotlinDetector.isSuspendingFunction(method)) {
438+
if (COROUTINES_REACTOR_PRESENT && KotlinDetector.isSuspendingFunction(method)) {
439439
return COROUTINES_FLOW_CLASS_NAME.equals(new MethodParameter(method, -1).getParameterType().getName()) ?
440440
CoroutinesUtils.asFlow(returnValue) :
441441
CoroutinesUtils.awaitSingleOrNull(returnValue, arguments[arguments.length - 1]);

spring-aop/src/main/java/org/springframework/aop/framework/JdkDynamicAopProxy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ final class JdkDynamicAopProxy implements AopProxy, InvocationHandler, Serializa
7575

7676
private static final String COROUTINES_FLOW_CLASS_NAME = "kotlinx.coroutines.flow.Flow";
7777

78-
private static final boolean coroutinesReactorPresent = ClassUtils.isPresent(
78+
private static final boolean COROUTINES_REACTOR_PRESENT = ClassUtils.isPresent(
7979
"kotlinx.coroutines.reactor.MonoKt", JdkDynamicAopProxy.class.getClassLoader());
8080

8181
/** We use a static Log to avoid serialization issues. */
@@ -236,7 +236,7 @@ else if (retVal == null && returnType != void.class && returnType.isPrimitive())
236236
throw new AopInvocationException(
237237
"Null return value from advice does not match primitive return type for: " + method);
238238
}
239-
if (coroutinesReactorPresent && KotlinDetector.isSuspendingFunction(method)) {
239+
if (COROUTINES_REACTOR_PRESENT && KotlinDetector.isSuspendingFunction(method)) {
240240
return COROUTINES_FLOW_CLASS_NAME.equals(new MethodParameter(method, -1).getParameterType().getName()) ?
241241
CoroutinesUtils.asFlow(retVal) : CoroutinesUtils.awaitSingleOrNull(retVal, args[args.length - 1]);
242242
}

spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
*/
6767
public abstract class AopUtils {
6868

69-
private static final boolean coroutinesReactorPresent = ClassUtils.isPresent(
69+
private static final boolean COROUTINES_REACTOR_PRESENT = ClassUtils.isPresent(
7070
"kotlinx.coroutines.reactor.MonoKt", AopUtils.class.getClassLoader());
7171

7272

@@ -355,7 +355,7 @@ public static List<Advisor> findAdvisorsThatCanApply(List<Advisor> candidateAdvi
355355
try {
356356
Method originalMethod = BridgeMethodResolver.findBridgedMethod(method);
357357
ReflectionUtils.makeAccessible(originalMethod);
358-
return (coroutinesReactorPresent && KotlinDetector.isSuspendingFunction(originalMethod) ?
358+
return (COROUTINES_REACTOR_PRESENT && KotlinDetector.isSuspendingFunction(originalMethod) ?
359359
KotlinDelegate.invokeSuspendingFunction(originalMethod, target, args) : originalMethod.invoke(target, args));
360360
}
361361
catch (InvocationTargetException ex) {

spring-beans/src/main/java/org/springframework/beans/factory/support/DisposableBeanAdapter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class DisposableBeanAdapter implements DisposableBean, Runnable, Serializable {
7676

7777
private static final Log logger = LogFactory.getLog(DisposableBeanAdapter.class);
7878

79-
private static final boolean reactiveStreamsPresent = ClassUtils.isPresent(
79+
private static final boolean REACTIVE_STREAMS_PRESENT = ClassUtils.isPresent(
8080
"org.reactivestreams.Publisher", DisposableBeanAdapter.class.getClassLoader());
8181

8282

@@ -320,7 +320,7 @@ else if (returnValue instanceof Future<?> future) {
320320
future.get();
321321
logDestroyMethodCompletion(destroyMethod, true);
322322
}
323-
else if (!reactiveStreamsPresent || !new ReactiveDestroyMethodHandler().await(destroyMethod, returnValue)) {
323+
else if (!REACTIVE_STREAMS_PRESENT || !new ReactiveDestroyMethodHandler().await(destroyMethod, returnValue)) {
324324
if (logger.isDebugEnabled()) {
325325
logger.debug("Unknown return value type from custom destroy method '" + destroyMethod.getName() +
326326
"' on bean with name '" + this.beanName + "': " + returnValue.getClass());

spring-context/src/main/java/org/springframework/cache/annotation/CachingConfigurationSelector.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ public class CachingConfigurationSelector extends AdviceModeImportSelector<Enabl
5050
"org.springframework.cache.aspectj.AspectJJCacheConfiguration";
5151

5252

53-
private static final boolean jsr107Present;
53+
private static final boolean JSR_107_PRESENT;
5454

55-
private static final boolean jcacheImplPresent;
55+
private static final boolean JCACHE_IMPL_PRESENT;
5656

5757
static {
5858
ClassLoader classLoader = CachingConfigurationSelector.class.getClassLoader();
59-
jsr107Present = ClassUtils.isPresent("javax.cache.Cache", classLoader);
60-
jcacheImplPresent = ClassUtils.isPresent(PROXY_JCACHE_CONFIGURATION_CLASS, classLoader);
59+
JSR_107_PRESENT = ClassUtils.isPresent("javax.cache.Cache", classLoader);
60+
JCACHE_IMPL_PRESENT = ClassUtils.isPresent(PROXY_JCACHE_CONFIGURATION_CLASS, classLoader);
6161
}
6262

6363

@@ -82,7 +82,7 @@ private String[] getProxyImports() {
8282
List<String> result = new ArrayList<>(3);
8383
result.add(AutoProxyRegistrar.class.getName());
8484
result.add(ProxyCachingConfiguration.class.getName());
85-
if (jsr107Present && jcacheImplPresent) {
85+
if (JSR_107_PRESENT && JCACHE_IMPL_PRESENT) {
8686
result.add(PROXY_JCACHE_CONFIGURATION_CLASS);
8787
}
8888
return StringUtils.toStringArray(result);
@@ -95,7 +95,7 @@ private String[] getProxyImports() {
9595
private String[] getAspectJImports() {
9696
List<String> result = new ArrayList<>(2);
9797
result.add(CACHE_ASPECT_CONFIGURATION_CLASS_NAME);
98-
if (jsr107Present && jcacheImplPresent) {
98+
if (JSR_107_PRESENT && JCACHE_IMPL_PRESENT) {
9999
result.add(JCACHE_ASPECT_CONFIGURATION_CLASS_NAME);
100100
}
101101
return StringUtils.toStringArray(result);

spring-context/src/main/java/org/springframework/cache/config/AnnotationDrivenCacheBeanDefinitionParser.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser
6161
private static final String JCACHE_ASPECT_CLASS_NAME =
6262
"org.springframework.cache.aspectj.JCacheCacheAspect";
6363

64-
private static final boolean jsr107Present;
64+
private static final boolean JSR_107_PRESENT;
6565

66-
private static final boolean jcacheImplPresent;
66+
private static final boolean JCACHE_IMPL_PRESENT;
6767

6868
static {
6969
ClassLoader classLoader = AnnotationDrivenCacheBeanDefinitionParser.class.getClassLoader();
70-
jsr107Present = ClassUtils.isPresent("javax.cache.Cache", classLoader);
71-
jcacheImplPresent = ClassUtils.isPresent(
70+
JSR_107_PRESENT = ClassUtils.isPresent("javax.cache.Cache", classLoader);
71+
JCACHE_IMPL_PRESENT = ClassUtils.isPresent(
7272
"org.springframework.cache.jcache.interceptor.DefaultJCacheOperationSource", classLoader);
7373
}
7474

@@ -95,15 +95,15 @@ class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser
9595

9696
private void registerCacheAspect(Element element, ParserContext parserContext) {
9797
SpringCachingConfigurer.registerCacheAspect(element, parserContext);
98-
if (jsr107Present && jcacheImplPresent) {
98+
if (JSR_107_PRESENT && JCACHE_IMPL_PRESENT) {
9999
JCacheCachingConfigurer.registerCacheAspect(element, parserContext);
100100
}
101101
}
102102

103103
private void registerCacheAdvisor(Element element, ParserContext parserContext) {
104104
AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(parserContext, element);
105105
SpringCachingConfigurer.registerCacheAdvisor(element, parserContext);
106-
if (jsr107Present && jcacheImplPresent) {
106+
if (JSR_107_PRESENT && JCACHE_IMPL_PRESENT) {
107107
JCacheCachingConfigurer.registerCacheAdvisor(element, parserContext);
108108
}
109109
}

spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
114114
*/
115115
public static final String IGNORE_REACTIVESTREAMS_PROPERTY_NAME = "spring.cache.reactivestreams.ignore";
116116

117-
private static final boolean shouldIgnoreReactiveStreams =
117+
private static final boolean SHOULD_IGNORE_REACTIVE_STREAMS =
118118
SpringProperties.getFlag(IGNORE_REACTIVESTREAMS_PROPERTY_NAME);
119119

120-
private static final boolean reactiveStreamsPresent = ClassUtils.isPresent(
120+
private static final boolean REACTIVE_STREAMS_PRESENT = ClassUtils.isPresent(
121121
"org.reactivestreams.Publisher", CacheAspectSupport.class.getClassLoader());
122122

123123

@@ -145,7 +145,7 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
145145

146146
protected CacheAspectSupport() {
147147
this.reactiveCachingHandler =
148-
(reactiveStreamsPresent && !shouldIgnoreReactiveStreams ? new ReactiveCachingHandler() : null);
148+
(REACTIVE_STREAMS_PRESENT && !SHOULD_IGNORE_REACTIVE_STREAMS ? new ReactiveCachingHandler() : null);
149149
}
150150

151151

spring-context/src/main/java/org/springframework/context/annotation/AnnotationConfigUtils.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,10 @@ public abstract class AnnotationConfigUtils {
116116

117117
private static final ClassLoader classLoader = AnnotationConfigUtils.class.getClassLoader();
118118

119-
private static final boolean jakartaAnnotationsPresent =
119+
private static final boolean JAKARTA_ANNOTATIONS_PRESENT =
120120
ClassUtils.isPresent("jakarta.annotation.PostConstruct", classLoader);
121121

122-
private static final boolean jpaPresent =
122+
private static final boolean JPA_PRESENT =
123123
ClassUtils.isPresent("jakarta.persistence.EntityManagerFactory", classLoader) &&
124124
ClassUtils.isPresent(PERSISTENCE_ANNOTATION_PROCESSOR_CLASS_NAME, classLoader);
125125

@@ -168,14 +168,14 @@ public static Set<BeanDefinitionHolder> registerAnnotationConfigProcessors(
168168
}
169169

170170
// Check for Jakarta Annotations support, and if present add the CommonAnnotationBeanPostProcessor.
171-
if (jakartaAnnotationsPresent && !registry.containsBeanDefinition(COMMON_ANNOTATION_PROCESSOR_BEAN_NAME)) {
171+
if (JAKARTA_ANNOTATIONS_PRESENT && !registry.containsBeanDefinition(COMMON_ANNOTATION_PROCESSOR_BEAN_NAME)) {
172172
RootBeanDefinition def = new RootBeanDefinition(CommonAnnotationBeanPostProcessor.class);
173173
def.setSource(source);
174174
beanDefs.add(registerPostProcessor(registry, def, COMMON_ANNOTATION_PROCESSOR_BEAN_NAME));
175175
}
176176

177177
// Check for JPA support, and if present add the PersistenceAnnotationBeanPostProcessor.
178-
if (jpaPresent && !registry.containsBeanDefinition(PERSISTENCE_ANNOTATION_PROCESSOR_BEAN_NAME)) {
178+
if (JPA_PRESENT && !registry.containsBeanDefinition(PERSISTENCE_ANNOTATION_PROCESSOR_BEAN_NAME)) {
179179
RootBeanDefinition def = new RootBeanDefinition();
180180
try {
181181
def.setBeanClass(ClassUtils.forName(PERSISTENCE_ANNOTATION_PROCESSOR_CLASS_NAME,

0 commit comments

Comments
 (0)