Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find in Eclipse which classes implement multiple interfaces?

Using Eclipse, how can I find which Java classes implement interface A AND interface B? Thanks.

like image 276
ChaimKut Avatar asked Apr 09 '12 15:04

ChaimKut


1 Answers

I just had the same problem, and I'm really missing this feature in the Eclipse search dialog. Going through all classes manually wasn't very pleasant, so I used this nasty workaround. Given this structure:

public interface A {
  public String x();
}
public interface B {
}

public class ImplementsBoth implements A, B {

  @Override
  public String x() {...}

}
public class ImplementsA implements A {

  @Override
  public String x() {...}

}
public class ImplementsB implements B {

}

I changed B into:

public interface B {
  public void x();
}

This results in the following error for ImplementsBoth:

The return type is incompatible with B.x()

Now it's possible to step through all these messages in the Problems view.

like image 180
Chris Lercher Avatar answered Oct 06 '22 22:10

Chris Lercher