Community
Participate
Working Groups
Bug: Using .equals to compare two org.eclipse.jdt.core.IJavaElement[]'s, (equivalent to ==) in org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyViewPart.updateInput(IJavaElement[]) This method invokes the .equals(Object o) method on an array. Since arrays do not override the equals method of Object, calling equals on an array is the same as comparing their addresses. To compare the contents of the arrays, use java.util.Arrays.equals(Object[], Object[]). To compare the addresses of the arrays, it would be less confusing to explicitly check pointer equality using ==. Rank: Scariest (3), confidence: Normal Pattern: EC_BAD_ARRAY_COMPARE Type: EC, Category: CORRECTNESS (Correctness) This bug has been introduced in Bug 21417 see the following commit commit 4db882a354cc2434c1f22f9f6d664a1ea86ce1d3 Author: Raksha Vasisht <rvasisht> 2010-09-13 21:41:04 Committer: Raksha Vasisht <rvasisht> 2010-09-13 21:41:04 Parent: 3a22874430e83da885df96967ad295af40285434 (Fixed bug 304217: [type hierarchy] Widget is disposed error on type hierarchy computation) Child: 6149731d53aecdf58a16b1ff680682bf9d4436d4 (Fixed bug 325250: [type hierarchy] Improve label in history dropdown for Multi-select Java elements and show in Type Hierarchy) Branches: change/144108/30, change/144108/33, change/144108/36, change/144108/37, change/144108/40, change/144108/46, change/144110/29, change/144110/31, change/144110/33, change/144110/35, change/144113/16, change/144113/18, change/144557/7, change/144558/6, change/144558/7, change/144558/8, change/144558/9, change/144559/9, change/144559/10, change/144559/11, change/144562/14, change/144563/10 and 218 more branches Fixed bug 21417: [type hierarchy] Multi-select packages and show in Type Hierarchy Before this commit the signature of the method private void updateInput(IJavaElement[] inputElements) was private void updateInput(IJavaElement inputElement) The corresponding of the new comparison if (!inputElements.equals(prevInput)) { was before if (!inputElement.equals(prevInput)) { so it made use of the equals method of the IJavaElement before and now compares by reference. I think it is broken now. How to test?
Gerrit change https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/171220 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=591c489465555590455cc09935fb25aa1d94c3d8
Released for 4.18M3
Verified for 4.18M3 using I20201117-0600 build