Skip to content

Unable to determine the scope of the class #541

Closed

Description

@rajkumarGosavi

I have 2 directories and each of them has a file which has the same name.
Now vscode-java is unable to differentiate between these two files.
Thus this has resulted into unavailability of autocomplete feature and the docstring of various functions and methods.

Environment
  • Operating System: ElementaryOS x64
  • JDK version: javac 1.8.0_171
  • Visual Studio Code version: 1.23.1
  • Java extension version: 0.25
Steps To Reproduce
  1. First compile the Hello.java file in folder1
  2. then open the folder2 and try to use any method from the class in the same directory
  3. Notice that autocomplete will provide wrong or maybe no hints at all as there is same java file in both directory i.e. Phone.java.

folder1
folder2

Current Result
Expected Result
Additional Informations

Is this because that vscode-java takes the entire scope in consideration means if one class has already been compiled then the methods and attributes of that class will be shown at other places too?

Activity

  1. fbricon commented on May 25, 2018

    @fbricon
    Collaborator

    In the case of non-maven/gradle projects, all classes are added to a pseudo default java project in the backend. So identical files with the same namespace conflict with each other, there's no way to fix that on the vscode-java side.
    On your side, you can start by at least using package names, to disambiguate the classes, i.e

    • folder1/project1/Phone.java (declaring package project1; in its header)
    • folder2/project2/Phone.java (declaring package project2; in its header)
  2. rajkumarGosavi commented on May 25, 2018

    @rajkumarGosavi
    Author

    Yes, It surely does solve the problem. Thank you for your reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions