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

Incorrect constructor being generated for private classes #725

Closed
afzaal-ahmad-zeeshan opened this issue Nov 21, 2018 · 1 comment · Fixed by eclipse-jdtls/eclipse.jdt.ls#2841

Comments

@afzaal-ahmad-zeeshan
Copy link

This is different than another issue already registered, here, #683.

Environment
  • Operating System: Windows 10
  • JDK version: JDK 9
  • Visual Studio Code version: 1.29.1
  • Java extension version: 0.34.0
Steps To Reproduce
  1. This can be seen in the cases where you have a private class alongside a public class in the same file.
  2. Upon generating a constructor via ctor, constructor code for public class is inflated, even in the private classes.

screenshot 479

Current Result
package com.afzaalahmadzeeshan.utils;

class Employee {
    public Person() { // <--
        super();
    }
}

public class Person {
    public Person() {
        super();
    }
}
Expected Result
package com.afzaalahmadzeeshan.utils;

class Employee {
    public Employee() {
        super();
    }
}

public class Person {
    public Person() {
        super();
    }
}

It looks as if the code generator only looks for the public classes in the file, and generate the constructor for that.

@fbricon
Copy link
Collaborator

fbricon commented Nov 21, 2018

Right, this code snippet is rather dumb. The logic needs to be moved to jdt.ls, where the context will be available to provide an accurate completion.

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

Successfully merging a pull request may close this issue.

4 participants