Bug 560812 - Computing type hierarchy fails
Summary: Computing type hierarchy fails
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.14   Edit
Hardware: PC Windows 10
: P3 major with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-05 07:40 EST by Beat Wieland CLA
Modified: 2024-03-01 00:27 EST (History)
0 users

See Also:


Attachments
Sample project to reproduce the bug (132.56 KB, application/x-zip-compressed)
2020-03-05 07:40 EST, Beat Wieland CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Beat Wieland CLA 2020-03-05 07:40:01 EST
Created attachment 282014 [details]
Sample project to reproduce the bug

Used Eclipse Version: 2019-12 (4.14.0), Build id: 20191212-1212

Extract the appended zip and import the project (File -> Import... -> Existing Projects into Workspace -> select the directory, where you extracted the project to)

Open the class Demo in a code editor tab, then open the type hierarchy (F4) -> A dialog pops up, saying:

An internal error occurred during: "Computing type hierarchy of 'Demo - org.eclipse.bug.f4'...". Index 0 out of bounds for length 0

Open the Error Log (Window -> Show View -> Error Log) and open the event details. Stack Trace:

java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
	at org.eclipse.jdt.internal.compiler.lookup.ModuleBinding.getOrCreateDeclaredPackage(ModuleBinding.java:339)
	at org.eclipse.jdt.internal.compiler.lookup.ModuleBinding$UnNamedModule.getDeclaredPackage(ModuleBinding.java:105)
	at org.eclipse.jdt.internal.compiler.lookup.ModuleBinding.combineWithPackagesFromOtherRelevantModules(ModuleBinding.java:670)
	at org.eclipse.jdt.internal.compiler.lookup.ModuleBinding.getVisiblePackage(ModuleBinding.java:615)
	at org.eclipse.jdt.internal.compiler.lookup.ModuleBinding.getTopLevelPackage(ModuleBinding.java:552)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTopLevelPackage(LookupEnvironment.java:1652)
	at org.eclipse.jdt.internal.compiler.lookup.Scope.getTypeOrPackage(Scope.java:3442)
	at org.eclipse.jdt.internal.compiler.lookup.Scope.getType(Scope.java:3077)
	at org.eclipse.jdt.internal.compiler.ast.SingleTypeReference.getTypeBinding(SingleTypeReference.java:57)
	at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:528)
	at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:629)
	at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveTypeArgument(TypeReference.java:642)
	at org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference.internalResolveLeafType(ParameterizedSingleTypeReference.java:264)
	at org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference.internalResolveType(ParameterizedSingleTypeReference.java:174)
	at org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference.resolveType(ParameterizedSingleTypeReference.java:390)
	at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:625)
	at org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression.resolveTypeForQualifiedAllocationExpression(QualifiedAllocationExpression.java:373)
	at org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression.resolveType(QualifiedAllocationExpression.java:303)
	at org.eclipse.jdt.internal.compiler.ast.Expression.resolve(Expression.java:1066)
	at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:641)
	at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:316)
	at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:551)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1293)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1418)
	at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:666)

My Session Data is:

eclipse.buildId=4.14.0.I20191210-0610
java.version=11.0.2
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_GB
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product


This problem does not occur, if one of following changes are made:
- type inference isn't used: Change line 5 in class Demo to: GenericClass<String> anonymousClassInstance = new GenericClass<String>() {};
- the value of the attribute test in .classpath is changed to false (line 11) (Refresh the project in Eclipse after modifying the file.) It doesn't matter which library is used: As long as there is one classpathentry with attribute test set to true, the problem occurs.
- the file src/main/java/module-info.java is removed
Comment 1 Eclipse Genie CLA 2022-02-24 01:32:54 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 2 Eclipse Genie CLA 2024-03-01 00:27:44 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.