-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preserve all method signature info #80
Comments
Hi Luke! It's possible to reconstruct a method declaration using the standard reflection API. Here's a document from Oracle that covers how to get the required information using reflection: https://docs.oracle.com/javase/tutorial/reflect/member/methodparameterreflection.html For your use case, perhaps you could start by using reflection to get a (Strictly speaking, a Java method's signature consists of only the method name and the types of its parameters. This information is present in the JSON written by the scribe, and used by the runtime component to find the Javadoc associated with a given |
Yes, that's exactly what I am doing to manually print out the method prototype. But it's a lot of boilerplate, and your library would be more complete if it had support for this. Also, as you point out the parameter names are not by default compiled into the classfile, and since the javadoc @param order doesn't have to match thw actual para order, it's not possible to align the parameters by name, in order to figure out the type of each para (unless the classfile was compiled with the However an annotation processor does have access to the method param names, I believe. This is an opportunity to provide some info to your users that is not typically available at runtime (without messing with compiler switches) -- and to reduce boilerplate. |
Currently it is not possible to print out the prototype for a method, including parameter names. There is no return type recorded in therapi-runtime-javadoc's data structures, and no function parameter types.
I would like to have a simple toString() method for a method's type signature, including return type, method name, parameter names and types, shown the same was as the method is declared in the code.
The text was updated successfully, but these errors were encountered: