aboutsummaryrefslogtreecommitdiffstats
path: root/config-lib/src
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-10-27 00:21:57 +0200
committerJon Bratseth <bratseth@gmail.com>2022-10-27 00:21:57 +0200
commit4ad1d0ca013b925858597c559ab4efb02c30dd4a (patch)
treedcb83bab5359f7f508e9ecb9a919e831046ccdff /config-lib/src
parent0d4c548f548ee7fd904eb5cabc4c0a68cbad85ec (diff)
Use IllegalArgumentException when appropriate
Diffstat (limited to 'config-lib/src')
-rw-r--r--config-lib/src/main/java/com/yahoo/config/ConfigurationRuntimeException.java2
-rw-r--r--config-lib/src/main/java/com/yahoo/config/LeafNode.java11
2 files changed, 6 insertions, 7 deletions
diff --git a/config-lib/src/main/java/com/yahoo/config/ConfigurationRuntimeException.java b/config-lib/src/main/java/com/yahoo/config/ConfigurationRuntimeException.java
index cd5576db9f0..ed757c6dea9 100644
--- a/config-lib/src/main/java/com/yahoo/config/ConfigurationRuntimeException.java
+++ b/config-lib/src/main/java/com/yahoo/config/ConfigurationRuntimeException.java
@@ -4,8 +4,8 @@ package com.yahoo.config;
/**
* This exception is thrown on internal errors in the configuration system.
*/
-@SuppressWarnings("serial")
public class ConfigurationRuntimeException extends RuntimeException {
+
public ConfigurationRuntimeException(String message) {
super(message);
}
diff --git a/config-lib/src/main/java/com/yahoo/config/LeafNode.java b/config-lib/src/main/java/com/yahoo/config/LeafNode.java
index 8aa97cef4ee..0463631e4f6 100644
--- a/config-lib/src/main/java/com/yahoo/config/LeafNode.java
+++ b/config-lib/src/main/java/com/yahoo/config/LeafNode.java
@@ -4,7 +4,7 @@ package com.yahoo.config;
/**
* Superclass for all leaf nodes in a {@link ConfigInstance}.
* <p>
- * Subclasses represents leaf nodes with different types. These
+ * Subclasses represent leaf nodes with different types. These
* implementations should implement method value() with return-value
* corresponding to the actual type.
*
@@ -73,9 +73,9 @@ public abstract class LeafNode<T> extends Node implements Cloneable {
* @return a new instance similar to this object.
*/
@Override
- protected Object clone() {
+ protected LeafNode<?> clone() {
try {
- return super.clone();
+ return (LeafNode<?>) super.clone();
} catch (CloneNotSupportedException e) {
throw new ConfigurationRuntimeException(e);
}
@@ -83,10 +83,8 @@ public abstract class LeafNode<T> extends Node implements Cloneable {
@Override
public boolean equals(Object o) {
- if (! (o instanceof LeafNode))
- return false;
+ if (! (o instanceof LeafNode<?> other)) return false;
- LeafNode<?> other = (LeafNode)o;
return value == null ? other.value == null : value().equals(other.value);
}
@@ -102,4 +100,5 @@ public abstract class LeafNode<T> extends Node implements Cloneable {
void serialize(Serializer serializer) {
serializer.serialize(getValue());
}
+
}