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

interface completion tries to import top level type from same class

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

Description

Open completion at the `|` and accept the `ChildInterface` completion:

```java
public class TestImport implements | {

}

interface TopLevelInterface {
interface ChildInterface {

}
}
```

The result is

```java
import TopLevelInterface.ChildInterface;

public class TestImport implements ChildInterface {

}

interface TopLevelInterface {
interface ChildInterface {

}
}
```

This makes no sense, since you can't import types from the default package, and the type is in the current compilation unit. The correct completion should be:

```java
public class TestImport implements TopLevelInterface.ChildInterface {

}

interface TopLevelInterface {
interface ChildInterface {

}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.