Skip to content

Commit 7de8d81

Browse files
committed
Explicit documentation notes on standard Java reflection
See gh-29531
1 parent 0e33537 commit 7de8d81

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

spring-core/src/main/java/org/springframework/core/DefaultParameterNameDiscoverer.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2022 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.
@@ -18,9 +18,9 @@
1818

1919
/**
2020
* Default implementation of the {@link ParameterNameDiscoverer} strategy interface,
21-
* using the Java 8 standard reflection mechanism (if available), and falling back
22-
* to the ASM-based {@link LocalVariableTableParameterNameDiscoverer} for checking
23-
* debug information in the class file.
21+
* using the Java 8 standard reflection mechanism, and falling back to the ASM-based
22+
* {@link LocalVariableTableParameterNameDiscoverer} for checking debug information
23+
* in the class file (e.g. for classes compiled with earlier Java versions).
2424
*
2525
* <p>If a Kotlin reflection implementation is present,
2626
* {@link KotlinReflectionParameterNameDiscoverer} is added first in the list and

spring-core/src/main/java/org/springframework/core/KotlinReflectionParameterNameDiscoverer.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2022 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.
@@ -31,11 +31,13 @@
3131
* {@link ParameterNameDiscoverer} implementation which uses Kotlin's reflection facilities
3232
* for introspecting parameter names.
3333
*
34-
* Compared to {@link StandardReflectionParameterNameDiscoverer}, it allows in addition to
34+
* <p>Compared to {@link StandardReflectionParameterNameDiscoverer}, it allows in addition to
3535
* determine interface parameter names without requiring Java 8 -parameters compiler flag.
3636
*
3737
* @author Sebastien Deleuze
3838
* @since 5.0
39+
* @see StandardReflectionParameterNameDiscoverer
40+
* @see DefaultParameterNameDiscoverer
3941
*/
4042
public class KotlinReflectionParameterNameDiscoverer implements ParameterNameDiscoverer {
4143

spring-core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,18 @@
4747
* caches the ASM discovered information for each introspected Class, in a thread-safe
4848
* manner. It is recommended to reuse ParameterNameDiscoverer instances as far as possible.
4949
*
50+
* <p>This discoverer variant is effectively superseded by the Java 8 based
51+
* {@link StandardReflectionParameterNameDiscoverer} but included as a fallback still
52+
* (for code not compiled with the standard "-parameters" compiler flag).
53+
*
5054
* @author Adrian Colyer
5155
* @author Costin Leau
5256
* @author Juergen Hoeller
5357
* @author Chris Beams
5458
* @author Sam Brannen
5559
* @since 2.0
60+
* @see StandardReflectionParameterNameDiscoverer
61+
* @see DefaultParameterNameDiscoverer
5662
*/
5763
public class LocalVariableTableParameterNameDiscoverer implements ParameterNameDiscoverer {
5864

spring-core/src/main/java/org/springframework/core/StandardReflectionParameterNameDiscoverer.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2022 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.
@@ -26,10 +26,15 @@
2626
* {@link ParameterNameDiscoverer} implementation which uses JDK 8's reflection facilities
2727
* for introspecting parameter names (based on the "-parameters" compiler flag).
2828
*
29+
* <p>This is a key element of {@link DefaultParameterNameDiscoverer} where it is being
30+
* combined with {@link KotlinReflectionParameterNameDiscoverer} if Kotlin is present.
31+
*
2932
* @author Juergen Hoeller
3033
* @since 4.0
3134
* @see java.lang.reflect.Method#getParameters()
3235
* @see java.lang.reflect.Parameter#getName()
36+
* @see KotlinReflectionParameterNameDiscoverer
37+
* @see DefaultParameterNameDiscoverer
3338
*/
3439
public class StandardReflectionParameterNameDiscoverer implements ParameterNameDiscoverer {
3540

0 commit comments

Comments
 (0)