Since the introduction of the java.lang.reflect.Parameter
API in Java 8, the argNames
attributes in AspectJ annotations (such as @Before
, @Around
, etc.) are no longer necessary.
Instead, the Spring team suggests that code be compiled with the javac
-parameters
flag to make the parameter names available in the compiled byte code.
In light of that recommendation, we should log a warning any time we detect an explicit argNames
attribute declaration in an AspectJ annotation.
Comment From: sbrannen
Related Issues
-
30026
Comment From: sbrannen
Since argNames
attributes are checked first in the ParameterNameDiscover
chain (technically before the chain), using argNames
can avoid potentially more costly operations in the chain.
In light of that we have decided not to log a warning and instead to recommend the use of -parameters
as can be seen in the updated Determining Argument Names and Explicit Argument Names sections of the reference manual.