Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Package error not reported with "java.jdt.ls.javac.enabled":"on"

未关闭
#4,414 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
java, typescript, vscode

调研方向

解压 Demo25-javac-on.zip,并通过比较 foo\bar\ex02.java 与 ex01.java 和 ex03.java,在 "java.jdt.ls.javac.enabled":"on" 下复现该问题。检查 package diagnostics 和 workspace-cache class-file 路径是如何生成的,然后验证 ex02.java 和 ex03.java 报告 package 错误,并且缓存的类保留其源文件夹。

由索引模型根据 Issue 内容生成。

描述

bug

Describe the bug
When using "java.jdt.ls.javac.enabled":"on" on a unmanaged project, if the package does not match the folder hierarchy, no error is reported in VSCode interface

To Reproduce

  1. Unzip Demo25-javac-on.zip
  2. Open folder ... Demo25-javac-on
  3. Open file foo\bar\ex02.java -> The package is incorrect (bar instead of foo.bar) but no error is reported
  4. File ex01.java has the correct package
  5. File ex03.java has no package (compact source file)

Expected behavior
A package error should be reported for ex02.java and ex03.java . In fact, the class file are not placed in the correct folders in the workspace cache folder (see left side of the picture below). When javac is on, the class are placed in folders according to the package declared in the java file instead of the original folder hierarchy. So since the class file matches the package, no package error is reported. The correct behavior is to keep the class files in the same folders of the source java files like when javac is off (right side of picture below)

Screenshots
Image

Environment

  • Operating System: Debian 13
  • JDK version: 25
  • Visual Studio Code version: 1.121
  • Java extension version: 1.54.0

Additional Information
Maybe it is a problem in the JDT-LS from Eclipse?

主要语言
TypeScript
星标
2.3k
派生
547
平均合并
20 小时 9 分钟
30 天内合并 PR
10

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

redhat-developer/vscode-java 的其他 Issue

查看 redhat-developer/vscode-java 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。