Skip to content

[BUG]string array equals a string was not captured by compiler as a problem ,while failed to compile the class. #4020

@zheddie

Description

@zheddie

OS:
Windows 10 22H2,

VSCode:
Version: 1.98.2
Commit: ddc367ed5c8936efe395cffeec279b04ffd7db78
Date: 2025-03-12T13:32:45.399Z
Electron: 34.2.0
ElectronBuildId: 11161602
Chromium: 132.0.6834.196
Node.js: 20.18.2
V8: 13.2.152.36-electron.0
OS: Windows_NT x64 10.0.19045

Plugin of Java: Extension Pack of Java
Identifier
vscjava.vscode-java-pack
Version
0.29.0
Last Updated
2025-04-03, 17:05:41

Code to reproduce the issue:

package com.zg.bugs;
import java.lang.String;

public class StringArrayEqualsString{
    public  static void main(String[] args){
        String[] sss = {"aa","bb"};
        String sts = "cc";
        if(sss.equals(sts)){
            System.out.println("ERROR!");
        }else{
            System.out.println("DONE!");
        }
        return;
    }
}

Description:
when we use a string array (sss in the code) to do the equals() routine on a string (sts), this file would be failed to compile , while the vscode IDE didn't report any error or problem. This would cause the developer consume too much time to identify , as no any problem was reported, while the class was not successfully copmile out.

Anybody can help to fix it ? thanks.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions