Bug 541489 - Show Logical Structure not working for some launch configurations with Advanced Source Lookup
Summary: Show Logical Structure not working for some launch configurations with Advanc...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 4.9   Edit
Hardware: PC All
: P3 major with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2018-11-23 04:24 EST by Hugh Yang CLA
Modified: 2024-05-15 02:07 EDT (History)
5 users (show)

See Also:


Attachments
variable does not show logical structure (114.26 KB, image/png)
2018-11-23 04:24 EST, Hugh Yang CLA
no flags Details
See the variable 'initializer' (76.54 KB, image/png)
2018-11-27 00:24 EST, Hugh Yang CLA
no flags Details
debug into a class icon file (986.10 KB, image/png)
2018-11-27 02:33 EST, Hugh Yang CLA
no flags Details
debug into a J icon file (1.04 MB, image/png)
2018-11-27 02:33 EST, Hugh Yang CLA
no flags Details
spring class file correctly recognized (1.45 MB, image/png)
2018-11-27 04:57 EST, Hugh Yang CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hugh Yang CLA 2018-11-23 04:24:26 EST
Created attachment 276669 [details]
variable does not show logical structure

I like the Show Logical Structure feature a lot when debugging Java applications. However, this feature seems no longer working in Eclipse version 4.9 (2018-09 release).

Steps to reproduce:
1. Debug a Java application
2. Open the Variables view, and check the Show Logical Structure button, see the list variable 'initializers' still do not show logical structure. See the screenshot below.
Comment 1 Sarika Sinha CLA 2018-11-23 06:15:13 EST
Show Logical Structure is switched on by default now, can you check in a new workspace ?
It should come automatically, you don't need to enable Show Logical Structure again.
Comment 2 Hugh Yang CLA 2018-11-27 00:19:45 EST
Yes, I can confirm that Show Logical Structure is enabled by default, but it doesn't  work. I created a new workspace and tried again, the result is the same: the Variable view of the list variable clearly is NOT logical structure, see the screenshot in the attachment.
Comment 3 Hugh Yang CLA 2018-11-27 00:24:31 EST
Created attachment 276710 [details]
See the variable 'initializer'
Comment 4 Sarika Sinha CLA 2018-11-27 00:35:48 EST
(In reply to Hugh Yang from comment #2)
> Yes, I can confirm that Show Logical Structure is enabled by default, but it
> doesn't  work. I created a new workspace and tried again, the result is the
> same: the Variable view of the list variable clearly is NOT logical
> structure, see the screenshot in the attachment.

Can you try in a new workspace? just to understand the problem better.
Comment 5 Hugh Yang CLA 2018-11-27 00:55:10 EST
Yes, I just tried in a new workspace, and import an existing maven project, it is a typical spring boot project. I debug the project as Java application, and I can see the Show Logical Structure icon is checked by default, but the variable view of the list type is simply not its logical structure.

I am using macOS Mojave and Eclipse 2018-09.
Comment 6 Sarika Sinha CLA 2018-11-27 01:23:15 EST
Can you try on a Java Project?

May be something is missing in the bridging with spring boot project.
Comment 7 Hugh Yang CLA 2018-11-27 02:32:26 EST
I just tried it in a simple Java project with no maven and no spring boot, and the Show Logical Structure works.

Now I suspect if the issue is related to the opened file type during the debug session. When I debug into a Java file which is from a jar, sometimes Eclipse give me a file with J icon (indicate the file is a java file), sometimes Eclipse give me a file with 010 icon (indicate the file is a class file).

The Show Logical Structure works if the opened file is with class icon, it does not work if the opened file is with J icon. Please see the attachment.

I do not know why Eclipse sometimes give me J icon file but sometimes give me class icon file. I usually expect class icon file if the file is from a dependent jar.
Comment 8 Hugh Yang CLA 2018-11-27 02:33:22 EST
Created attachment 276711 [details]
debug into a class icon file
Comment 9 Hugh Yang CLA 2018-11-27 02:33:59 EST
Created attachment 276712 [details]
debug into a J icon file
Comment 10 Andrey Loskutov CLA 2018-11-27 03:06:39 EST
(In reply to Hugh Yang from comment #9)
> Created attachment 276712 [details]
> debug into a J icon file

The "empty J" icon means, the file is not recognized as being on the project classpath. So something is wrong with the launch config. Try to figure out, where the class is and why it is not on the classpath - if you know where the library is, you can add it to the launch config classpath.
Comment 11 Hugh Yang CLA 2018-11-27 04:11:06 EST
If I click F3 on the Java class name, Eclipse open a class file correctly.
However, if I debug into the same class file with F5 step into, Eclipse open a J file, which is very strange. For me I think the file is on classpath because there is no compilation error when import this class in my code.
Comment 12 Hugh Yang CLA 2018-11-27 04:28:04 EST
If I directly set a breakpoint in the class file from maven jar, the debug execution will stop at the breakpoint, however, eclipse still open the class file in a J editor. Debug into a Java system class (like java.util.ArrayList) Eclipse open the system class file with a class editor correctly.
Comment 13 Hugh Yang CLA 2018-11-27 04:56:04 EST
For me it seems Eclipse correctly recognize the class file and its source code location, it just uses a wrong editor to open it during debug session. See the screenshot in the attachment.
Comment 14 Hugh Yang CLA 2018-11-27 04:57:13 EST
Created attachment 276720 [details]
spring class file correctly recognized
Comment 15 Hugh Yang CLA 2018-11-27 05:14:08 EST
I just also tried it on Eclipse Oxygen.3a release, Eclipse Oxygen.3a open class file from maven jar with a class editor correctly during debug session, and the Show Logical Structure works as expected. 

It is Eclipse 2018-09 release uses a J editor to open class file from maven jar, and Show Logical Structure does not work.
Comment 16 Sarika Sinha CLA 2018-11-27 05:45:25 EST
Can you disable Advanced Source Lookup from Preferences and see if it works ?
Comment 17 Hugh Yang CLA 2018-11-27 06:23:33 EST
After disabling Advanced Source Lookup from Debug Preferences, Eclipse open a class file with a class editor and Show Logical Structure also works!

Additionally, by disabling Advanced Source Lookup, I also feel Eclipse open a class file a little faster.

So why we have the option Advanced Source Lookup enabled by default as it has so many side effects?
Comment 18 Sarika Sinha CLA 2018-11-27 10:46:56 EST
@Igor,
Can you have a look into this?
Comment 19 Sarika Sinha CLA 2019-02-19 00:02:09 EST
@Igor,
Will you be able to look at this in 4.12 ?

It will be difficult to set it enabled by default if we have these issues.
Comment 20 Sarika Sinha CLA 2019-05-16 01:26:09 EDT
Hoping for a fix in 4.13.
Comment 21 Sarika Sinha CLA 2019-08-20 01:10:16 EDT
@Igor, Will you be be able to find time for this in 4.14?

If not we will have to consider having the Advanced Source Lookup disabled by default.
Comment 22 Sarika Sinha CLA 2019-11-13 07:20:41 EST
(In reply to Sarika Sinha from comment #21)
> @Igor, Will you be be able to find time for this in 4.14?
> 
> If not we will have to consider having the Advanced Source Lookup disabled
> by default.

ping !
Comment 23 Igor Fedorenko CLA 2019-11-13 07:54:13 EST
(In reply to Sarika Sinha from comment #22)
> (In reply to Sarika Sinha from comment #21)
> > @Igor, Will you be be able to find time for this in 4.14?
> > 
> > If not we will have to consider having the Advanced Source Lookup disabled
> > by default.
> 
> ping !

I can't debug this without an example project I can use to reproduce the problem locally. From the attached pictures I can tell that Eclipse is not able to match runtime classes to workspace projects during debug, but I don't know why. Feel free to disable advanced code lookup if you consider the issue reported in this bugzilla more important.
Comment 24 Sarika Sinha CLA 2019-11-22 05:42:49 EST
(In reply to Hugh Yang from comment #7)
> I just tried it in a simple Java project with no maven and no spring boot,
> and the Show Logical Structure works.
> 
> Now I suspect if the issue is related to the opened file type during the
> debug session. When I debug into a Java file which is from a jar, sometimes
> Eclipse give me a file with J icon (indicate the file is a java file),
> sometimes Eclipse give me a file with 010 icon (indicate the file is a class
> file).
> 
> The Show Logical Structure works if the opened file is with class icon, it
> does not work if the opened file is with J icon. Please see the attachment.
> 
> I do not know why Eclipse sometimes give me J icon file but sometimes give
> me class icon file. I usually expect class icon file if the file is from a
> dependent jar.

Hugh can you attach a sample project to reproduce this in eclipse SDK. Without this it will not be possible to provide a fix.
Comment 25 Eclipse Genie CLA 2022-05-19 06:31:26 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 26 Eclipse Genie CLA 2024-05-15 02:07:42 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.