Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 573385 - Hovering over chained local variable not showing the value
Summary: Hovering over chained local variable not showing the value
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 4.20   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: 4.20 M3   Edit
Assignee: Gayan Perera CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-05 12:44 EDT by Gayan Perera CLA
Modified: 2021-07-06 09:24 EDT (History)
1 user (show)

See Also:


Attachments
Hovering on Local (9.02 MB, video/quicktime)
2021-05-11 14:36 EDT, Sarika Sinha CLA
no flags Details
Gayan's Hover over Local (3.95 MB, video/quicktime)
2021-05-12 15:10 EDT, Gayan Perera CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gayan Perera CLA 2021-05-05 12:44:38 EDT
After fixing Bug 572629, when hovering over local array variables doesn't show the length value when hovering over length identifier.
Comment 1 Eclipse Genie CLA 2021-05-05 14:19:43 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.debug/+/180255
Comment 2 Sarika Sinha CLA 2021-05-11 14:36:27 EDT
Created attachment 286366 [details]
Hovering on Local

@Gayan, look at this.
Comment 3 Gayan Perera CLA 2021-05-11 17:07:16 EDT
@Sarika i checked the screencast and it seems like the changes are not applied. Does your workspace source contains the previous hover fix we did for chain objects?
Comment 4 Sarika Sinha CLA 2021-05-12 00:50:59 EDT
(In reply to Gayan Perera from comment #3)
> @Sarika i checked the screencast and it seems like the changes are not
> applied. Does your workspace source contains the previous hover fix we did
> for chain objects?

The changes from https://git.eclipse.org/r/c/jdt/eclipse.jdt.debug/+/180255 are in my local on top of master? 
Anything else expected?
Comment 5 Gayan Perera CLA 2021-05-12 05:19:55 EDT
@Sarika can you try without using mark occurrences on the length identifier ? To see if that make a difference in the hover ?
Comment 6 Gayan Perera CLA 2021-05-12 15:10:25 EDT
Created attachment 286373 [details]
Gayan's Hover over Local
Comment 7 Sarika Sinha CLA 2021-05-12 16:23:16 EDT
(In reply to Gayan Perera from comment #5)
> @Sarika can you try without using mark occurrences on the length identifier
> ? To see if that make a difference in the hover ?

I tried. Doesn't help. I debugged and see that evaluateQualifiedNode method fails. the evaluator gets the result with empty value.
Comment 8 Gayan Perera CLA 2021-05-12 17:46:38 EDT
Ok something I didn’t do today is pull jdt.core changes. I will check tomorrow. But meantime does the tests also fails ?
Comment 9 Gayan Perera CLA 2021-05-13 04:42:50 EDT
@Sarika i ran against the later jdt.core master as well. But it still it works, this is my code snippet

package app;

public class Application {
	public static void main(String[] args) {
		char[] name1 = new char[] {'g', 'y', 'm'};
		char[] name2 = new char[] {'g', 'y', 'm'};

		System.out.println(name1.hashCode());
		System.out.println(name2.length);
		System.out.println(args.length);
	}	
}
Comment 10 Sarika Sinha CLA 2021-05-13 06:24:12 EDT
Very strange, Test is passing. Will have to debug further.
Comment 11 Sarika Sinha CLA 2021-05-13 07:32:57 EDT
(In reply to Sarika Sinha from comment #10)
> Very strange, Test is passing. Will have to debug further.

Finally, mystery solved. 

If you have a breakpoint inside the lambda 
Stream.of(name).forEach(a -> {
			 System.out.println(a.length);			 
		});

Then names/name is not resolved. 

Outside of lambda it is resolved.

Without the patch, even if I hover at names.length, names is shown and not length.
Comment 12 Gayan Perera CLA 2021-05-13 09:26:08 EDT
Ohh got it @Sarika, will update the fix to support the outer-scope variable chain resolution as well.