redhat-developer / redhat-developer/vscode-java

vscode-java tries to compile temporary files

Open
#676 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug compile priority/P1
Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

It seems like the extension automatically adds temporary files to the build path and then never removes them.

Environment
  • Operating System: Windows
  • JDK version: 1.8
  • Visual Studio Code version: 1.28.1 (and previous versions)
  • Java extension version: 0.32.0
Steps To Reproduce
  1. Create a maven (probably the same with gradle) based java project
  2. Add to git repository
  3. Compile, debug, check that everything works.
  4. Right-click a file, compare to previous version
  5. Debug the project - it will fail to compile.
  6. Check extension log, you will see a lot of errors of unable to resolve dependencies and also that the type that was in the file you compared is already defined.
    Bonus section
  7. Close VS Code
  8. Open again, with same project
  9. Try to debug - it will still fail to compile.
  10. Check the extension log, you will see a single error, something like:
    Error occured while building workspace. Details:
    message: The project was not built since the source file /jdt.ls-java-project/src/com/test/test/testfile-2dfd1f2d__202220CoCQDMrqr9JO.java could not be read;code: 0
Current Result

Whenever I compare a file to it's previous version, vscode cannot compile my project anymore

Expected Result

To only compile files that are in the path of the project, not temporary files.

Additional Informations

This will most problably also resolve #390
Workaround - close Code, delete workspace cache, open project again.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in a Maven-based Java project using the listed compare and debug steps, then inspect the extension log and workspace cache behavior. Trace how temporary comparison files enter the project build path; done means debugging succeeds without unresolved dependencies or duplicate-type errors, including after restarting VS Code.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.