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

可紊 提交于 2019-12-22 11:08:10

问题


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!


回答1:


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



来源:https://stackoverflow.com/questions/28073799/store-method-parameter-names-for-some-classes-when-compiling-in-java-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!