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

Renaming of linked java file leads to unexpected changes

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

Description

## Summery
Renaming of an linked java file that does not contain an explicit class (default class) changes the fail in unexpected ways.

## Test setup
Java 24
Eclipse 2025-06
Windows 11

## How to Reproduce

[A1] Create a Java project with Java 24+
[A2] Enable preview feature in the project settings
[A3] Create a directory 'dir' in the project
[A4] Create a file in the directory 'dir' with name 'RenameTest.java' and with content [1]
[A5] Link the file 'RenameTest.java' into the 'src' directory (New > File... > Advanced > Link file in the file system > Browse > Select file from dir/RenameTest.java)
[A6] Select src/RenameTest.java and press F2 (or right click > Refactor > rename)
[A7] Change name to RenameTest_foo

The result of the rename is that the line
```java
//DEPS org.apache.commons:commons-exec:1.5.0
```
is changed to
```java
RenameTest_foo.apache.commons:commons-exec:1.5.0
```
Which of course is not valid java

[1]
```java
///usr/bin/env jbang "$0" "$@" ; exit $?

import java.io.IO;

//DEPS org.apache.commons:commons-exec:1.5.0

void main() throws Exception {
IO.println("Hello World");
}
```

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.