Bug 541779 - HashSet logical structure is shown as a HashMap
Summary: HashSet logical structure is shown as a HashMap
Status: REOPENED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 4.10   Edit
Hardware: PC All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2018-12-01 12:07 EST by Ed Willink CLA
Modified: 2018-12-05 22:20 EST (History)
1 user (show)

See Also:


Attachments
HashMap and HashSet (44.58 KB, image/jpeg)
2018-12-04 00:38 EST, Sarika Sinha CLA
no flags Details
screenshot (8.83 KB, image/png)
2018-12-04 07:11 EST, Ed Willink CLA
no flags Details
Logical expanded view (43.38 KB, image/jpeg)
2018-12-04 22:38 EST, Sarika Sinha CLA
no flags Details
Non Logical Expanded view (53.67 KB, image/jpeg)
2018-12-04 22:39 EST, Sarika Sinha CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2018-12-01 12:07:14 EST
2018-12RC1: The full Variables View display of a HashSet not unsurprisingly shows all the gory HashMap/Node detail, but surely the logical structure display should suppress the dummy Object values and show just the non-null keys as an indexed array.
Comment 1 Sarika Sinha CLA 2018-12-04 00:38:46 EST
Created attachment 276802 [details]
HashMap and HashSet

Can you please elaborate, what do you mean ?
Attached is the screenshot I see.
Comment 2 Ed Willink CLA 2018-12-04 02:01:33 EST
Sorry. Double checking the 'poor' display and it all seems good now.

I'll re-open if I can actually reproduce the issue.
Comment 3 Ed Willink CLA 2018-12-04 07:11:39 EST
Created attachment 276807 [details]
screenshot

your screenshot shows the problem too, but not so obviously since you did not expand.

In my screen shot the 2nd/5th lines are 100% redundant, the 3rd/4th lines should be merged giving

realizedSuccessEdges         HashSet...
    [0]                      SuccessEdgeImpl...
Comment 4 Ed Willink CLA 2018-12-04 07:12:56 EST
see attachment#276807 [details] from previous comment
Comment 5 Sarika Sinha CLA 2018-12-04 07:23:21 EST
(In reply to Ed Willink from comment #4)
> see attachment#276807 [details] from previous comment

This is non logical structure display. Please turn on Logical structure which shows directly 
[0]   value1
[1]   value 2
Comment 6 Ed Willink CLA 2018-12-04 08:21:29 EST
No. If it was a non-logical display you would see all the gory details of HashMap$Node and the entrySet/keySet/....
Comment 7 Sarika Sinha CLA 2018-12-04 22:38:45 EST
Created attachment 276818 [details]
Logical expanded view
Comment 8 Sarika Sinha CLA 2018-12-04 22:39:08 EST
Created attachment 276819 [details]
Non Logical Expanded view
Comment 9 Sarika Sinha CLA 2018-12-04 22:39:47 EST
Added the expanded views in my IDE.
Comment 10 Ed Willink CLA 2018-12-05 01:31:18 EST
Great. Is it too late to get the improved rules into RC2?

Can you share the improved rules now?
Comment 11 Sarika Sinha CLA 2018-12-05 03:45:24 EST
(In reply to Ed Willink from comment #10)
> Great. Is it too late to get the improved rules into RC2?
> 
> Can you share the improved rules now?

It is already there since 4.7, not sure why you are not seeing it.
Comment 12 Ed Willink CLA 2018-12-05 04:42:26 EST
Hm. Trying two different HashSet's the displays are as you suggest. At least my screenshot reminds me where I got a bad display. Need to investigate further/provide a complete almost-trivial repro.
Comment 13 Ed Willink CLA 2018-12-05 05:05:18 EST
(In reply to Ed Willink from comment #12)
> Need to investigate further/provide a complete almost-trivial repro.

Using the same JUnit test on two different Windows 10, 2018-12RC1 installations, I get different results (one right, one 'wrong'). Checking Window->Preferences->Java->Debug->Logical Structures, the 5 entries all appear to be as contributed by JDT; no accidental magic user tweaks.

But looking at the entries I don't see how it can work. There is no detail formatter for HashSet, so it presumably uses Map that formats as an array of entries that are formatted as key/value pairs.

Surely it can only work if there is a Set formatter that displays keySet().toArray()?
Comment 14 Ed Willink CLA 2018-12-05 05:13:49 EST
(In reply to Ed Willink from comment #13)
> ... I get different results (one right, one 'wrong') ...]

Found the difference. If the context menu is invoked on the HashSet, there is a Show Logical Structure->Array (last used) selection that differs between my machines.

At best the availability of four display options from the permutation of Logical/Non-Logical Array/not-Array is confusing.

I would expect that Logical/Non-Logical is a persistent icon-driven user preference.

Array/not-Array if useful at all, should either also be persistent icon-driven or a one-time short temporary tweak.
Comment 15 Sarika Sinha CLA 2018-12-05 22:20:25 EST
We don't have time to work on this, if any one wants to work on this, we can provide inputs.