IntelliJ IDEA: Is there a way to list all the interfaces implemented by a class and its parents?

I am working on a relatively complex Java project where classes usually have four or five ancestors before Object . With this class, for example. D in such a hierarchy: Object > A > B > C > D , I would like to know that it effectively implements all interfaces. That is, I am also interested to see that D implements, say, Serializable , even if it is declared only in the declaration of class B and even when D does not actually implement any of the methods specified in the interface (naturally, if we talk about Serializable ).

Some potential sources of this information I have tried include:

  • using "Group by type" in the "Structure" window - but this will not show empty interfaces (= interfaces without methods) and
  • Hierarchy window - but this does not include interfaces when viewing the hierarchy for a class.

Is there any way to get this information in IDEA without opening the files of all the ancestor classes of the class in question?

+5
source share
2 answers

You can try

  • Open the class file.
  • Press Ctrl + H. (or just go through the project window and press the keys.)
  • You can see that the Hierarchy chart is displayed on the right.
  • Try switching to the Hierarchy of Supertype Types button (round red in the image below). :))

enter image description here

+2
source

If you're ok with the UML view, use

Press โŒฅโ‡งโŒ˜U or โŒฅโŒ˜U on mac

Press Ctrl+Shift+Alt+U or Ctrl+Alt+U by default by default.

See https://www.jetbrains.com/help/idea/2016.3/viewing-class-hierarchy-as-a-class-diagram.html

+1
source

Source: https://habr.com/ru/post/1264540/


All Articles