GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [MGPG-80] implement GpgVersion equality in adherence to comparibility by Syquel · Pull Request #12 · apache/maven-gpg-plugin

Conversation

@Syquel

@Syquel Syquel commented Feb 26, 2021

Copy link
Copy Markdown
Contributor

Provides an implementation of GpgVersion#equals andGpgVersion#hashCode to address MGPG-80.
"GpgVersion#equals" is implemented by utilizing "GpgVersion#compareTo".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Syquel Syquel mentioned this pull request Feb 26, 2021
[MGPG-81] check format in constructor #11
Merged
elharo
elharo reviewed Feb 26, 2021
View reviewed changes
Comment thread src/test/java/org/apache/maven/plugins/gpg/GpgVersionTest.java
assertEquals( GpgVersion.parse( "gpg (GnuPG/MacGPG2) 2.2.10" ).hashCode(), GpgVersion.parse( "2.2.10" ).hashCode() );
assertEquals( GpgVersion.parse( "gpg (GnuPG) 2.0.26 (Gpg4win 2.2.3)" ).hashCode(), GpgVersion.parse( "2.0.26" ).hashCode() );

assertNotEquals( GpgVersion.parse( "gpg (GnuPG) 2.2.1" ), GpgVersion.parse( "2.2.0" ) );

@elharo elharo Feb 26, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also test that hashcodes are not equal here?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Syquel Syquel Feb 26, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While objects which are equal must produce the same hash code it is neither required nor expected that unequal objects always produce different hash codes.
Arrays.hashCode should already provide a reasonable implementation to minimize hash collisions.

Object#hashCode JavaDoc:

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.
The general contract of hashCode is:
[ ... ]

  • If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@elharo elharo Feb 26, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is indeed expected to a very high degree of probability, specifically one in 4.2 billion. It is also expected that hashcodes are deterministic and not random so if this case is not equal now it should not be equal on the next run. Finally it's expected that a good hash algorithm move nearby values far apart so this one should definitely be different.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Syquel Syquel Feb 26, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added test statements to assert that the hash codes are different.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Syquel
[MGPG-80] implement GpgVersion equality in adherence to comparibility
7438b37
elharo
elharo approved these changes Feb 26, 2021
View reviewed changes
@elharo

elharo commented Mar 1, 2021

Copy link
Copy Markdown
Contributor

running through jenkins: https://ci-builds.apache.org/job/Maven/job/maven-box/job/maven-gpg-plugin/job/MGPG-80/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@elharo

elharo commented Mar 1, 2021

Copy link
Copy Markdown
Contributor

and it passed, will merge

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@elharo
elharo merged commit 4016721 into apache:master Mar 1, 2021
This was referenced May 10, 2021
Bump maven-gpg-plugin from 1.6 to 3.0.1 liquibase/liquibase-snowflake#77
Closed
Bump maven-gpg-plugin from 1.6 to 3.0.1 liquibase/liquibase-cassandra#78
Merged
Bump maven-gpg-plugin from 1.6 to 3.0.1 liquibase/liquibase-hibernate#318
Merged
Bump maven-gpg-plugin from 1.6 to 3.0.1 liquibase/liquibase-redshift#50
Merged
Bump maven-gpg-plugin from 1.6 to 3.0.1 liquibase/liquibase-maxdb#37
Merged
Bump maven-gpg-plugin from 1.6 to 3.0.1 liquibase/liquibase-teradata#46
Merged
Bump maven-gpg-plugin from 1.6 to 3.0.1 liquibase/liquibase-hanadb#64
Merged
Bump maven-gpg-plugin from 1.6 to 3.0.1 liquibase/liquibase-cache#28
Merged
Bump maven-gpg-plugin from 1.6 to 3.0.1 liquibase/liquibase-sqlfire#30
Merged
Bump maven-gpg-plugin from 1.6 to 3.0.1 liquibase/liquibase-db2i#38
Merged
Bump maven-gpg-plugin from 1.6 to 3.0.1 liquibase/liquibase-oracle#71
Merged
Bump maven-gpg-plugin from 1.6 to 3.0.1 liquibase/liquibase-mongodb#132
Merged
Bump maven-gpg-plugin from 1.6 to 3.0.1 liquibase/liquibase-postgresql#56
Merged
Bump maven-gpg-plugin from 1.6 to 3.0.1 liquibase/liquibase-mssql#32
Merged
Bump maven-gpg-plugin from 1.6 to 3.0.1 liquibase/liquibase-vertica#51
Merged
Bump maven-gpg-plugin from 1.6 to 3.0.1 liquibase/liquibase-db2i#43
Merged
Bump maven-gpg-plugin from 1.6 to 3.0.1 liquibase/liquibase-mssql#39
Merged
Bump maven-gpg-plugin from 1.6 to 3.0.1 liquibase/liquibase-oracle#76
Merged
Bump maven-gpg-plugin from 1.6 to 3.0.1 liquibase/liquibase-sqlfire#36
Merged
Bump maven-gpg-plugin from 1.6 to 3.0.1 liquibase/liquibase-teradata#52
Merged
Bump maven-gpg-plugin from 1.6 to 3.0.1 liquibase/liquibase-vertica#61
Merged
@sync-by-unito sync-by-unito Bot mentioned this pull request May 17, 2021
Bump maven-gpg-plugin from 1.6 to 3.0.1 liquibase/liquibase-mongodb#141
Merged
@jira-importer

jira-importer commented Jun 14, 2025

Copy link
Copy Markdown

Resolve #219

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jira-importer

jira-importer commented Jun 14, 2025

Copy link
Copy Markdown

Resolve #219

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@elharo elharo elharo approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@Syquel @elharo @jira-importer
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.