Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Some function parameters named arg0, arg1, etc... after compiling a JAR library

I seem to have encountered a problem in which, post Ant compilation of a Jar library, some function parameters are arg0, arg1, etc... instead of their real names. the problematic functions all belong to one internal interface in the library.

I'm compiling a library using the Ant command:

ant clean release -Dversion.code=1 -Dverbose=true -Ddebug=true -Ddebuglevel="vars"

Given this, For some reason, part of the methods lose their parameter names while others keep their parameter names. i.e.:

Func a(String specificName1) turns into a(String arg0)

while

Func b(String specifcName2) turns into b(String specificName2)

The question is as follows: The library has an internal interface class inside. Why the interfaces functions get parameters named arg0, arg1, etc.. while other methods keep their correct parameter names?


I'm working on an Android library and i'm testing the library jar on Eclipse IDE.

The compilation itself was edited in Androids own ant build.xml:

        <javac encoding="${java.encoding}"
                source="${java.source}" target="${java.target}"
                debug="true" debuglevel="vars" extdirs="" includeantruntime="false"
                destdir="${out.classes.absolute.dir}"
                bootclasspathref="project.target.class.path"
                verbose="${verbose}"
                classpathref="project.javac.classpath"
                fork="${need.javac.fork}">
            <src path="${source.absolute.dir}" />
            <src path="${gen.absolute.dir}" />
            <compilerarg line="${java.compilerargs}" />
        </javac>
like image 848
Eitan Schwartz Avatar asked Sep 01 '13 07:09

Eitan Schwartz


1 Answers

Ok, finally found answers, hope it helps someone:

Short story is: param names can either be drawn from a javadoc, external source files or inside the classes themselves. the new thing is that, when trying to get parameter name information from the class itself, interface classes cannot retain their parameter names like normal classes (according to Oracle's Java specifications manual).

This was actually answered in other posts I haven't found before:

Java method parameter names from a JAR file in Eclipse

this also supports there's no solution to this:

Preserving parameter/argument names in compiled java classes

like image 72
Eitan Schwartz Avatar answered Oct 27 '22 02:10

Eitan Schwartz