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

Use standard Objects class instead of Guava #1261

Merged
merged 1 commit into from
Nov 17, 2021

Conversation

Emkas
Copy link
Contributor

@Emkas Emkas commented Nov 10, 2021

Minimal Java version for the project seems to be 8 (source\targetCompatibility = JavaVersion.VERSION_1_8). There's no need to use Guava for equals and hashCode methods. I've changed com.google.common.base.Objects to java.util.Objects and this reduced number of imports from Guava by half.

@Emkas
Copy link
Contributor Author

Emkas commented Nov 10, 2021

All equals and hashcode looks automatically generated... So I'd be nice to ensure com.google.common.base.Objects woudn't be use in future, but I don't know how to achieve (I don't think that in Spotless we can achieve that). Assuming my pull request will be approved, of course :-)

@balamurugana
Copy link
Member

Even though, it is not possible to completely get rid of Guava, the PR looks good to me. Methods hashCode() and equals() were actually written manually. This means it is possible to use import com.google.common.base.Objects; in future. Can you add a check in Github Workflow if com.google.common.base.Objects is used?

@Emkas
Copy link
Contributor Author

Emkas commented Nov 10, 2021

Can you add a check in Github Workflow if com.google.common.base.Objects is used

I have zero idea what Github Workflow is (yet :-)), but I'll try.

@balamurugana
Copy link
Member

Can you add a check in Github Workflow if com.google.common.base.Objects is used

I have zero idea what Github Workflow is (yet :-)), but I'll try.

Just add grep check here https://github.com/minio/minio-java/blob/master/.github/workflows/gradle.yml#L23

@Emkas Emkas force-pushed the remove-guava-objects-usage branch 2 times, most recently from bb93674 to 0e162c6 Compare November 10, 2021 15:22
@Emkas
Copy link
Contributor Author

Emkas commented Nov 10, 2021

@balamurugana Tell me if this is what you wanted. I had to 'negate' grep returning code, so I've made simple if based on https://github.com/actions/checkout/blob/main/.github/workflows/check-dist.yml#L40

Edit: OK, I forgot about ! operator. Now this is a one-liner.

@harshavardhana
Copy link
Member

Minimal Java version for the project seems to be 8 (source\targetCompatibility = JavaVersion.VERSION_1_8). There's no need to use Guava for equals and hashCode methods. I've changed com.google.common.base.Objects to java.util.Objects and this reduced number of imports from Guava by half.

Does this reduce the SDK size in some way?

@Emkas
Copy link
Contributor Author

Emkas commented Nov 17, 2021

Does this reduce the SDK size in some way?

Guava is still in use, so not really.

.github/workflows/gradle.yml Outdated Show resolved Hide resolved
@Emkas Emkas force-pushed the remove-guava-objects-usage branch 3 times, most recently from b2a011c to ae9c6ea Compare November 17, 2021 13:03
@harshavardhana harshavardhana merged commit 23abd38 into minio:master Nov 17, 2021
@Emkas Emkas deleted the remove-guava-objects-usage branch November 23, 2021 17:37
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.

3 participants