Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are duplicate method suggestions appearing in Eclipse?

Two contains(Object o) methods in eclipse

This problem also occurs with other methods but I am just using ArrayList.contains(Object o) as an example.

The method appears twice in Eclipse's method suggestions but one of them with a percentage. As far as I can tell it seems to be a percentage unique to that method.

The methods do the same thing as they both have the same name and parameters so I have no clue why this was happening.

I also though maybe it was some kind of progress counter for the completion of the method, but this makes no sense if there is one without the percentage there too.

like image 573
njallam Avatar asked Aug 12 '12 08:08

njallam


People also ask

How do I change occurrences in eclipse?

Press ctrl + f for windows computer. Then under FIND, type what you want to find. Then in REPLACE WITH, type in what you want to replace it with. Then click REPLACE ALL.

What is IntelliSense in eclipse?

IntelliSense can speed up your coding by auto-completing your words as you type, lets say you have aVeryLongVariable in your code, as soon as you start typing aV, a box will pop-up with the suggestions for auto-completion, you can either continue typing or just press enter and your variable will be auto-completed.


2 Answers

Go to Preferences -> Java -> Editor -> Content Assist -> Advanced

To see no duplicates in your suggestions, have the assist list checked as shown below.

(Tested in Eclipse - Kepler Version)

Java Content Assist Advanced Preferences

If you have checked "Java Type Proposals" and "Java Non-Type Proposals" then you will see duplicates in your suggestions.

like image 68
LINGS Avatar answered Sep 25 '22 11:09

LINGS


You have Code Recommenders installed. The proposal with percentage is coming from that, and the proposal without the percentage is coming from JDT.

Essentially there are more than one completion engines installed - see Preferences > Java > Editor > Content Assist. The same method is being offered by more than one engine. While this explains why the duplicates are there, I do not have a workaround or a solution in mind.

like image 45
Deepak Azad Avatar answered Sep 24 '22 11:09

Deepak Azad