Bug 573348 - endless loop in TraditionalHierarchyViewer.getDepth()
Summary: endless loop in TraditionalHierarchyViewer.getDepth()
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.20   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: 4.20 M3   Edit
Assignee: Jeff Johnston CLA
QA Contact: Jeff Johnston CLA
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2021-05-04 08:14 EDT by Julian Honnen CLA
Modified: 2021-05-18 17:26 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Julian Honnen CLA 2021-05-04 08:14:46 EDT
1) open type hierarchy on java.util.concurrent.ScheduledExecutorService
2) UI frozen in the following endless loop:

   java.lang.Thread.State: RUNNABLE
	at java.util.Arrays.hashCode(java.base@11.0.9.1/Arrays.java:4685)
	at org.eclipse.jdt.internal.core.JarPackageFragmentRoot.hashCode(JarPackageFragmentRoot.java:381)
	at org.eclipse.jdt.internal.core.PackageFragment.hashCode(PackageFragment.java:450)
	at org.eclipse.jdt.internal.core.AbstractClassFile.hashCode(AbstractClassFile.java:398)
	at org.eclipse.jdt.internal.core.JavaElement.hashCode(JavaElement.java:548)
	at java.util.HashMap.hash(java.base@11.0.9.1/HashMap.java:339)
	at java.util.HashMap.get(java.base@11.0.9.1/HashMap.java:552)
	at org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.getSuperInterfaces(TypeHierarchy.java:716)
	at org.eclipse.jdt.internal.ui.typehierarchy.TraditionalHierarchyViewer$TraditionalHierarchyContentProvider.getDepth(TraditionalHierarchyViewer.java:86)
	at org.eclipse.jdt.internal.ui.typehierarchy.TraditionalHierarchyViewer$TraditionalHierarchyContentProvider.getExpandLevel(TraditionalHierarchyViewer.java:72)
	at org.eclipse.jdt.internal.ui.typehierarchy.TraditionalHierarchyViewer.updateContent(TraditionalHierarchyViewer.java:48)
	at org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyViewPart.lambda$6(TypeHierarchyViewPart.java:1214)
	at org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyViewPart$$Lambda$2262/0x0000000801ae0440.run(Unknown Source)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:74)
	at org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyViewPart.updateHierarchyViewer(TypeHierarchyViewPart.java:1215)
	at org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyViewPart.updateViewers(TypeHierarchyViewPart.java:646)
	at org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyLifeCycle.lambda$1(TypeHierarchyLifeCycle.java:284)
	at org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyLifeCycle$$Lambda$2261/0x0000000801ae0040.run(Unknown Source)


Reproduced in an eclipse SDK installation (I20210502-1800) with both an 1.8 and 11 JRE configured.

The issue seems to be introduced by bug 564093. The loop body always refers to same input and can't terminate:

private int getDepth(ITypeHierarchy hierarchy, IType input) {
	int count= 0;
	if (Flags.isInterface(hierarchy.getCachedFlags(input))) {
		IType[] superInterfaces= hierarchy.getSuperInterfaces(input);
		while (superInterfaces != null && superInterfaces.length > 0) {
			count++;
			IType superInterface= hierarchy.getSuperInterfaces(input)[0];
			superInterfaces= hierarchy.getSuperInterfaces(superInterface);
		}

	}
Comment 1 Eclipse Genie CLA 2021-05-04 16:04:59 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/180180
Comment 3 Jeff Johnston CLA 2021-05-05 15:15:29 EDT
Released for 4.20 M3
Comment 4 Jeff Johnston CLA 2021-05-18 17:26:34 EDT
Verified for 4.20 M3 using I20210518-0850 build