Skip to content

Refactor ObjectComparison to utility class#949

Merged
SougandhS merged 1 commit into
eclipse-jdt:masterfrom
SougandhS:SingleTon
Apr 27, 2026
Merged

Refactor ObjectComparison to utility class#949
SougandhS merged 1 commit into
eclipse-jdt:masterfrom
SougandhS:SingleTon

Conversation

@SougandhS
Copy link
Copy Markdown
Member

@SougandhS SougandhS commented Apr 27, 2026

What it does

Convert ObjectComparison to a static utility class by hiding the constructor and making all methods static.

How to test

Author checklist

@iloveeclipse
Copy link
Copy Markdown
Member

Why a singleton is needed at all? The object seems to be stateless, so actually it is a bunch of static helper methods?

@SougandhS
Copy link
Copy Markdown
Member Author

I noticed multiple instances being created during repeated operations in visualVM so tried a singleton to avoid that. However, as you pointed the class is stateless, I believe this optimization isn’t really necessary. Will close this PR then

@iloveeclipse
Copy link
Copy Markdown
Member

maybe it would be better to

  1. hide public constructor
  2. make all methods static
  3. "import static *" in the places where this code is used

This will prevent later confusion if someone would start adding state to this utility class...

@SougandhS
Copy link
Copy Markdown
Member Author

maybe it would be better to

  1. hide public constructor
  2. make all methods static
  3. "import static *" in the places where this code is used

This will prevent later confusion if someone would start adding state to this utility class...

Sure 👍

@SougandhS SougandhS changed the title Use Singleton for Compare Operations Refactor ObjectComparison to utility class Apr 27, 2026
@SougandhS
Copy link
Copy Markdown
Member Author

Will merge this soon 👍

Convert ObjectComparison to a static utility class by hiding the
constructor and making all methods static.
@SougandhS
Copy link
Copy Markdown
Member Author

I hope its good to be merged now

@SougandhS SougandhS merged commit a4583f0 into eclipse-jdt:master Apr 27, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants