vscode-java-dependency icon indicating copy to clipboard operation
vscode-java-dependency copied to clipboard

Incorrect Package Warning even with correct folder structure

Open mithun2003 opened this issue 3 months ago • 2 comments

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.

mithun2003 avatar Sep 17 '25 15:09 mithun2003