[Question] How to map parameter annotations to corresponding parameters
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format... ------------=_1668537216-2706-1 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7BIT Content-length: 1099 Hi all, As per the javadoc on `MethodVisitor.visitParameterAnnotation`, the `parameter` argument may not correspond to the index in the parameter descriptor, then how should I map parameter annotations and parameters correctly? At first I thought I cound use parameter access_flags from `MethodVisitor.visitParameter`, and ignore those formal parameters who are `ACC_SYNTHETIC` or `ACC_MANDATED`, then the remaining formal parameters and the parameter annotations would just match. But it turns out that `MethodParameters` attribute doesn't exist in classfile by default, I need to pass `-parameters` to javac to generate it, and `LocalVariableTable` doesn't have access_flags either. That means parameter access_flags are not available in classfile, and I can't tell which parameter is synthetic in method descriptor. I'm also wondering how java reflection framework does the mapping. I posted a similar question on stackoverflow, you can also give your advice there. https://stackoverflow.com/questions/74446059/how-to-map-parameter-annotations-to-corresponding-method-parameter-in-classfile ------------=_1668537216-2706-1 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit -- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws ------------=_1668537216-2706-1--