File tree Expand file tree Collapse file tree 5 files changed +18
-29
lines changed
main/java/org/springframework/context
test/java/org/springframework
spring-core/src/main/java/org/springframework/util Expand file tree Collapse file tree 5 files changed +18
-29
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2012 the original author or authors.
2
+ * Copyright 2002-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
21
21
/**
22
22
* Interface to be implemented by
23
23
* {@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.
26
26
*
27
27
* <p>See {@link org.springframework.scheduling.annotation.EnableAsync @EnableAsync}
28
28
* for usage examples and information on how a default {@code LoadTimeWeaver}
36
36
public interface LoadTimeWeavingConfigurer {
37
37
38
38
/**
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
42
42
* {@link LoadTimeWeavingConfiguration#loadTimeWeaver()}
43
43
*/
44
44
LoadTimeWeaver getLoadTimeWeaver ();
Original file line number Diff line number Diff line change @@ -749,7 +749,8 @@ protected void invokeBeanFactoryPostProcessors(ConfigurableListableBeanFactory b
749
749
750
750
// Detect a LoadTimeWeaver and prepare for weaving, if found in the meantime
751
751
// (e.g. through an @Bean method registered by ConfigurationClassPostProcessor)
752
- if (!NativeDetector .inNativeImage () && beanFactory .getTempClassLoader () == null && beanFactory .containsBean (LOAD_TIME_WEAVER_BEAN_NAME )) {
752
+ if (!NativeDetector .inNativeImage () && beanFactory .getTempClassLoader () == null &&
753
+ beanFactory .containsBean (LOAD_TIME_WEAVER_BEAN_NAME )) {
753
754
beanFactory .addBeanPostProcessor (new LoadTimeWeaverAwareProcessor (beanFactory ));
754
755
beanFactory .setTempClassLoader (new ContextTypeMatchClassLoader (beanFactory .getBeanClassLoader ()));
755
756
}
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ void enableLTW_withAjWeavingEnabled() {
79
79
80
80
81
81
@ Configuration
82
- @ EnableLoadTimeWeaving (aspectjWeaving = AspectJWeaving .DISABLED )
82
+ @ EnableLoadTimeWeaving (aspectjWeaving = AspectJWeaving .DISABLED )
83
83
static class EnableLTWConfig_withAjWeavingDisabled implements LoadTimeWeavingConfigurer {
84
84
85
85
@ Override
@@ -88,8 +88,9 @@ public LoadTimeWeaver getLoadTimeWeaver() {
88
88
}
89
89
}
90
90
91
+
91
92
@ Configuration
92
- @ EnableLoadTimeWeaving (aspectjWeaving = AspectJWeaving .AUTODETECT )
93
+ @ EnableLoadTimeWeaving (aspectjWeaving = AspectJWeaving .AUTODETECT )
93
94
static class EnableLTWConfig_withAjWeavingAutodetect implements LoadTimeWeavingConfigurer {
94
95
95
96
@ Override
@@ -98,8 +99,9 @@ public LoadTimeWeaver getLoadTimeWeaver() {
98
99
}
99
100
}
100
101
102
+
101
103
@ Configuration
102
- @ EnableLoadTimeWeaving (aspectjWeaving = AspectJWeaving .ENABLED )
104
+ @ EnableLoadTimeWeaving (aspectjWeaving = AspectJWeaving .ENABLED )
103
105
static class EnableLTWConfig_withAjWeavingEnabled implements LoadTimeWeavingConfigurer {
104
106
105
107
@ Override
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2019 the original author or authors.
2
+ * Copyright 2002-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -85,35 +85,29 @@ public static class JustAddTransformerClassLoader extends ClassLoader {
85
85
86
86
private int numTimesAddTransformerCalled = 0 ;
87
87
88
-
89
88
public int getNumTimesGetThrowawayClassLoaderCalled () {
90
89
return this .numTimesAddTransformerCalled ;
91
90
}
92
91
93
-
94
92
public void addTransformer (ClassFileTransformer transformer ) {
95
93
++this .numTimesAddTransformerCalled ;
96
94
}
97
-
98
95
}
99
96
100
97
101
98
public static final class TotallyCompliantClassLoader extends JustAddTransformerClassLoader {
102
99
103
100
private int numTimesGetThrowawayClassLoaderCalled = 0 ;
104
101
105
-
106
102
@ Override
107
103
public int getNumTimesGetThrowawayClassLoaderCalled () {
108
104
return this .numTimesGetThrowawayClassLoaderCalled ;
109
105
}
110
106
111
-
112
107
public ClassLoader getThrowawayClassLoader () {
113
108
++this .numTimesGetThrowawayClassLoaderCalled ;
114
109
return getClass ().getClassLoader ();
115
110
}
116
-
117
111
}
118
112
119
113
}
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2021 the original author or authors.
2
+ * Copyright 2002-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -509,24 +509,16 @@ private static List<Method> findConcreteMethodsOnInterfaces(Class<?> clazz) {
509
509
* @see java.lang.Object#equals(Object)
510
510
*/
511
511
public static boolean isEqualsMethod (@ Nullable Method method ) {
512
- if (method == null ) {
513
- return false ;
514
- }
515
- if (method .getParameterCount () != 1 ) {
516
- return false ;
517
- }
518
- if (!method .getName ().equals ("equals" )) {
519
- return false ;
520
- }
521
- return method .getParameterTypes ()[0 ] == Object .class ;
512
+ return (method != null && method .getParameterCount () == 1 && method .getName ().equals ("equals" ) &&
513
+ method .getParameterTypes ()[0 ] == Object .class );
522
514
}
523
515
524
516
/**
525
517
* Determine whether the given method is a "hashCode" method.
526
518
* @see java.lang.Object#hashCode()
527
519
*/
528
520
public static boolean isHashCodeMethod (@ Nullable Method method ) {
529
- return method != null && method .getParameterCount () == 0 && method .getName ().equals ("hashCode" );
521
+ return ( method != null && method .getParameterCount () == 0 && method .getName ().equals ("hashCode" ) );
530
522
}
531
523
532
524
/**
You can’t perform that action at this time.
0 commit comments