Skip to content

Incorrect Package Warning even with correct folder structure #905

@mithun2003

Description

@mithun2003

Incorrect Package error
Problem:
Even when my Java package names match the folder structure, VS Code shows an “Incorrect Package” error.

For example, my structure is:

src/
└── Model/
├── Doctor.java
├── Hello1.java
└── Tester.java

Inside Tester.java:

package Model;
public class Tester {
}

But VS Code highlights the package Model; line with:
Incorrect Package (hints: 1:9-1:14)

This error goes away only after restarting VS Code, but it keeps coming back when I open or create new files.

Steps to Reproduce:

Create a folder src/Model/

Add Tester.java with package Model;

VS Code shows "Incorrect Package" error even though structure is valid.

Expected Behavior:
The Java package should be recognized correctly without requiring a VS Code restart.

Actual Behavior:
Incorrect package warning is shown until I restart VS Code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions