Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Store method parameter names for some classes when compiling in Java 8

Eclipse has an option in Java Compiler tab:

Store information about method parameters (usable via reflection)

If I checked on the option. I am able to get method parameter via Parameter API. It is good.

If I turn on the option, Compiler will stored method parameter information in All my compiling classes. This may make the class/jar file bigger. Eclipse turn it off by default.

My question is: Is there any way to turn on the option for some class I want? Is there any compiler directive that I can add it into my java class for this purpose?

Thank you!

like image 735
Loc Avatar asked May 08 '26 10:05

Loc


1 Answers

Yes in a way. This is an option to javac (see -parameters) and javac can be run on whatever set of files you would like. However, there is not any option to selectively apply -parameters to certain classes when running javac on multiple files, so you would have to run multiple javac's most likely. This could be done through a build file most likely with a build language (for instance Ant or Gradle).

like image 85
stevebot Avatar answered May 10 '26 03:05

stevebot