eclipse-jdt / eclipse-jdt/eclipse.jdt.core

ClassCastException: org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding-> org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding

Open
#329 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 10h
Merged PRs (30d)
49

Description

Linux Mint 20.1 (Ulyssa)
5.4.0-120-generic

Eclipse Version
Version: 2022-06 (4.24.0)
Build id: 20220609-1112

Installed JRE is pointing at /usr/lib/jvm/jdk1.8.0_281

Get A compile error on one file pointing at the package xxx; line 1

Internal compiler error: java.lang.ClassCastException: class org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding cannot be
cast to class org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding (org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding
and org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding are in unnamed module of loader org.eclipse.osgi.internal.loader.
EquinoxClassLoader @53fb489d) at org.eclipse.jdt.internal.compiler.ast.LambdaExpression$LocalTypeSubstitutor.substitute
(LambdaExpression.java:1490)

-------------------------------------

To see if i could narrow it down,

- i cut out the bodies of all the methods so that they were all just empty methods, and the problem went away.
- i added back in 1 method body, and still no issue
- i added back in a 2nd method body, and the issue reappeared.
- i then cut out the first method body, leaving only the method body that the problem appeared, and the problem came back

So it appears that the error happens if i have any two method bodies populated, but if any 1 method body is populated, the problem goes away.

Oddly again, it is only this class

-----------------------------------------------

I've cut down everything i could out of the file to the point that if i remove anymore more, the bug goes away. See attached

Contributor guide

Open the contributing guide

Research direction

Start with the reduced attached Java file and the stack trace at org.eclipse.jdt.internal.compiler.ast.LambdaExpression.java:1490. Reproduce the compile error with the reported Eclipse/JRE setup, then compare the one-method and two-method cases. Done means the reduced case compiles without the BinaryTypeBinding-to-LocalTypeBinding ClassCastException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.