Bug 320645 - Variables view: Logical Structure only allows to expand first of two identical children
Summary: Variables view: Logical Structure only allows to expand first of two identica...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
: 356543 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-07-22 11:08 EDT by Markus Keller CLA
Modified: 2023-12-21 15:46 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2010-07-22 11:08:31 EDT
I20100720-0800, also broken in 3.6, was OK in 3.5.2

- paste to Package Explorer:

package xy;
import java.util.ArrayList;

public class Try {
    public static void main(String[] args) {
        ArrayList<Integer> al= new ArrayList<Integer>();
        al.add(1);
        al.add(1);
        al.add(null);
        al.add(null); // Breakpoint, Show Logical Structure, Step Into add
    }
}

- set breakpoint
- debug
- enable Show Logical Structure
- Step Into 'add'
- in Variables view, expand 'this'
=> first Integer looks good, but second doesn't have a "+" to expand
Comment 1 Pawel Piech CLA 2011-09-02 01:42:22 EDT
*** Bug 356543 has been marked as a duplicate of this bug. ***
Comment 2 Pawel Piech CLA 2011-09-02 01:48:24 EDT
The following implementation of equals in JDIArrayEntryVariable is responsible for the bug.  I don't know the background for this comparing array elements based on value when they're in a logical structure.. perhaps it's a performance optimization.  However when multiple elements in the flex viewer tree at the same level are equal to each other, the viewer updates get messed up.

	public boolean equals(Object obj) {
		if (obj instanceof JDIArrayEntryVariable) {
			JDIArrayEntryVariable entry = (JDIArrayEntryVariable)obj;
			if (fLogicalParent != null) {
				try {
					return fLogicalParent.equals(entry.fLogicalParent) &&
					getValue().equals(entry.getValue());
				} catch (CoreException e) {
				}
			}
			return entry.getArrayReference().equals(getArrayReference()) &&
				entry.getIndex() == getIndex();
		}
		return false;
	}
Comment 3 Pawel Piech CLA 2011-09-02 01:58:54 EDT
Actually, it looks like the getValue().equals(entry.getValue()) in equals; was actually meant to be getIndex() == entry.getIndex(), because the hashCode() refers to getIndex()


	public int hashCode() {
		if (fLogicalParent != null) {
			return fLogicalParent.hashCode() + getIndex();
		}
		return getArrayReference().hashCode() + getIndex();
	}
Comment 4 Eclipse Genie CLA 2020-01-09 09:12:15 EST
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 5 Sarika Sinha CLA 2020-01-09 12:04:02 EST
Still the same.
Comment 6 Eclipse Genie CLA 2021-12-30 13:27:15 EST
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 7 Eclipse Genie CLA 2023-12-21 15:46:49 EST
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.