LHA
LHA

Reputation: 9655

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!

Upvotes: 3

Views: 308

Answers (1)

stevebot
stevebot

Reputation: 24005

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).

Upvotes: 2

Related Questions