1
votes

I'm a happy user of eclipse mars for some time. But there is one thing that bugs me a bit:

When i start eclipse mars in the morning and start typing for example:

list.add

(list is an arraylist)

Then the parameters are displayed as arg0 and arg1. This only happens the first time. Cause when i type "list.add" again the parameter names are displayed, so no arg0 and arg1 anymore.

But when i go to another class and use it by typing hash.put the parameters are arg0 again. But when i try it a second time the parameters names are correctly displayed, no more arg0 anymore.

I do have a jdk (1.8 60) with source configured and selected (installed jres and for the project).

First try, you'll get arg0:

first with arg0

Second try the param names:

second with param names

Solved:

(thanks to francesco foresti for pointing me to the right direction)

Found it! Right click "jre system library", properties, select "execution env" radiobutton, click "environment" button , select "javase-18" and enable the checkbox for jdk in the "compatible jre" list. Now the rt.jar has source attachment instead of only javadoc attachment. And it keeps it even after a maven "update project".

1
And you want us to guess based on the code you don't show?Stultuske
I don't think he has code to show... I believe he's referring to Eclipse's auto complete / suggestions. Maybe he can post a screenshot to make the meaning clearerDagan Sandler
I think , you should go to following menu , Window -> Preferences -> Java -> Editor -> Content assist and see if option Fill method arguments and show guessed arguments is selected to what you are see.Sabir Khan
@dagandlerx i've added a screenshot to make it a bit clearer.Tinus Tate

1 Answers

2
votes

Wild guessing here, so take this answer with a grain of salt..

It is possible that, the first time you ask for an autocomplete Eclipse fills up the parameter names using decompiled classes (coming from your project dependencies), hence you see arg0 arg1 and so on. At the same time Eclipse triggers a source download request (maybe to Maven, I don't know), so the next time you want an autocomplete, you see the parameters' real names. It also seems that this "autocomplete cache" has a limited lifetime, so that when you open Eclipse the next morning, it starts all over again. I'd suggest you try to dig into Eclipse autocomplete configuration if you want to change this behavior.