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

Java Autocomplete is entering blank values instead of method stubs

Open
#4,304 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 12h
Merged PRs (30d)
47

Description

Let's make sure issue is not already fixed in latest builds first.

- [ ] I verified I can reproduce this issue against [latest Integration Build of Eclipse SDK](https://download.eclipse.org/eclipse/downloads/)

When searching for this issue, I have only been able to find results related to issues with enabling autocomplete. I can open autocomplete, and it displays the values I expect. This is instead about what happens when a selection is made.

This may be related to https://github.com/eclipse-jdt/eclipse.jdt.core/issues/4099. The classes and exceptions are similar, but the behaviour is slightly different. But this would also mean that https://github.com/eclipse-jdt/eclipse.jdt.core/pull/3795 is the most likely cause.

## Steps to reproduce

From a fresh installation and clean workspace:

* Add a Java project.
* Import as Maven is recommended
* Ensure the Maven pom has the Java source set to 8

I tried

* Create a new Java class, extending an existing class
* In the class body, start a method signature and then open autocomplete
* Select the method to insert

I expected: A method stub to be inserted at the cursor position (and also replacing the partial signature)

But got: Only a line break at the cursor position

## Here is some relevant log output

An error is added to the error log. I have attached a screenshot. The key line is `java.lang.StringIndexOutOfBoundsException: Range [141, 149) out of bounds for length 137 `. Importantly, this is independent of the file being edited. So I would guess this relates more to the template selected instead of the file being edited.

Image

## Tested under this environment:
* macOS 14.5 (23F79)
* Eclipse IDE for Enterprise Java and Web Developers
* Version: 2025-06 (4.36.0)
* Build id: 20250605-1316
* JDK: temurin-21

Multiple other JDKs are also installed on the OS, bound to various execution environments. (These have built up over the years.)

Additional plugins
* AnyEditTools
* macOS Eclipse Launcher
* SetProperties
* SonarCube
* TestNG
* TM Terminal CDT
* Plus several custom plugins we use internally, which I cannot share

Using Version 2025-03 does not produce the issue when using the same plugins

## Community

- [ ] I understand reporting an issue to this OSS project does not mandate anyone to fix it. Other contributors may consider the issue, or not, at their own convenience. The most efficient way to get it fixed is that I fix it myself and contribute it back as a good quality patch to the project.

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.