eclipse-jdt / eclipse-jdt/eclipse.jdt.core

Type Hierarchy has duplicated entries (classes) and one of them is incomplete

Open
#4,797 12 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 12h
Merged PRs (30d)
47

Description

Sometimes when I get the _Type Hierarchy_ of a given class, I get duplicated entries.

In the following screenshot you can see duplicated entries of `AbstractCustomDispatch`.

Image

I copied the _fully qualified name_ of both classes and noticed that the entry on the top is inside a fictional package that has an additional `src.` right at the beginning. The _real_ package starts with `aq`.

## Additional info

1. `AbstractCustomDispatch` and **all of its subclasses** are ours _i.e._ they are present in the workspace as source code.
2. The subclasses are in different plugins

Image

---

Image

---

Image

---

3. The methods of the `AbstractCustomDispatch` that is found under `src.aq...` (and the methods of its subclasses) are missing 👎

Image

4. The methods of the `AbstractCustomDispatch` that is found under `aq...` (and the methods of its subclasses) are there 👍

Image

I am not able to consistently reproduce the error but I just happen to run into it today and I started debugging.

## Current findings

My assumption is that the type `AbstractCustomDispatch` is still not completely discovered by the time its first 3 subclasses are being populated and it is completely known (and it's known to be in the workspace) by the time the rest of its subclasses are being computed.

I set a breakpoint in here

https://github.com/eclipse-jdt/eclipse.jdt.core/blob/1ec8da704c09c2fc1c69ac1c5f6ee7e974ab72af/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java#L605

And noticed that the return values of `findSuperClass(suppliedType, typeBinding)` are different for some subclasses.

For example here are the parameters and the result of the call when analyzing `CloseKeyEventDispatch` (which is one of the 3 subclasses that is missing the methods in a previous screenshot👎 )

Image

And here's how it looks when analyzing `CutAndCopyDispatchReplacement` (which is one of the subclasses that has all its methods in the hierarchy view 👍): members are there and `AbstractCustomDispatch` does not show `(not open)` anymore.

Image

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.