Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why eclipse is generating argument names as arg0,arg1,arg2.... for methods?

When I try to access some class's method; eclipse gets that method but arguments inside that method are replaced by arg0, arg1, arg2...

Example:-

Suppose I have this method in some class named ReadFile.java

@Override
public int readXXX(int start, int end, String xxx) throws IOException {
    return 0;
}

When I try to access that method from an instance of class it shows me as follows:

readFile.readXXX(arg0, arg1, arg2);

It becomes hard to identify what I should pass in argument. The same thing also happens for java methods. i.e. when I implement interface all method under that will be generated but arguments in that methods are arg0, arg1.....

Is there any setting I can do prevent this?

I'm using Eclipse Galelio.

like image 352
Harry Joy Avatar asked Jun 10 '11 08:06

Harry Joy


2 Answers

Eclipse can't work out the arguments because it can't find the source or javadoc attachments.

Make sure your source is attached.

To check, click on the method call readXXX and press F3 which should open the method declaration. If the source is not attached, Eclipse will say "Source not found" and will allow you to "Attach Source...".

like image 191
dogbane Avatar answered Oct 23 '22 12:10

dogbane


Anyone having the same issue, try performing a Project > Clean, this will delete the old class files, and Eclipse will recompile them in debug mode this time. Worked for me in Indigo 3.7.2

like image 20
javawarrior Avatar answered Oct 23 '22 11:10

javawarrior