diff options
author | Arnstein Ressem <aressem@gmail.com> | 2023-01-06 15:09:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-06 15:09:17 +0100 |
commit | 64e9d534287593e7be365973a5d1084298a65f3e (patch) | |
tree | 25a48348d6af7c15af7ceeefd5f2fb7f9cd07d12 /jdisc_core/src/main/java/com | |
parent | 55fb144ec32fdcdcf42535fcf27d404aece9594b (diff) |
Revert "Improve user friendliness when class resolution fails."
Diffstat (limited to 'jdisc_core/src/main/java/com')
-rw-r--r-- | jdisc_core/src/main/java/com/yahoo/jdisc/core/BsnVersion.java | 21 | ||||
-rw-r--r-- | jdisc_core/src/main/java/com/yahoo/jdisc/core/BundleCollisionHook.java | 27 |
2 files changed, 27 insertions, 21 deletions
diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/core/BsnVersion.java b/jdisc_core/src/main/java/com/yahoo/jdisc/core/BsnVersion.java deleted file mode 100644 index ee9ecc9fc3e..00000000000 --- a/jdisc_core/src/main/java/com/yahoo/jdisc/core/BsnVersion.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.yahoo.jdisc.core; - -import org.osgi.framework.Bundle; -import org.osgi.framework.Version; - -/** - * A bundle's symbolic name and version. - * - * @author gjoranv - */ -public record BsnVersion(String symbolicName, Version version) { - - public BsnVersion(Bundle bundle) { - this(bundle.getSymbolicName(), bundle.getVersion()); - } - - public String toReadableString() { - return symbolicName + " version:" + version; - } - -} diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/core/BundleCollisionHook.java b/jdisc_core/src/main/java/com/yahoo/jdisc/core/BundleCollisionHook.java index e78f3251890..3212bb4e6de 100644 --- a/jdisc_core/src/main/java/com/yahoo/jdisc/core/BundleCollisionHook.java +++ b/jdisc_core/src/main/java/com/yahoo/jdisc/core/BundleCollisionHook.java @@ -129,4 +129,31 @@ public class BundleCollisionHook implements CollisionHook, EventHook, FindHook { } } + + static class BsnVersion { + + private final String symbolicName; + private final Version version; + + BsnVersion(Bundle bundle) { + this.symbolicName = bundle.getSymbolicName(); + this.version = bundle.getVersion(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + BsnVersion that = (BsnVersion) o; + return Objects.equals(symbolicName, that.symbolicName) && + version.equals(that.version); + } + + @Override + public int hashCode() { + return Objects.hash(symbolicName, version); + } + + } + } |