Foreword
When you read the source code, to see a variety of classes and inheritance to implement those interfaces go, it is not it already does not know who his father (the father) is, who his grandfather (father of the parent class) is, only I knew who his ancestor was (Object class)? After all, the relationship between classes too indistinct, can only say, "What a mess in your lap."
It does not matter, Idea have a super strong and very practical things that can make you suddenly find out who, easy to get their relationship between them, after all, who do not want hi Dangdie, "how do I suddenly have one more internal class, he is not my inner class. " The interface look so green, we know that he did not know how many children
Many do not say, look at renderings: this theme a really my cup of tea (geeks feeling), Idea theme style is quite nice
Update and synchronize all articles Github-- the Java-Notes , would like to know JVM (basically a more complete), HashMap source code analysis, spring relevant, concurrent, prove safety offer solution to a problem (Java version), you can point a star. You can look at my github page, yo are updated daily (since work every day in the evening wrote more than 12, 6:00 am multiply codeword, the daily number of star power is to see it go up).
We invite you to complete the repo together with me
Line represents the meaning of
The solid blue line -> Inheritance
Green dashed -> realization
Red realization -> inner class
For example we ReentrantLock
Forgive color
We see him achieve the Serializable interface and Lock, so the class diagram showing the relationship is the green dotted line interfaces do not know how many children (the implementation class), the color really forgive
red
We see, Sync This abstract class is an internal class ReentrantLock class, we look at the class diagram relations, he is the red line shows the relationship
Do not believe us look at another class AbstractQueuedSynchronizer
blue
Sync inherited from AbstractQueuedSynchronizer, and all classes (except Object), inherited from Object, so that the blue line are directed to all classes Object
How do it
Select the type, right
Two modes
- The first is that I began to show, and he alone will open in another window
- The second he will pop up a window directly next to the class, showing the relationship between
We mainly in the first show, for example, how a step by step to show so much class, so much to find his father, uncle, grandfather, and ancestors
Find out what he's hiding relatives
We go in like this, I was not the beginning of it, all kinds of hard to explain father uncle, because it initially display only the direct parent classes and interfaces implemented
First find his father
ReentrantLock is a rich second generation, he did not grandfather, fathers, only a father. Because he did not inherit the class except Object
Looking for his adopted son (inner class, not inherited from him)
Filtering, screening
Even looking at two parent Sync
Into the source code
So you can jump directly into the source code
Add additional class
Sometimes you think this class is not what you want, you have to horizontal comparison, to find his uncle (the same grandfather, but there is no direct inheritance) or siblings (same father class)
You can directly select the right
And then the class you want to add, such as Thread class
Then will be added in, if the two of them does not matter (if the class will have a relationship, after all, inherited from Object, but if the parent class is not loaded it, they think it does not matter), there would be no connection, such as our delete Object class
At last
With this thing, I think no matter what you are reading the source code or do, you should never do not know the relationship between the class and the class / (Interface) a
I wish everyone a happy reading the source code, interpret the relationship between them