apache / apache/netbeans

Code completion does not offer overriding toString() when a super interface has declared it

Open
#9,469 0 comments 0 reactions 0 assignees View on GitHub
Java kind:bug needs:triage
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 30

### What happened

Within a Java class that implements an interface which declares the standard `toString()` method (like for example the `java.lang.CharSequence` interface does), code completion does not offer overriding `Object::toString()`.

### Language / Project Type / NetBeans Component

Java, Code completion

### How to reproduce

```java
class Example
{
interface Interface { public String toString(); }
static class Impl implements Interface { }
}
```
Within the `Impl` class, invoke code completion => overriding `toString()` is not offered.

Remove either `toString()` in `Interface`, or remove `implements Interface` from `Impl` => overriding `toString()` is now offered.

### Did this work correctly in an earlier version?

No / Don't know

### Operating System

Windows

### JDK

17

### Apache NetBeans packaging

Apache NetBeans binary zip

### Anything else

_No response_

### Are you willing to submit a pull request?

No

Contributor guide

Open the contributing guide

Research direction

Start in the Java code-completion entry point and reproduce the example with Interface and Impl, then compare completion with and without the super-interface declaration. Trace why overriding Object::toString() is omitted in the first case. Done means the completion list offers toString() for Impl while preserving the existing behavior in the comparison cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.