apache / apache/netbeans

[VSCode extension] Organize Imports fails due to IOOBE

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

Description

### Apache NetBeans version

Apache NetBeans 15

### What happened

Doing `Organize Imports` does nothing when there are unresolved imports (if the only action to take, is to remove unused imports, it works as expected). The extension's log shows (there's 3 duplicate lines per attempt; this isn't the output from 3 attempts):
```
Index 23 out of bounds for length 23
Index 23 out of bounds for length 23
Index 23 out of bounds for length 23
```

### How to reproduce

Open a Java file with unresolved imports and do Organize Imports.

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

No / Don't know

### Operating System

Windows 11

### JDK

openjdk full version "20-ea+22-1594"

### Apache NetBeans packaging

Apache VSNetBeans for VSCode

### Anything else

_No response_

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

Yes

### Code of Conduct

Yes

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure in the VSCode extension with a Java file containing unresolved imports, then inspect the Organize Imports path and its extension log output. Done means Organize Imports completes without the IndexOutOfBoundsException and handles unresolved imports as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.