New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type hierarchy not displayed #5250
Comments
As part of changes to support transforming in a Bnd Workspace build, I made a change to the Bndtools classpath container so that for version=latest/snapshot -buildpath references, the IClasspathEntries had the project reference for the source files was changed to be not accessible. This forces the compiler to use the binary class file in the built jar since that class file could be significantly transformed from what the source code says. This change works fine for compiler and Open Type. However, there is a flaw in the way that Eclipse JDT finds types in the hierarchy which breaks with this change. First JDT searches for the supertypes and subtypes of the subject type. During this phase, JDT finds the source type and since it is not accessible (due to the IClasspathEntry configuration), JDT keeps looking and finds the binary type in the built jar. Then later JDT wants to get the IType objects for each super type and calls
I can try and make a fix for JDT but that does not help things in the near term since we support older versions of Eclipse. So I think the answer here will be to revert to the prior behavior as the default behavior and define a way for individual -buildpath entries (which are known to need the alternate behavior) to request the alternate behavior.
|
The JDT type hierarchy search does not work properly when a source folder is not-accessible following by a binary jar which is. This caused types in the jar to be missing from the hierarchy result. So we add back the `source=project` -buildpath clause option. The value `project` is the default. So saying `source=none` on a -buildpath entry, will cause Bndtools to mark the source project as discouraged to force the compiler to use the classes in the generated jar. Fixes bndtools#5250 Signed-off-by: BJ Hargrave <bj@hargrave.dev>
The JDT type hierarchy search does not work properly when a source folder is not-accessible following by a binary jar which is. This caused types in the jar to be missing from the hierarchy result. So we add back the `source=project` -buildpath clause option. The value `project` is the default. So saying `source=none` on a -buildpath entry, will cause Bndtools to mark the source project as discouraged to force the compiler to use the classes in the generated jar. Fixes bndtools#5250 Signed-off-by: BJ Hargrave <bj@hargrave.dev>
Great work on this one, @bjhargrave ! I haven't looked in detail, but the bug in finding supertypes in certain circumstances reminded me of this bug that I found while working on the quick fix processor: https://bugs.eclipse.org/bugs/show_bug.cgi?id=566145 I wonder if the two are connected in some way. |
The JDT type hierarchy search does not work properly when a source folder is not-accessible following by a binary jar which is. This caused types in the jar to be missing from the hierarchy result. So we add back the `source=project` -buildpath clause option. The value `project` is the default. So saying `source=none` on a -buildpath entry, will cause Bndtools to mark the source project as discouraged to force the compiler to use the classes in the generated jar. Fixes bndtools#5250 Signed-off-by: BJ Hargrave <bj@hargrave.dev>
Impressive work ... I know how complex that code is. |
Thanks a lot @bjhargrave for looking into the issue so carefully. I really appreciate your in-depth hard work. 🙇 Great job 👍 |
The case here requires an inaccessible source type before the accessible binary type. Not sure if that applies to your test case problem since I would doubt it involves this kind of shadowing. |
The JDT type hierarchy search does not work properly when a source folder is not-accessible following by a binary jar which is. This caused types in the jar to be missing from the hierarchy result. So we add back the `source=project` -buildpath clause option. The value `project` is the default. So saying `source=none` on a -buildpath entry, will cause Bndtools to mark the source project as discouraged to force the compiler to use the classes in the generated jar. Fixes bndtools#5250 Signed-off-by: BJ Hargrave <bj@hargrave.dev>
@bjhargrave thanks for the fix. I can confirm Type Hierarchy is working again with 6.3.0-RC3 One thing I noticed is that there are duplicates. You see 4 leaf entries, which are actually only 2. I think this has been the case also in the past too - not sure.... But just wanted to mention it, in case it is important for this specific issue. |
This is a long term issue and not part of this change. There is code which attempts to remove the duplicates which come from the jar classpath elements, but it does not always work. Sometimes it does and sometimes not :-( |
Ok thanks for the clarification. |
I have recently encountered the problem that the type hierarchy cannot be listed anymore.
Steps to reproduce:
I believe the problem lies in the access rules since they differ in 6.2-REL (where it works perfectly) and latest snapshot:
Latest Snapshot:
REL-6.2:
Step
The text was updated successfully, but these errors were encountered: