redhat-developer / redhat-developer/vscode-java
Reference to classes with private constructor not resolved
未关闭
还没有人认领这个 Issue。
- 主要语言
- TypeScript
- 星标
- 2.3k
- 派生
- 546
- 平均合并
- 20 小时 1 分钟
- 30 天内合并 PR
- 11
描述
I have a class implementing singleton pattern:
public class SomeSingleton {
private static SomeSingleton uniqueInstance = null;
private SomeSingleton() {}
@Synchronized
public static SomeSingleton getInstance() {
if (uniqueInstance == null)
uniqueInstance = new SomeSingleton();
return uniqueInstance;
}
public void someMethod() {}
}
Any reference to SomeSingleton.getInstance().someMethod() in the editor is underlined in red as error:
SomeSingleton cannot be resolved to a type Java(16777218)
The code build fine with gradle from the command line, without any errors.
My vscode setup:
Version: 1.97.2 (system setup)
Commit: e54c774e0add60467559eb0d1e229c6452cf8447
Date: 2025-02-12T23:20:35.343Z
Electron: 32.2.7
ElectronBuildId: 10982180
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Windows_NT x64 10.0.26100
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,在 Windows 上使用 singleton 示例和 Gradle 项目于 VS Code 中重现该诊断。将编辑器对 Java 语言服务器的解析与命令行成功构建的结果进行比较。当引用不再显示“SomeSingleton cannot be resolved to a type”,且项目仍能成功构建时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java, vscode
- 领域
- developer-experience, devtools
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100