Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to keep argument names of interface after compilation in Java?

I want to keep argument names of interface methods after compilation in Java.

Below is an example.

Before compiling:

interface IFoo {
    void hello(String what);
}

After compiling using javac -g:vars IFoo.java

interface IFoo {
    void hello(String str);
}

The argument what is renamed to str.

How can I keep the argument names?

like image 439
BaiJiFeiLong Avatar asked Sep 19 '18 07:09

BaiJiFeiLong


1 Answers

You need to generate debugging information when compiling. This is what the Javac option -g does:

-g — Generates all debugging information, including local variables.


If you are using Maven, you can set <debug>true</debug> in the compiler plugin's configuration.

like image 127
Alex Shesterov Avatar answered Sep 28 '22 16:09

Alex Shesterov