Rianico opened a new issue, #14123: URL: https://github.com/apache/dolphinscheduler/issues/14123
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Project entity use `!=` instead `equals` to compare id, whose type is `Integer`, which may cause a problem when id is not in the range of `-128 ~ 127`: ```java @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Project project = (Project) o; if (id.equals(project.id)) { return false; } return name.equals(project.name); } ``` JVM only caches the `Integer` object between -128 and 127, and will create a new object for other numbers: ```java jshell> Integer a = 127 a ==> 127 jshell> Integer b = 127 b ==> 127 jshell> a == b $3 ==> true jshell> Integer b = 128 b ==> 128 jshell> Integer a = 128 a ==> 128 jshell> a == b $6 ==> false ``` ### What you expected to happen When id is not in the range of `-128 ~ 127`, the comparation of projects can get a correct result. ### How to reproduce Create two Project entity `p1` and `p2` with the same name, set the id to the `new Integer(128)`, and call the `p1.equals(p2)`, which will get the `false`. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
