diff --git a/build.sbt b/build.sbt index 849f3f46..325eb852 100644 --- a/build.sbt +++ b/build.sbt @@ -25,9 +25,9 @@ val scalacOpts = dotcOpts ++ List( // 57 inferred return type Scala 2.13 cat=scala3-migration "-Wconf:msg=inferred:ws", // 2 deprecations Scala 2.12 Stack - fixed for 2.13 - "-Wconf:msg=poorly-performing:ws" + "-Wconf:msg=poorly-performing:ws", // uncomment to see messages - // "-Wconf:any:warning-verbose" + "-Wconf:any:warning-verbose" ) Compile / console / scalacOptions --= Seq( diff --git a/sconfig/jvm/src/main/scala/org/ekrich/config/impl/ConfigBeanImpl.scala b/sconfig/jvm/src/main/scala/org/ekrich/config/impl/ConfigBeanImpl.scala index 58100483..920272eb 100644 --- a/sconfig/jvm/src/main/scala/org/ekrich/config/impl/ConfigBeanImpl.scala +++ b/sconfig/jvm/src/main/scala/org/ekrich/config/impl/ConfigBeanImpl.scala @@ -112,7 +112,7 @@ object ConfigBeanImpl { if (!problems.isEmpty) throw new ConfigException.ValidationFailed(problems) // Fill in the bean instance - val bean = clazz.getConstructor().newInstance() + val bean = clazz.getDeclaredConstructor().newInstance() for (beanProp <- beanProps.asScala) { breakable { val setter = beanProp.getWriteMethod @@ -137,11 +137,16 @@ object ConfigBeanImpl { } bean } catch { - case e: InstantiationException => + case e: NoSuchMethodException => throw new ConfigException.BadBean( clazz.getName + " needs a public no-args constructor to be used as a bean", e ) + case e: InstantiationException => + throw new ConfigException.BadBean( + clazz.getName + " needs to be instantiatable to be used as a bean", + e + ) case e: IllegalAccessException => throw new ConfigException.BadBean( clazz.getName + " getters and setters are not accessible, they must be for use as a bean", diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigFactory.scala b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigFactory.scala index 61061963..be0636ef 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigFactory.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigFactory.scala @@ -1049,14 +1049,27 @@ object ConfigFactory extends PlatformConfigFactory { if (className != null) { try { classOf[ConfigLoadingStrategy].cast( - Class.forName(className).getConstructor().newInstance() + Class + .forName(className) + .asSubclass(classOf[ConfigLoadingStrategy]) + .getDeclaredConstructor() + .newInstance() ) } catch { + // possibly InvocationTargetException case e: Throwable => - throw new ConfigException.BugOrBroken( - "Failed to load strategy: " + className, - e - ) + val cause = e.getCause() + if (cause == null) { + throw new ConfigException.BugOrBroken( + "Failed to load strategy: " + className, + e + ) + } else { + throw new ConfigException.BugOrBroken( + "Failed to load strategy: " + className, + cause + ) + } } } else { new DefaultConfigLoadingStrategy() diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/AbstractConfigObject.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/AbstractConfigObject.scala index 74c8e9b8..25a1dbf4 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/AbstractConfigObject.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/AbstractConfigObject.scala @@ -164,7 +164,7 @@ abstract class AbstractConfigObject(_origin: ConfigOrigin) override def constructDelayedMerge( origin: ConfigOrigin, stack: ju.List[AbstractConfigValue] - ) = + ): AbstractConfigObject = new ConfigDelayedMergeObject(origin, stack) override def mergedWithObject( diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigBoolean.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigBoolean.scala index 97fcf075..420fa7aa 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigBoolean.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigBoolean.scala @@ -19,7 +19,8 @@ final class ConfigBoolean(origin: ConfigOrigin, val value: jl.Boolean) override def transformToString: String = value.toString() - override def newCopy(origin: ConfigOrigin) = new ConfigBoolean(origin, value) + override def newCopy(origin: ConfigOrigin): AbstractConfigValue = + new ConfigBoolean(origin, value) // serialization all goes through SerializedConfigValue (signature is critical) @throws[ObjectStreamException] diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigConcatenation.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigConcatenation.scala index df428600..99c7cd9f 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigConcatenation.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigConcatenation.scala @@ -144,11 +144,11 @@ final class ConfigConcatenation( "need to Config#resolve(), see the API docs for Config#resolve(); substitution not resolved: " + this ) - override def valueType = throw notResolved + override def valueType: ConfigValueType = throw notResolved - override def unwrapped = throw notResolved + override def unwrapped: AnyRef = throw notResolved - override def newCopy(newOrigin: ConfigOrigin) = + override def newCopy(newOrigin: ConfigOrigin): AbstractConfigValue = new ConfigConcatenation(newOrigin, pieces) override def ignoresFallbacks: Boolean = { diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigDelayedMerge.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigDelayedMerge.scala index f967e56d..9fc5139e 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigDelayedMerge.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigDelayedMerge.scala @@ -10,6 +10,7 @@ import org.ekrich.config.ConfigException import org.ekrich.config.ConfigOrigin import org.ekrich.config.ConfigRenderOptions import org.ekrich.config.impl.AbstractConfigValue._ +import org.ekrich.config.ConfigValueType /** * The issue here is that we want to first merge our stack of config files, and @@ -227,12 +228,12 @@ final class ConfigDelayedMerge( ) } - override def valueType = + override def valueType: ConfigValueType = throw new ConfigException.NotResolved( "called valueType() on value with unresolved substitutions, need to Config#resolve() first, see API docs" ) - override def unwrapped = + override def unwrapped: AnyRef = throw new ConfigException.NotResolved( "called unwrapped() on value with unresolved substitutions, need to Config#resolve() first, see API docs" ) @@ -274,7 +275,7 @@ final class ConfigDelayedMerge( override def ignoresFallbacks: Boolean = ConfigDelayedMerge.stackIgnoresFallbacks(stack) - override def newCopy(newOrigin: ConfigOrigin) = + override def newCopy(newOrigin: ConfigOrigin): AbstractConfigValue = new ConfigDelayedMerge(newOrigin, stack) override final def mergedWithTheUnmergeable( diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigDelayedMergeObject.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigDelayedMergeObject.scala index b64997fa..a18abc18 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigDelayedMergeObject.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigDelayedMergeObject.scala @@ -114,19 +114,22 @@ final class ConfigDelayedMergeObject( mergeable: ConfigMergeable ): ConfigDelayedMergeObject = super.withFallback(mergeable).asInstanceOf[ConfigDelayedMergeObject] - override def withOnlyKey(key: String) = + override def withOnlyKey(key: String): AbstractConfigObject = throw ConfigDelayedMergeObject.notResolved - override def withoutKey(key: String) = + override def withoutKey(key: String): AbstractConfigObject = throw ConfigDelayedMergeObject.notResolved - override def withOnlyPathOrNull(path: Path) = + override def withOnlyPathOrNull(path: Path): AbstractConfigObject = throw ConfigDelayedMergeObject.notResolved - override def withOnlyPath(path: Path) = + override def withOnlyPath(path: Path): AbstractConfigObject = throw ConfigDelayedMergeObject.notResolved - override def withoutPath(path: Path) = + override def withoutPath(path: Path): AbstractConfigObject = throw ConfigDelayedMergeObject.notResolved - override def withValue(key: String, value: ConfigValue) = + override def withValue( + key: String, + value: ConfigValue + ): AbstractConfigObject = throw ConfigDelayedMergeObject.notResolved - override def withValue(path: Path, value: ConfigValue) = + override def withValue(path: Path, value: ConfigValue): AbstractConfigObject = throw ConfigDelayedMergeObject.notResolved override def unmergedValues: ju.Collection[AbstractConfigValue] = stack override def canEqual(other: Any): Boolean = @@ -158,18 +161,24 @@ final class ConfigDelayedMergeObject( ): Unit = { render(sb, indent, atRoot, null, options) } - override def unwrapped = throw ConfigDelayedMergeObject.notResolved - override def get(key: Any) = throw ConfigDelayedMergeObject.notResolved - override def remove(key: Any) = throw ConfigDelayedMergeObject.notResolved - override def containsKey(key: Any) = + override def unwrapped: ju.Map[String, AnyRef] = throw ConfigDelayedMergeObject.notResolved - override def containsValue(value: Any) = + override def get(key: Any): AbstractConfigValue = + throw ConfigDelayedMergeObject.notResolved + override def remove(key: Any): ConfigValue = + throw ConfigDelayedMergeObject.notResolved + override def containsKey(key: Any): Boolean = + throw ConfigDelayedMergeObject.notResolved + override def containsValue(value: Any): Boolean = + throw ConfigDelayedMergeObject.notResolved + override def entrySet: ju.Set[ju.Map.Entry[String, ConfigValue]] = + throw ConfigDelayedMergeObject.notResolved + override def isEmpty: Boolean = throw ConfigDelayedMergeObject.notResolved + override def keySet: ju.Set[String] = + throw ConfigDelayedMergeObject.notResolved + override def size: Int = throw ConfigDelayedMergeObject.notResolved + override def values: ju.Collection[ConfigValue] = throw ConfigDelayedMergeObject.notResolved - override def entrySet = throw ConfigDelayedMergeObject.notResolved - override def isEmpty = throw ConfigDelayedMergeObject.notResolved - override def keySet = throw ConfigDelayedMergeObject.notResolved - override def size = throw ConfigDelayedMergeObject.notResolved - override def values = throw ConfigDelayedMergeObject.notResolved // exercised in ValidationTest.validationFailedSerializable // and ConfigTest.test01Serializable diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigDouble.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigDouble.scala index 9905226e..521f1e4c 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigDouble.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigDouble.scala @@ -29,7 +29,7 @@ final class ConfigDouble( override def doubleValue: Double = value - override def newCopy(origin: ConfigOrigin) = + override def newCopy(origin: ConfigOrigin): AbstractConfigValue = new ConfigDouble(origin, value, originalText) // serialization all goes through SerializedConfigValue diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigInt.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigInt.scala index 0d45ab37..c325470b 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigInt.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigInt.scala @@ -29,7 +29,7 @@ final class ConfigInt( override def doubleValue: Double = value.toDouble - override def newCopy(origin: ConfigOrigin) = + override def newCopy(origin: ConfigOrigin): AbstractConfigValue = new ConfigInt(origin, value, originalText) // serialization all goes through SerializedConfigValue diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigLong.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigLong.scala index 8b9f4b5a..87339228 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigLong.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigLong.scala @@ -28,7 +28,7 @@ final class ConfigLong( override def doubleValue: Double = value.toDouble - override def newCopy(origin: ConfigOrigin) = + override def newCopy(origin: ConfigOrigin): AbstractConfigValue = new ConfigLong(origin, value, originalText) // serialization all goes through SerializedConfigValue diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeArray.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeArray.scala index 2d259a16..8ecc4cb2 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeArray.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeArray.scala @@ -5,6 +5,8 @@ import java.{util => ju} final class ConfigNodeArray private[impl] ( children: ju.Collection[AbstractConfigNode] ) extends ConfigNodeComplexValue(children) { - override def newNode(nodes: ju.Collection[AbstractConfigNode]) = + override def newNode( + nodes: ju.Collection[AbstractConfigNode] + ): ConfigNodeComplexValue = new ConfigNodeArray(nodes) } diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeConcatenation.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeConcatenation.scala index 0d4e11f7..55e6341c 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeConcatenation.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeConcatenation.scala @@ -5,6 +5,8 @@ import java.{util => ju} final class ConfigNodeConcatenation private[impl] ( children: ju.Collection[AbstractConfigNode] ) extends ConfigNodeComplexValue(children) { - override def newNode(nodes: ju.Collection[AbstractConfigNode]) = + override def newNode( + nodes: ju.Collection[AbstractConfigNode] + ): ConfigNodeComplexValue = new ConfigNodeConcatenation(nodes) } diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeObject.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeObject.scala index 1a57855c..34a11f26 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeObject.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeObject.scala @@ -8,7 +8,9 @@ import scala.util.control.Breaks._ final class ConfigNodeObject private[impl] ( _children: ju.Collection[AbstractConfigNode] ) extends ConfigNodeComplexValue(_children) { - override def newNode(nodes: ju.Collection[AbstractConfigNode]) = + override def newNode( + nodes: ju.Collection[AbstractConfigNode] + ): ConfigNodeComplexValue = new ConfigNodeObject(nodes) def hasValue(desiredPath: Path): Boolean = diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeRoot.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeRoot.scala index f27ad1af..c5934d71 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeRoot.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeRoot.scala @@ -10,7 +10,9 @@ final class ConfigNodeRoot private[impl] ( _children: ju.Collection[AbstractConfigNode], val origin: ConfigOrigin ) extends ConfigNodeComplexValue(_children) { - override def newNode(nodes: ju.Collection[AbstractConfigNode]) = + override def newNode( + nodes: ju.Collection[AbstractConfigNode] + ): ConfigNodeComplexValue = throw new ConfigException.BugOrBroken("Tried to indent the root object") private[impl] def value: ConfigNodeComplexValue = diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNull.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNull.scala index 4b2a90db..a725b2b7 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNull.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNull.scala @@ -36,7 +36,8 @@ final class ConfigNull(origin: ConfigOrigin) sb.append("null") } - override def newCopy(origin: ConfigOrigin) = new ConfigNull(origin) + override def newCopy(origin: ConfigOrigin): AbstractConfigValue = + new ConfigNull(origin) // serialization all goes through SerializedConfigValue @throws[ObjectStreamException] diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigReference.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigReference.scala index 406cc03c..f532e275 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigReference.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigReference.scala @@ -5,6 +5,7 @@ import java.{util => ju} import org.ekrich.config.ConfigException import org.ekrich.config.ConfigOrigin import org.ekrich.config.ConfigRenderOptions +import org.ekrich.config.ConfigValueType /** * ConfigReference replaces ConfigReference (the older class kept for back @@ -24,9 +25,9 @@ final class ConfigReference( new ConfigException.NotResolved( "need to Config#resolve(), see the API docs for Config#resolve(); substitution not resolved: " + this ) - override def valueType = throw notResolved - override def unwrapped = throw notResolved - override def newCopy(newOrigin: ConfigOrigin) = + override def valueType: ConfigValueType = throw notResolved + override def unwrapped: AnyRef = throw notResolved + override def newCopy(newOrigin: ConfigOrigin): AbstractConfigValue = new ConfigReference(newOrigin, expression, prefixLength) override def ignoresFallbacks = false override def unmergedValues: ju.Collection[ConfigReference] = diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigString.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigString.scala index 4f405e5d..a74b2ee2 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigString.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigString.scala @@ -16,7 +16,7 @@ object ConfigString { origin: ConfigOrigin, value: String ) extends ConfigString(origin, value) { - override def newCopy(origin: ConfigOrigin) = + override def newCopy(origin: ConfigOrigin): AbstractConfigValue = new ConfigString.Quoted(origin, value) // serialization all goes through SerializedConfigValue @@ -36,7 +36,7 @@ object ConfigString { origin: ConfigOrigin, value: String ) extends ConfigString(origin, value) { - override def newCopy(origin: ConfigOrigin) = + override def newCopy(origin: ConfigOrigin): AbstractConfigValue = new ConfigString.Unquoted(origin, value) @throws[ObjectStreamException] diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/Parseable.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/Parseable.scala index e3cfbdb7..4d35d540 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/Parseable.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/Parseable.scala @@ -113,7 +113,9 @@ object Parseable { ) extends Parseable(options) { postConstruct(options) @throws[IOException] - override protected def reader() = throw new FileNotFoundException(message) + override protected def reader(): Reader = throw new FileNotFoundException( + message + ) override protected def createOrigin(): ConfigOrigin = SimpleConfigOrigin.newSimple(what) } @@ -184,7 +186,7 @@ object Parseable { postConstruct(options) } @throws[IOException] - override protected def reader() = + override protected def reader(): Reader = throw new ConfigException.BugOrBroken( "reader() without options should not be called on ParseableURL" ) @@ -341,7 +343,7 @@ object Parseable { with Relativizer { postConstruct(options) @throws[IOException] - override protected def reader() = + override protected def reader(): Reader = throw new ConfigException.BugOrBroken( "reader() should not be called on resources" ) @@ -445,7 +447,7 @@ object Parseable { ) extends Parseable(options) { postConstruct(options) @throws[IOException] - override protected def reader() = + override protected def reader(): Reader = throw new ConfigException.BugOrBroken( "reader() should not be called on props" ) diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/SerializedConfigValue.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/SerializedConfigValue.scala index 36abbe4a..a23e047c 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/SerializedConfigValue.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/SerializedConfigValue.scala @@ -27,6 +27,7 @@ import org.ekrich.config.ConfigList import org.ekrich.config.ConfigObject import org.ekrich.config.ConfigOrigin import org.ekrich.config.ConfigValue +import org.ekrich.config.ConfigValueType /** * Deliberately shoving all the serialization code into this class instead of @@ -398,9 +399,10 @@ class SerializedConfigValue() // this has to be public for the Java deserializer in.readFully(bytes) new DataInputStream(new ByteArrayInputStream(bytes)) } - override def valueType = throw SerializedConfigValue.shouldNotBeUsed - override def unwrapped = throw SerializedConfigValue.shouldNotBeUsed - override def newCopy(origin: ConfigOrigin) = + override def valueType: ConfigValueType = + throw SerializedConfigValue.shouldNotBeUsed + override def unwrapped: AnyRef = throw SerializedConfigValue.shouldNotBeUsed + override def newCopy(origin: ConfigOrigin): AbstractConfigValue = throw SerializedConfigValue.shouldNotBeUsed override final def toString: String = getClass.getSimpleName + "(value=" + value + ",wasConfig=" + wasConfig + ")" diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleConfigDocument.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleConfigDocument.scala index 4a6577aa..421d1deb 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleConfigDocument.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleConfigDocument.scala @@ -38,7 +38,7 @@ final class SimpleConfigDocument private[impl] ( options = options.setOriginComments(false) withValueText(path, newValue.render(options).trim) } - override def withoutPath(path: String) = + override def withoutPath(path: String): ConfigDocument = new SimpleConfigDocument( configNodeTree.setValue(path, null, parseOptions.getSyntax), parseOptions diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleConfigList.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleConfigList.scala index a8b11faa..d39c5d5c 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleConfigList.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleConfigList.scala @@ -269,28 +269,29 @@ final class SimpleConfigList( override def toArray: Array[Object] = value.toArray override def toArray[T](a: Array[T with Object]): Array[T with Object] = value.toArray[T](a) - override def add(e: ConfigValue) = + override def add(e: ConfigValue): Boolean = throw SimpleConfigList.weAreImmutable("add") override def add(index: Int, element: ConfigValue): Unit = { throw SimpleConfigList.weAreImmutable("add") } - override def addAll(c: ju.Collection[_ <: ConfigValue]) = + override def addAll(c: ju.Collection[_ <: ConfigValue]): Boolean = throw SimpleConfigList.weAreImmutable("addAll") - override def addAll(index: Int, c: ju.Collection[_ <: ConfigValue]) = + override def addAll(index: Int, c: ju.Collection[_ <: ConfigValue]): Boolean = throw SimpleConfigList.weAreImmutable("addAll") override def clear(): Unit = { throw SimpleConfigList.weAreImmutable("clear") } - override def remove(o: Any) = throw SimpleConfigList.weAreImmutable("remove") - override def remove(index: Int) = + override def remove(o: Any): Boolean = throw SimpleConfigList.weAreImmutable("remove") - override def removeAll(c: ju.Collection[_]) = + override def remove(index: Int): ConfigValue = + throw SimpleConfigList.weAreImmutable("remove") + override def removeAll(c: ju.Collection[_]): Boolean = throw SimpleConfigList.weAreImmutable("removeAll") - override def retainAll(c: ju.Collection[_]) = + override def retainAll(c: ju.Collection[_]): Boolean = throw SimpleConfigList.weAreImmutable("retainAll") - override def set(index: Int, element: ConfigValue) = + override def set(index: Int, element: ConfigValue): ConfigValue = throw SimpleConfigList.weAreImmutable("set") - override def newCopy(newOrigin: ConfigOrigin) = + override def newCopy(newOrigin: ConfigOrigin): AbstractConfigValue = new SimpleConfigList(newOrigin, value) final private[impl] def concatenate(other: SimpleConfigList) = { val combinedOrigin = SimpleConfigOrigin.mergeOrigins(origin, other.origin) diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleConfigObject.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleConfigObject.scala index 18c0750f..f4536b5b 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleConfigObject.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleConfigObject.scala @@ -593,7 +593,8 @@ final class SimpleConfigObject( override def size: Int = value.size - override def values = new ju.HashSet[ConfigValue](value.values) + override def values: ju.Collection[ConfigValue] = + new ju.HashSet[ConfigValue](value.values) // serialization all goes through SerializedConfigValue @throws[ObjectStreamException] diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleIncludeContext.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleIncludeContext.scala index 12adbd66..423363e1 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleIncludeContext.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleIncludeContext.scala @@ -26,7 +26,9 @@ class SimpleIncludeContext(parseable: Parseable, options: ConfigParseOptions) override def parseOptions: ConfigParseOptions = options - override def setParseOptions(options: ConfigParseOptions) = + override def setParseOptions( + options: ConfigParseOptions + ): ConfigIncludeContext = new SimpleIncludeContext( parseable, options.setSyntax(null).setOriginDescription(null)