redhat-developer / redhat-developer/vscode-java
Renaming a Java object to change the case without changing the name does not result in a properly renamed file
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 546
- Avg merge
- 20h 1m
- Merged PRs (30d)
- 11
Description
If you have a class, say someClassIWrote, tied to a file someClassIWrote.java and you rename the class using the F2 refactor command changing only the case, to, say, SomeClassIWrote, the filename's case does not change to match. This causes the error "The public type SomeClassIWrote must be defined in its own fileJava(16777541)" to be emitted. Renaming the file itself fixes the problem. (Interestingly, the Tab filename does not change to match.) This is probably due to a mismatch between the case sensitivity of the Linux OS vs the case insensitivity of the Windows OS.
Environment
- Operating System: Windows 10
- JDK version:
openjdk version "17.0.8.1" 2023-08-24
OpenJDK Runtime Environment Temurin-17.0.8.1+1 (build 17.0.8.1+1)
OpenJDK 64-Bit Server VM Temurin-17.0.8.1+1 (build 17.0.8.1+1, mixed mode, sharing) - Visual Studio Code version: 1.85.1 (WPILib FIRST Robotics edition)
- Java extension version: v1.30.2024042308
Steps To Reproduce
- Create an object
- Change the case of a single letter via the F2 command
I'm somewhat inexperienced with this IDE, so I will go after logs on request. I figure checking for this behavior is extremely easy.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the F2 rename command in the VS Code Java extension and reproduce the case-only class rename on Windows. Trace how the rename updates the Java file and editor tab; done means both match the new class-name case and the public-type diagnostic is absent.
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