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

MethodDeclaration.reolveBinding() returns null if argument/return-value is of a missing inner class

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

Description

see code: https://github.com/fishautumn/jdt-core-demo for more detail.

If `MissingOuterClass` is not in any source or class file, `MethodDeclaration.reolveBinding()` returns a valid MethodBinding instance:
```java
package org.demo;

public class Demo {
public MissingOuterClass demo() {
}
}
```

while if `OuterClass` is present in a class file, that doesn't define `OuterClass.InnerClass`, `MethodDeclaration.reolveBinding()` returns `null`:
```java
package org.demo;

public class Demo {
public OuterClass.InnerClass demo() {
}
}
```

it should be fixed by changing `org.eclipse.jdt.internal.compiler.lookup.Scope#getMemberType` method, to provide a `org.eclipse.jdt.internal.compiler.lookup.MissingTypeBinding` as closestMatch.

Contributor guide

Open the contributing guide

Research direction

Start with the linked jdt-core-demo reproducer and inspect org.eclipse.jdt.internal.compiler.lookup.Scope#getMemberType alongside MissingTypeBinding. Confirm the difference between a wholly missing outer class and a missing inner class, then verify that the inner-class case returns a valid closest-match binding rather than null.

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
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.