Skip to content

Commit

Permalink
fixed error in compareTo function up on self invocation
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdjulian committed Jul 28, 2023
1 parent 2773178 commit 0e708ff
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ContainerImageName(
digest: Digest? = this.digest,
) = ContainerImageName(registry, repository, tag, digest)

override fun compareTo(other: ContainerImageName): Int = this.toString().compareTo(other.toString())
override fun compareTo(other: ContainerImageName): Int = toString().compareTo(other.toString())

override fun equals(other: Any?): Boolean = when {
this === other -> true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class Digest(@JsonValue private val value: String) : Reference, Comparable<Diges
override val separator: Char get() = Companion.separator

override fun compareTo(other: Digest): Int = value.compareTo(other.value)

override fun equals(other: Any?): Boolean = other is Digest && other.value == value
override fun hashCode(): Int = value.hashCode()
override fun toString(): String = value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Registry(@JsonValue private val value: String) : Comparable<Registry> {
require(value.matches(regex)) { "invalid registry" }
}

override fun compareTo(other: Registry): Int = value.compareTo(value)
override fun compareTo(other: Registry): Int = value.compareTo(other.value)
override fun equals(other: Any?): Boolean = other is Registry && other.value == value
override fun hashCode(): Int = value.hashCode()
override fun toString(): String = value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Repository(@JsonValue private val value: String) : Comparable<Repository>
is Digest -> ContainerImageName(repository = this, digest = reference)
}

override fun compareTo(other: Repository): Int = value.compareTo(value)
override fun compareTo(other: Repository): Int = value.compareTo(other.value)
override fun equals(other: Any?): Boolean = other is Repository && other.value == value
override fun hashCode(): Int = value.hashCode()
override fun toString(): String = value
Expand Down

0 comments on commit 0e708ff

Please sign in to comment.