Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reference to classes with private constructor not resolved #3953

Open
sirish-bajpai opened this issue Feb 17, 2025 · 2 comments
Open

Reference to classes with private constructor not resolved #3953

sirish-bajpai opened this issue Feb 17, 2025 · 2 comments

Comments

@sirish-bajpai
Copy link

sirish-bajpai commented Feb 17, 2025

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
@snjeza
Copy link
Contributor

snjeza commented Feb 18, 2025

@sirish-bajpai I can't reproduce the issue. Could you attach a project example?

@sirish-bajpai
Copy link
Author

Hi @snjeza. Thanks for your reply.
I have created this public project, which gives me error in Vscode as described:
https://github.com/sirish-bajpai/Prvcnsttst.git

Makes me wonder if its something in my setup or environment, if you cannot see it.
I am starting vscode from WSL2 shell as: code .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants