only parse java source file ?
or has other solutions?
only parse java source file ?
or has other solutions?
Parsing javadocs is probably the best bet, assuming you have those.
If you don't, it's java source. if you don't have java source or javadocs, you're outta luck.
I'm not sure if I do understand you question... It would be easier to give an answer if your question was longer and would tell something about what you are trying to do.
Compiled class files may contain parameter names, but generally they don't, and for interfaces they never do. See my question Preserving parameter/argument names in compiled java classes and the numerous ansers for more information about it.
I believe you can get the information from an annotation parser in javac
(apt
in JDK5).
If you only have class files, then they would need to have debugging information included to include parameter names. Then I guess you could parse the class files with, say, ObjectWeb's ASM.
found paranamer project can resolve this.
use case:
Method method = Foo.class.getMethod(...); Paranamer paranamer = new CachingParanamer(); String[] parameterNames = paranamer.lookupParameterNames(method)
project home:http://paranamer.codehaus.org