vscode-java icon indicating copy to clipboard operation
vscode-java copied to clipboard

Constructor code completion is broken in certain situations

Open fbricon opened this issue 3 years ago • 4 comments

Given the following code:

import java.util.*;

public class Hello {

    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list = new ArrayList<>();
    }
}

When you autocomplete on the first ArrayList, (triggering autoimport of java.util.ArrayList is a usual use case), the result breaks the existing code, regardless of the java.completion.overwrite preference.

If you repeat the completion step on the LinkedList constructor, the completion doesn't provide you with a list of constructors for some reason, only the type, and applying the completion item doesn't break the code:

Mar-02-2022 15-19-27

fbricon avatar Mar 02 '22 14:03 fbricon