Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Extension incorrectly runs cached `.class` file from another class of same name with no `package`

Open
#1,587 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
java, typescript, vscode

Research direction

Reproduce the issue by running folder1/Main.java and then folder2/Main.java, including the ./Main.java and ./folder/Main.java layout. Trace how the extension selects cached compiled classes; done means each unrelated Main.java runs its own output, including after the other file has already been run.

Written by the indexing model from the issue text.

Description

ai-triaged bug

Bug report

Suppose there is a file structure:

folder1/
    Main.java
folder2/
    Main.java
// folder1/Main.java
public class Main {
    public static void main(String[] args) {
        System.out.println("Main 1");
    }
}
// folder2/Main.java
public class Main {
    public static void main(String[] args) {
        System.out.println("Main 2");
    }
}

No package statements; the projects are not connected at all.

When folder1/Main.java is run first, it gives the correct output Main 1.
But if folder2/Main.java is then run, it gives the wrong output of Main 1 instead of Main 2; the first built file is run instead.
folder1/Main.java 'shadows' folder2/Main.java, since the class name is the same and there are no package statements.
Another file structure that causes this is ./Main.java, ./folder/Main.java

This bug is inconvenient when multiple different, unrelated Java projects are in the same workspace.

Dominant language
TypeScript
Stars
591
Forks
429
Avg merge
1d 9h
Merged PRs (30d)
19

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.

More from microsoft/vscode-java-debug

All issues in microsoft/vscode-java-debug

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.