2

I'm building a SDK which will be distributed without source via JAR. Everything works, but the descriptive argument names I use in my interface classes are lost in the process.

My interface:

package com.example;
public interface ExampleInterfaceClass {
    /**
     * Method documentation
     * @param descriptiveParameter a parameter name I want included for anyone implementing this interface from a JAR
     */
    public void DoSomething(int descriptiveParameter);
}

When I implement this interface with source available, the 'descriptiveParameter' auto-generates properly as 'descriptiveParameter':

public class ExampleImplementor implements ExampleInterfaceClass {
    @Override
    public void DoSomething(int descriptiveParameter) {
        // TODO Auto-generated method stub
    }
}

However, when I implement from a compiled JAR, the parameter auto-generates as "arg0":

public class ExampleImplementFromJAR implements ExampleInterfaceClass {
    @Override
    public void DoSomething(int arg0) {
        // TODO Auto-generated method stub
    }
}

A number of solutions have been proposed via questions like this one: Preserving parameter/argument names in compiled java classes, but none hit on a solution that enables me to 1. Include descriptive parameters in my JAR, and 2. Hide source from other classes. Is there a way to include source from only my interface files in a JAR file via eclipse export? If not, what is the next easiest way to produce a JAR with a subset of source objects?

Community
  • 1
  • 1
Jim Vitek
  • 4,174
  • 3
  • 23
  • 32

1 Answers1

0

My guess is that it is not possible.

The reason I guess that is there are several examples within the Android SDK itself where the auto-fill methods get parameters named as arg0, arg1, arg2 etc...

I imagine that if it were possible to carry the descriptive parameter names over that they would've done so when building the components in the offical Android SDK.

That being said, my theory is entirely based on my own observations while working with Android SDK / Eclipse, I have not read specifically anywhere that it is infact not possible.

FoamyGuy
  • 46,603
  • 18
  • 125
  • 156