Skip to content

Commit f19433f

Browse files
committed
Polishing
1 parent 0b02a5e commit f19433f

File tree

5 files changed

+18
-29
lines changed

5 files changed

+18
-29
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,8 +21,8 @@
2121
/**
2222
* Interface to be implemented by
2323
* {@link org.springframework.context.annotation.Configuration @Configuration}
24-
* classes annotated with {@link EnableLoadTimeWeaving @EnableLoadTimeWeaving} that wish to
25-
* customize the {@link LoadTimeWeaver} instance to be used.
24+
* classes annotated with {@link EnableLoadTimeWeaving @EnableLoadTimeWeaving}
25+
* that wish to customize the {@link LoadTimeWeaver} instance to be used.
2626
*
2727
* <p>See {@link org.springframework.scheduling.annotation.EnableAsync @EnableAsync}
2828
* for usage examples and information on how a default {@code LoadTimeWeaver}
@@ -36,9 +36,9 @@
3636
public interface LoadTimeWeavingConfigurer {
3737

3838
/**
39-
* Create, configure and return the {@code LoadTimeWeaver} instance to be used. Note
40-
* that it is unnecessary to annotate this method with {@code @Bean}, because the
41-
* object returned will automatically be registered as a bean by
39+
* Create, configure and return the {@code LoadTimeWeaver} instance to be used.
40+
* Note that it is unnecessary to annotate this method with {@code @Bean}
41+
* because the object returned will automatically be registered as a bean by
4242
* {@link LoadTimeWeavingConfiguration#loadTimeWeaver()}
4343
*/
4444
LoadTimeWeaver getLoadTimeWeaver();

spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,8 @@ protected void invokeBeanFactoryPostProcessors(ConfigurableListableBeanFactory b
772772

773773
// Detect a LoadTimeWeaver and prepare for weaving, if found in the meantime
774774
// (e.g. through an @Bean method registered by ConfigurationClassPostProcessor)
775-
if (!NativeDetector.inNativeImage() && beanFactory.getTempClassLoader() == null && beanFactory.containsBean(LOAD_TIME_WEAVER_BEAN_NAME)) {
775+
if (!NativeDetector.inNativeImage() && beanFactory.getTempClassLoader() == null &&
776+
beanFactory.containsBean(LOAD_TIME_WEAVER_BEAN_NAME)) {
776777
beanFactory.addBeanPostProcessor(new LoadTimeWeaverAwareProcessor(beanFactory));
777778
beanFactory.setTempClassLoader(new ContextTypeMatchClassLoader(beanFactory.getBeanClassLoader()));
778779
}

spring-context/src/test/java/org/springframework/context/annotation/EnableLoadTimeWeavingTests.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void enableLTW_withAjWeavingEnabled() {
7979

8080

8181
@Configuration
82-
@EnableLoadTimeWeaving(aspectjWeaving=AspectJWeaving.DISABLED)
82+
@EnableLoadTimeWeaving(aspectjWeaving = AspectJWeaving.DISABLED)
8383
static class EnableLTWConfig_withAjWeavingDisabled implements LoadTimeWeavingConfigurer {
8484

8585
@Override
@@ -88,8 +88,9 @@ public LoadTimeWeaver getLoadTimeWeaver() {
8888
}
8989
}
9090

91+
9192
@Configuration
92-
@EnableLoadTimeWeaving(aspectjWeaving=AspectJWeaving.AUTODETECT)
93+
@EnableLoadTimeWeaving(aspectjWeaving = AspectJWeaving.AUTODETECT)
9394
static class EnableLTWConfig_withAjWeavingAutodetect implements LoadTimeWeavingConfigurer {
9495

9596
@Override
@@ -98,8 +99,9 @@ public LoadTimeWeaver getLoadTimeWeaver() {
9899
}
99100
}
100101

102+
101103
@Configuration
102-
@EnableLoadTimeWeaving(aspectjWeaving=AspectJWeaving.ENABLED)
104+
@EnableLoadTimeWeaving(aspectjWeaving = AspectJWeaving.ENABLED)
103105
static class EnableLTWConfig_withAjWeavingEnabled implements LoadTimeWeavingConfigurer {
104106

105107
@Override

spring-context/src/test/java/org/springframework/instrument/classloading/ReflectiveLoadTimeWeaverTests.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -85,35 +85,29 @@ public static class JustAddTransformerClassLoader extends ClassLoader {
8585

8686
private int numTimesAddTransformerCalled = 0;
8787

88-
8988
public int getNumTimesGetThrowawayClassLoaderCalled() {
9089
return this.numTimesAddTransformerCalled;
9190
}
9291

93-
9492
public void addTransformer(ClassFileTransformer transformer) {
9593
++this.numTimesAddTransformerCalled;
9694
}
97-
9895
}
9996

10097

10198
public static final class TotallyCompliantClassLoader extends JustAddTransformerClassLoader {
10299

103100
private int numTimesGetThrowawayClassLoaderCalled = 0;
104101

105-
106102
@Override
107103
public int getNumTimesGetThrowawayClassLoaderCalled() {
108104
return this.numTimesGetThrowawayClassLoaderCalled;
109105
}
110106

111-
112107
public ClassLoader getThrowawayClassLoader() {
113108
++this.numTimesGetThrowawayClassLoaderCalled;
114109
return getClass().getClassLoader();
115110
}
116-
117111
}
118112

119113
}

spring-core/src/main/java/org/springframework/util/ReflectionUtils.java

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -507,24 +507,16 @@ private static List<Method> findConcreteMethodsOnInterfaces(Class<?> clazz) {
507507
* @see java.lang.Object#equals(Object)
508508
*/
509509
public static boolean isEqualsMethod(@Nullable Method method) {
510-
if (method == null) {
511-
return false;
512-
}
513-
if (method.getParameterCount() != 1) {
514-
return false;
515-
}
516-
if (!method.getName().equals("equals")) {
517-
return false;
518-
}
519-
return method.getParameterTypes()[0] == Object.class;
510+
return (method != null && method.getParameterCount() == 1 && method.getName().equals("equals") &&
511+
method.getParameterTypes()[0] == Object.class);
520512
}
521513

522514
/**
523515
* Determine whether the given method is a "hashCode" method.
524516
* @see java.lang.Object#hashCode()
525517
*/
526518
public static boolean isHashCodeMethod(@Nullable Method method) {
527-
return method != null && method.getParameterCount() == 0 && method.getName().equals("hashCode");
519+
return (method != null && method.getParameterCount() == 0 && method.getName().equals("hashCode"));
528520
}
529521

530522
/**

0 commit comments

Comments
 (0)