From 6629bbcf93b64dbf8b456fa9365ea2590b6e3fc2 Mon Sep 17 00:00:00 2001 From: Eric K Richardson Date: Mon, 24 Jan 2022 08:42:18 -0800 Subject: [PATCH] Update Scalafmt to the latest version to enable Scala 3 formatting (#230) * Updates for scalafmt to support Scala 3 * Try and use snapshot * Remove extra parens * Latest scalafmt version * Update param T to be more Scala like * Use the correct snapshot version * Add link scripts and update to scalafmt 3.3.2 * Update format * Create deliberate wraps for better formatting * Format rebase code --- .github/workflows/check-link.yml | 11 + .github/workflows/ci.yml | 2 +- .gitignore | 4 + .scalafmt.conf | 35 +- build.sbt | 18 +- .../src/main/scala/simplelib/SimpleLib.scala | 4 +- project/plugins.sbt | 12 +- .../sconfig/fix/ReplaceTypesafeConfig.scala | 40 +- .../org/ekrich/sconfig/fix/package.scala | 38 +- .../org/ekrich/config/ConfigBeanFactory.scala | 39 +- .../ekrich/config/impl/ConfigBeanImpl.scala | 85 +- sconfig/jvm/src/test/scala/ApiExamples.scala | 12 +- .../ekrich/config/impl/ConfParserTest.scala | 34 +- .../config/impl/ConfigBeanFactoryTest.scala | 2 +- .../config/impl/ConfigDocumentTest.scala | 57 +- .../config/impl/ConfigSubstitutionTest.scala | 98 +- .../org/ekrich/config/impl/ConfigTest.scala | 76 +- .../ekrich/config/impl/ConfigValueTest.scala | 163 +-- .../ekrich/config/impl/EquivalentsTest.scala | 6 +- .../org/ekrich/config/impl/FileUtils.scala | 10 +- .../org/ekrich/config/impl/HttpTest.scala | 22 +- .../org/ekrich/config/impl/JsonTest.scala | 2 +- .../ekrich/config/impl/PublicApiTest.scala | 325 ++--- .../org/ekrich/config/impl/ToyHttp.scala | 20 +- .../ekrich/config/impl/ValidationTest.scala | 16 +- .../org/ekrich/config/ConfigSyntax.scala | 21 +- .../org/ekrich/config/ConfigValueType.scala | 16 +- .../config/impl/ConfigIncludeKind.scala | 4 +- .../org/ekrich/config/impl/FromMapMode.scala | 4 +- .../org/ekrich/config/impl/MemoryUnit.scala | 26 +- .../org/ekrich/config/impl/OriginType.scala | 6 +- .../ekrich/config/impl/ResolveStatus.scala | 2 +- .../ekrich/config/impl/SerializedField.scala | 8 +- .../config/impl/SerializedValueType.scala | 2 +- .../org/ekrich/config/impl/TokenType.scala | 32 +- .../org/ekrich/config/ConfigSyntax.scala | 22 +- .../org/ekrich/config/ConfigValueType.scala | 6 +- .../org/ekrich/config/impl/FromMapMode.scala | 1 - .../org/ekrich/config/impl/MemoryUnit.scala | 28 +- .../ekrich/config/impl/ResolveStatus.scala | 3 +- .../ekrich/config/impl/SerializedField.scala | 10 +- .../config/impl/SerializedValueType.scala | 30 +- .../org/ekrich/config/impl/TokenType.scala | 6 +- .../main/scala/org/ekrich/config/Config.scala | 1058 ++++++++--------- .../org/ekrich/config/ConfigException.scala | 49 +- .../org/ekrich/config/ConfigFactory.scala | 773 ++++++------ .../ekrich/config/ConfigIncludeContext.scala | 44 +- .../org/ekrich/config/ConfigIncluder.scala | 46 +- .../config/ConfigIncluderClasspath.scala | 15 +- .../ekrich/config/ConfigIncluderFile.scala | 15 +- .../org/ekrich/config/ConfigIncluderURL.scala | 15 +- .../scala/org/ekrich/config/ConfigList.scala | 38 +- .../ekrich/config/ConfigLoadingStrategy.scala | 16 +- .../org/ekrich/config/ConfigMemorySize.scala | 21 +- .../org/ekrich/config/ConfigMergeable.scala | 54 +- .../org/ekrich/config/ConfigObject.scala | 105 +- .../org/ekrich/config/ConfigOrigin.scala | 76 +- .../ekrich/config/ConfigOriginFactory.scala | 29 +- .../ekrich/config/ConfigParseOptions.scala | 106 +- .../org/ekrich/config/ConfigParseable.scala | 32 +- .../ekrich/config/ConfigRenderOptions.scala | 90 +- .../ekrich/config/ConfigResolveOptions.scala | 95 +- .../org/ekrich/config/ConfigResolver.scala | 39 +- .../scala/org/ekrich/config/ConfigUtil.scala | 59 +- .../scala/org/ekrich/config/ConfigValue.scala | 103 +- .../ekrich/config/ConfigValueFactory.scala | 130 +- .../config/DefaultConfigLoadingStrategy.scala | 6 +- .../config/impl/AbstractConfigNode.scala | 2 +- .../config/impl/AbstractConfigNodeValue.scala | 2 +- .../config/impl/AbstractConfigObject.scala | 25 +- .../config/impl/AbstractConfigValue.scala | 31 +- .../scala/org/ekrich/config/impl/BadMap.scala | 43 +- .../ekrich/config/impl/ConfigBoolean.scala | 2 +- .../config/impl/ConfigConcatenation.scala | 28 +- .../config/impl/ConfigDelayedMerge.scala | 8 +- .../impl/ConfigDelayedMergeObject.scala | 14 +- .../config/impl/ConfigDocumentParser.scala | 91 +- .../org/ekrich/config/impl/ConfigDouble.scala | 2 +- .../org/ekrich/config/impl/ConfigImpl.scala | 16 +- .../ekrich/config/impl/ConfigImplUtil.scala | 27 +- .../org/ekrich/config/impl/ConfigInt.scala | 2 +- .../org/ekrich/config/impl/ConfigLong.scala | 2 +- .../config/impl/ConfigNodeComplexValue.scala | 2 +- .../ekrich/config/impl/ConfigNodeField.scala | 2 +- .../ekrich/config/impl/ConfigNodeObject.scala | 34 +- .../ekrich/config/impl/ConfigNodePath.scala | 10 +- .../ekrich/config/impl/ConfigNodeRoot.scala | 4 +- .../config/impl/ConfigNodeSimpleValue.scala | 2 +- .../config/impl/ConfigNodeSingleToken.scala | 2 +- .../org/ekrich/config/impl/ConfigNull.scala | 3 +- .../org/ekrich/config/impl/ConfigNumber.scala | 9 +- .../org/ekrich/config/impl/ConfigParser.scala | 50 +- .../ekrich/config/impl/ConfigReference.scala | 2 +- .../org/ekrich/config/impl/ConfigString.scala | 2 +- .../org/ekrich/config/impl/Container.scala | 6 +- .../config/impl/DefaultTransformer.scala | 6 +- .../org/ekrich/config/impl/FullIncluder.scala | 2 +- .../org/ekrich/config/impl/MemoKey.scala | 7 +- .../org/ekrich/config/impl/Parseable.scala | 41 +- .../scala/org/ekrich/config/impl/Path.scala | 36 +- .../org/ekrich/config/impl/PathBuilder.scala | 4 +- .../org/ekrich/config/impl/PathParser.scala | 8 +- .../ekrich/config/impl/PropertiesParser.scala | 14 +- .../ekrich/config/impl/ResolveContext.scala | 6 +- .../org/ekrich/config/impl/ResolveMemos.scala | 3 +- .../ekrich/config/impl/ResolveSource.scala | 10 +- .../config/impl/SerializedConfigValue.scala | 20 +- .../org/ekrich/config/impl/SimpleConfig.scala | 113 +- .../config/impl/SimpleConfigDocument.scala | 7 +- .../ekrich/config/impl/SimpleConfigList.scala | 46 +- .../config/impl/SimpleConfigObject.scala | 34 +- .../config/impl/SimpleConfigOrigin.scala | 21 +- .../config/impl/SimpleIncludeContext.scala | 2 +- .../ekrich/config/impl/SimpleIncluder.scala | 6 +- .../scala/org/ekrich/config/impl/Token.scala | 2 +- .../org/ekrich/config/impl/Tokenizer.scala | 48 +- .../scala/org/ekrich/config/impl/Tokens.scala | 8 +- .../org/ekrich/config/impl/Unmergeable.scala | 6 +- .../ekrich/config/parser/ConfigDocument.scala | 103 +- .../config/parser/ConfigDocumentFactory.scala | 58 +- .../org/ekrich/config/parser/ConfigNode.scala | 23 +- .../src/test/scala/junit/Profiling.scala | 2 +- .../src/test/scala/junit/Rendering.scala | 12 +- .../org/ekrich/config/impl/BadMapTest.scala | 8 +- .../config/impl/ConcatenationTest.scala | 2 +- .../impl/ConfigDocumentParserTest.scala | 2 +- .../config/impl/ConfigMemorySizeTest.scala | 2 +- .../ekrich/config/impl/ConfigNodeTest.scala | 26 +- .../org/ekrich/config/impl/PathTest.scala | 4 +- .../ekrich/config/impl/PropertiesTest.scala | 8 +- .../org/ekrich/config/impl/TestUtils.scala | 292 ++--- .../org/ekrich/config/impl/TokenTest.scala | 2 +- .../ekrich/config/impl/TokenizerTest.scala | 52 +- .../ekrich/config/impl/UnitParserTest.scala | 6 +- .../org/ekrich/config/impl/UtilTest.scala | 14 +- scripts/.coursier | Bin 17633 -> 0 bytes scripts/.scalafmt-2.3.2 | Bin 18060 -> 0 bytes scripts/.scalafmt-2.4.1 | Bin 18136 -> 0 bytes scripts/check-lint.sh | 5 + scripts/scalafmt | 4 +- 140 files changed, 3009 insertions(+), 2861 deletions(-) create mode 100644 .github/workflows/check-link.yml delete mode 100755 scripts/.coursier delete mode 100755 scripts/.scalafmt-2.3.2 delete mode 100755 scripts/.scalafmt-2.4.1 create mode 100755 scripts/check-lint.sh diff --git a/.github/workflows/check-link.yml b/.github/workflows/check-link.yml new file mode 100644 index 00000000..72195e01 --- /dev/null +++ b/.github/workflows/check-link.yml @@ -0,0 +1,11 @@ +name: Check Lint +on: + push: + branches: [ main ] + pull_request: +jobs: + check-lint: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - run: ./scripts/check-lint.sh \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d69986c7..3308b2ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,7 @@ name: CI on: push: - branches: [ main ] + branches: [ main ] pull_request: jobs: build: diff --git a/.gitignore b/.gitignore index a5953459..6745c24c 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,7 @@ target/ # vscode /.vscode/ + +# scripts generated +/scripts/.coursier +/scripts/.scalafmt* diff --git a/.scalafmt.conf b/.scalafmt.conf index 6e27642f..91c0fb67 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,15 +1,24 @@ -version = 2.4.2 -style = defaultWithAlign -docstrings = JavaDoc +# Test upgrades: $ scripts/scalafmt --test 2> diff.txt +version = 3.3.2 +runner.dialect = scala213source3 +preset = default + +# JavaDoc style (ported from Java) +docstrings.style = Asterisk assumeStandardLibraryStripMargin = true project.git = true -# changed 1.6 or after -align.openParenCallSite = true -align.openParenDefnSite = true -# avoid wrapping parens on new line -danglingParentheses.defnSite = false -danglingParentheses.callSite = false -# manually exclude files to format. -project.excludeFilters = [ - sharedScala3 -] + +# This creates less of a diff but is not default +# but is more aligned with Scala.js syntax. +newlines.beforeCurlyLambdaParams = multilineWithCaseOnly + +# Keep control sites more streamlined +indent.ctrlSite = 4 +danglingParentheses.ctrlSite = false + +# allow dialect for Scala 3 +fileOverride { + "glob:**/scala-3/**.scala" { + runner.dialect = scala3 + } +} diff --git a/build.sbt b/build.sbt index 9beaa387..803c1818 100644 --- a/build.sbt +++ b/build.sbt @@ -20,9 +20,9 @@ def versionFmt(out: sbtdynver.GitDescribeOutput): String = { val dotcOpts = List("-unchecked", "-deprecation", "-feature") val scalacOpts = dotcOpts ++ List( - //"-Ywarn-unused:imports", // no 2.11 - maybe time for sbt-tpolecat + // "-Ywarn-unused:imports", // no 2.11 - maybe time for sbt-tpolecat "-Xsource:3" - //"-Xlint:nonlocal-return" // no 2.11/2.12 + // "-Xlint:nonlocal-return" // no 2.11/2.12 ) Compile / console / scalacOptions --= Seq( @@ -46,9 +46,9 @@ val scala300 = "3.1.0" val javaTime = "1.1.8" val scCompat = "2.6.0" -val versionsBase = Seq(scala211, scala212, scala213) -val versionsJVM = versionsBase :+ scala300 -val versionsJS = versionsJVM +val versionsBase = Seq(scala211, scala212, scala213) +val versionsJVM = versionsBase :+ scala300 +val versionsJS = versionsJVM val versionsNative = versionsJVM ThisBuild / scalaVersion := scala212 @@ -156,12 +156,12 @@ lazy val sconfig = crossProject(JVMPlatform, NativePlatform, JSPlatform) Test / run / fork := true, // env vars for tests Test / envVars ++= Map( - "testList.0" -> "0", - "testList.1" -> "1", + "testList.0" -> "0", + "testList.1" -> "1", "testClassesPath" -> (Test / classDirectory).value.getPath ), // uncomment for debugging - //Test / javaOptions += "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005", + // Test / javaOptions += "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005", // mima settings mimaPreviousArtifacts := Set("org.ekrich" %% "sconfig" % prevVersion), mimaBinaryIssueFilters ++= ignoredABIProblems @@ -236,7 +236,7 @@ lazy val sharedJvmNativeSource: Seq[Setting[_]] = Def.settings( lazy val sconfigJVM = sconfig.jvm .dependsOn(testLibJVM % "test->test") lazy val sconfigNative = sconfig.native -lazy val sconfigJS = sconfig.js +lazy val sconfigJS = sconfig.js lazy val ignoredABIProblems = { import com.typesafe.tools.mima.core._ diff --git a/examples/scala/simple-lib/src/main/scala/simplelib/SimpleLib.scala b/examples/scala/simple-lib/src/main/scala/simplelib/SimpleLib.scala index 8ec6d782..7cd2fbe9 100644 --- a/examples/scala/simple-lib/src/main/scala/simplelib/SimpleLib.scala +++ b/examples/scala/simple-lib/src/main/scala/simplelib/SimpleLib.scala @@ -38,8 +38,8 @@ class SimpleLibSettings(config: Config) { // note that these fields are NOT lazy, because if we're going to // get any exceptions, we want to get them on startup. - val foo = config.getString("simple-lib.foo") - val hello = config.getString("simple-lib.hello") + val foo = config.getString("simple-lib.foo") + val hello = config.getString("simple-lib.hello") val whatever = config.getString("simple-lib.whatever") } diff --git a/project/plugins.sbt b/project/plugins.sbt index bbabd9da..7cc26b82 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,20 +2,20 @@ resolvers += Resolver.sonatypeRepo("snapshots") // versions -val crossVer = "1.1.0" -val scalaJSVersion = "1.8.0" +val crossVer = "1.1.0" +val scalaJSVersion = "1.8.0" val scalaNativeVersion = "0.4.3" // includes sbt-dynver sbt-pgp sbt-sonatype sbt-git -addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10") -addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.0.1") +addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10") +addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.0.1") // Scala Native support addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % crossVer) -addSbtPlugin("org.scala-native" % "sbt-scala-native" % scalaNativeVersion) +addSbtPlugin("org.scala-native" % "sbt-scala-native" % scalaNativeVersion) // Scala.js support addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % crossVer) -addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) +addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.34") diff --git a/scalafix/rules/src/main/scala/org/ekrich/sconfig/fix/ReplaceTypesafeConfig.scala b/scalafix/rules/src/main/scala/org/ekrich/sconfig/fix/ReplaceTypesafeConfig.scala index fbb6d16a..68121273 100644 --- a/scalafix/rules/src/main/scala/org/ekrich/sconfig/fix/ReplaceTypesafeConfig.scala +++ b/scalafix/rules/src/main/scala/org/ekrich/sconfig/fix/ReplaceTypesafeConfig.scala @@ -97,7 +97,8 @@ private object ConfigParseOptionsEmptyParenFunCall "getClassLoader", "getIncluder", "getOriginDescription", - "getSyntax") + "getSyntax" + ) private object ConfigRenderOptionsEmptyParenFunCall extends AbstractEmptyParenFunCall( @@ -107,7 +108,8 @@ private object ConfigRenderOptionsEmptyParenFunCall "getComments", "getFormatted", "getJson", - "getOriginComments") + "getOriginComments" + ) private object ConfigResolveOptionsEmptyParenFunCall extends AbstractEmptyParenFunCall( @@ -116,31 +118,38 @@ private object ConfigResolveOptionsEmptyParenFunCall "getAllowUnresolved", "getResolver", "getUseSystemEnvironment", - "noSystem") + "noSystem" + ) private object ConfigDocumentEmptyParenFunCall extends AbstractEmptyParenFunCall( Symbol("com/typesafe/config/parser/ConfigDocument#"), - "render") + "render" + ) private object ConfigNodeEmptyParenFunCall extends AbstractEmptyParenFunCall( Symbol("com/typesafe/config/parser/ConfigNode#"), - "render") + "render" + ) private abstract class AbstractEmptyParenFunCall( typesafeConfigSymbol: Symbol, atLeastOneMethodName: String, - emptyParenMethodNames: String*) { + emptyParenMethodNames: String* +) { def unapply(tree: Tree)(implicit doc: SemanticDocument): Option[Term] = - EmptyParenFunCallsOnSymbol(typesafeConfigSymbol, - atLeastOneMethodName +: emptyParenMethodNames, - tree) + EmptyParenFunCallsOnSymbol( + typesafeConfigSymbol, + atLeastOneMethodName +: emptyParenMethodNames, + tree + ) } private object EmptyParenFunCallsOnSymbol { - def apply(symbol: Symbol, methodNames: Seq[String], tree: Tree)( - implicit doc: SemanticDocument): Option[Term] = { + def apply(symbol: Symbol, methodNames: Seq[String], tree: Tree)(implicit + doc: SemanticDocument + ): Option[Term] = { object SelectSymbolEmptyParenMethod { def unapply(subtree: Tree)(implicit doc: SemanticDocument): Option[Term] = @@ -156,12 +165,15 @@ private object EmptyParenFunCallsOnSymbol { } object SymbolEmptyParenMethod { - def unapply(term: Term.Name)( - implicit doc: SemanticDocument): Option[MethodSignature] = + def unapply( + term: Term.Name + )(implicit doc: SemanticDocument): Option[MethodSignature] = PartialFunction.condOpt(term) { case Term.Name(name) & XSymbol( XSymbol.Owner(DoesSymbolHaveCorrectType()) & XSignature( - sig: MethodSignature)) if methodNames contains name => + sig: MethodSignature + ) + ) if methodNames contains name => sig } } diff --git a/scalafix/rules/src/main/scala/org/ekrich/sconfig/fix/package.scala b/scalafix/rules/src/main/scala/org/ekrich/sconfig/fix/package.scala index 7e9add7a..68f56637 100644 --- a/scalafix/rules/src/main/scala/org/ekrich/sconfig/fix/package.scala +++ b/scalafix/rules/src/main/scala/org/ekrich/sconfig/fix/package.scala @@ -28,7 +28,9 @@ import scala.util.control.NonFatal */ package object fix { - /** Allows to apply multiple extractors/matchers to a single expression in a `case` block. + /** + * Allows to apply multiple extractors/matchers to a single expression in a + * `case` block. */ object & { def unapply[A](a: A): Option[(A, A)] = Some((a, a)) @@ -88,26 +90,31 @@ package object fix { */ None case NonFatal(ex) => - throw UnexpectedException(sym, - Properties.javaVersion, - Properties.versionString, - ex) + throw UnexpectedException( + sym, + Properties.javaVersion, + Properties.versionString, + ex + ) } } object XSemanticType { - /** Tries to infer a result SemanticType of a particular Stat. + /** + * Tries to infer a result SemanticType of a particular Stat. * - * @note Not all possible cases are handled. + * @note + * Not all possible cases are handled. */ - def unapply(stat: Stat)( - implicit doc: SemanticDocument): Option[SemanticType] = + def unapply( + stat: Stat + )(implicit doc: SemanticDocument): Option[SemanticType] = PartialFunction.condOpt(stat) { case Term.Name(_) & XSymbol(XSignature(ValueSignature(tpe))) => tpe case Term.Apply(_, _) & - XSymbol(XSignature(ValueSignature(TypeRef(_, funcSym, _ :+ tpe)))) + XSymbol(XSignature(ValueSignature(TypeRef(_, funcSym, _ :+ tpe)))) if funcSym.value.startsWith("scala/Function") && funcSym.value .endsWith("#") => tpe @@ -117,11 +124,12 @@ package object fix { } } -case class UnexpectedException(sym: Symbol, - java: String, - scala: String, - cause: Throwable) - extends RuntimeException( +case class UnexpectedException( + sym: Symbol, + java: String, + scala: String, + cause: Throwable +) extends RuntimeException( s"""An unexpected exception occurred. Please report this as an issue at https://github.com/ekrich/sconfig/issues and include the following information: | |Failing symbol: ${sym.value} diff --git a/sconfig/jvm/src/main/scala/org/ekrich/config/ConfigBeanFactory.scala b/sconfig/jvm/src/main/scala/org/ekrich/config/ConfigBeanFactory.scala index 9d139961..1df1c88e 100644 --- a/sconfig/jvm/src/main/scala/org/ekrich/config/ConfigBeanFactory.scala +++ b/sconfig/jvm/src/main/scala/org/ekrich/config/ConfigBeanFactory.scala @@ -3,15 +3,16 @@ package org.ekrich.config import org.ekrich.config.impl.ConfigBeanImpl /** - * Factory for automatically creating a Java class from a {@link Config}. - * See {@link ConfigBeanFactory#create}. + * Factory for automatically creating a Java class from a {@link Config}. See + * {@link ConfigBeanFactory#create}. * * @since 1.3.0 */ object ConfigBeanFactory { /** - * Creates an instance of a class, initializing its fields from a {@link Config}. + * Creates an instance of a class, initializing its fields from a {@link + * Config}. * * Example usage: * @@ -20,27 +21,29 @@ object ConfigBeanFactory { * val config: FooConfig = ConfigBeanFactory.create(configSource, classOf[FooConfig]); * }}} * - * The Java class should follow JavaBean conventions. Field types - * can be any of the types you can normally get from a {@link Config}, - * including `java.time.Duration` or {@link ConfigMemorySize}. - * Fields may also be another JavaBean-style - * class. + * The Java class should follow JavaBean conventions. Field types can be any + * of the types you can normally get from a {@link Config}, including + * `java.time.Duration` or {@link ConfigMemorySize}. Fields may also be + * another JavaBean-style class. * - * Fields are mapped to config by converting the config key to - * camel case. So the key `foo-bar` becomes JavaBean - * setter `setFooBar`. + * Fields are mapped to config by converting the config key to camel case. So + * the key `foo-bar` becomes JavaBean setter `setFooBar`. * * @since 1.3.0 - * @param config source of config information - * @param clazz class to be instantiated - * @param the type of the class to be instantiated - * @return an instance of the class populated with data from the config + * @param config + * source of config information + * @param clazz + * class to be instantiated + * @param [T] + * the type of the class to be instantiated + * @return + * an instance of the class populated with data from the config * @throws ConfigException#BadBean - * If something is wrong with the JavaBean + * If something is wrong with the JavaBean * @throws ConfigException#ValidationFailed - * If the config doesn't conform to the bean's implied schema + * If the config doesn't conform to the bean's implied schema * @throws ConfigException - * Can throw the same exceptions as the getters on {@link Config} + * Can throw the same exceptions as the getters on {@link Config} */ def create[T](config: Config, clazz: Class[T]): T = ConfigBeanImpl.createInternal(config, clazz) 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 9a1c1793..498c6a08 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 @@ -26,8 +26,8 @@ import org.ekrich.config.ConfigValueType import org.ekrich.config.Optional /** - * Internal implementation detail, not ABI stable, do not touch. - * For use only by the {@link org.ekrich.config} package. + * Internal implementation detail, not ABI stable, do not touch. For use only by + * the {@link org.ekrich.config} package. */ object ConfigBeanImpl { @@ -35,10 +35,14 @@ object ConfigBeanImpl { * This is public ONLY for use by the "config" package, DO NOT USE this ABI * may change. * - * @param type of the bean - * @param config config to use - * @param clazz class of the bean - * @return the bean instance + * @param [T] + * type of the bean + * @param config + * config to use + * @param clazz + * class of the bean + * @return + * the bean instance */ def createInternal[T](config: Config, clazz: Class[T]): T = { if (config @@ -53,10 +57,11 @@ object ConfigBeanImpl { val originalNames = new ju.HashMap[String, String] for (configProp <- config.root.entrySet.asScala) { val originalName = configProp.getKey - val camelName = ConfigImplUtil.toCamelCase(originalName) + val camelName = ConfigImplUtil.toCamelCase(originalName) // if a setting is in there both as some hyphen name and the camel name, // the camel one wins - if (originalNames.containsKey(camelName) && !(originalName == camelName)) { + if (originalNames.containsKey(camelName) && + !(originalName == camelName)) { // if we aren't a camel name to start with, we lose. // if we are or we are the first matching key, we win. } else { @@ -90,9 +95,9 @@ object ConfigBeanImpl { // find every issue, but it should find common ones). val problems = new ju.ArrayList[ConfigException.ValidationProblem] for (beanProp <- beanProps.asScala) { - val setter: Method = beanProp.getWriteMethod + val setter: Method = beanProp.getWriteMethod val parameterClass: Class[_] = setter.getParameterTypes()(0) - val expectedType = getValueTypeOrNull(parameterClass) + val expectedType = getValueTypeOrNull(parameterClass) if (expectedType != null) { var name = originalNames.get(beanProp.getName) if (name == null) name = beanProp.getName @@ -111,8 +116,8 @@ object ConfigBeanImpl { val bean = clazz.getConstructor().newInstance() for (beanProp <- beanProps.asScala) { breakable { - val setter = beanProp.getWriteMethod - val parameterType = setter.getGenericParameterTypes()(0) + val setter = beanProp.getWriteMethod + val parameterType = setter.getGenericParameterTypes()(0) val parameterClass = setter.getParameterTypes()(0) val configPropName = originalNames.get(beanProp.getName) // Is the property key missing in the config? @@ -165,19 +170,17 @@ object ConfigBeanImpl { config: Config, configPropName: String ): Any = - if ((parameterClass == classOf[jl.Boolean]) || (parameterClass == classOf[ - Boolean - ])) config.getBoolean(configPropName) - else if ((parameterClass == classOf[Integer]) || (parameterClass == classOf[ - Int - ])) + if ((parameterClass == classOf[jl.Boolean]) || + (parameterClass == classOf[Boolean])) + config.getBoolean(configPropName) + else if ((parameterClass == classOf[Integer]) || + (parameterClass == classOf[Int])) config.getInt(configPropName) - else if ((parameterClass == classOf[jl.Double]) || (parameterClass == classOf[ - Double - ])) config.getDouble(configPropName) - else if ((parameterClass == classOf[jl.Long]) || (parameterClass == classOf[ - Long - ])) + else if ((parameterClass == classOf[jl.Double]) || + (parameterClass == classOf[Double])) + config.getDouble(configPropName) + else if ((parameterClass == classOf[jl.Long]) || + (parameterClass == classOf[Long])) config.getLong(configPropName) else if (parameterClass == classOf[String]) config.getString(configPropName) @@ -208,9 +211,10 @@ object ConfigBeanImpl { .getActualTypeArguments if ((typeArgs(0) != classOf[String]) || (typeArgs(1) != classOf[Any])) throw new ConfigException.BadBean( - "Bean property '" + configPropName + "' of class " + beanClass.getName + " has unsupported Map<" + typeArgs( - 0 - ) + "," + typeArgs(1) + ">, only Map is supported right now" + "Bean property '" + configPropName + "' of class " + + beanClass.getName + " has unsupported Map[" + + typeArgs(0) + ", " + typeArgs(1) + + "], only Map[String, Object] is supported right now" ) config.getObject(configPropName).unwrapped } else if (parameterClass == classOf[Config]) @@ -306,18 +310,18 @@ object ConfigBeanImpl { // null if we can't easily say; this is heuristic/best-effort private def getValueTypeOrNull(parameterClass: Class[_]) = - if ((parameterClass == classOf[jl.Boolean]) || (parameterClass == classOf[ - Boolean - ])) ConfigValueType.BOOLEAN - else if ((parameterClass == classOf[Integer]) || (parameterClass == classOf[ - Int - ])) ConfigValueType.NUMBER - else if ((parameterClass == classOf[jl.Double]) || (parameterClass == classOf[ - Double - ])) ConfigValueType.NUMBER - else if ((parameterClass == classOf[jl.Long]) || (parameterClass == classOf[ - Long - ])) ConfigValueType.NUMBER + if ((parameterClass == classOf[jl.Boolean]) || + (parameterClass == classOf[Boolean])) + ConfigValueType.BOOLEAN + else if ((parameterClass == classOf[Integer]) || + (parameterClass == classOf[Int])) + ConfigValueType.NUMBER + else if ((parameterClass == classOf[jl.Double]) || + (parameterClass == classOf[Double])) + ConfigValueType.NUMBER + else if ((parameterClass == classOf[jl.Long]) || + (parameterClass == classOf[Long])) + ConfigValueType.NUMBER else if (parameterClass == classOf[String]) ConfigValueType.STRING else if (parameterClass == classOf[Duration]) null else if (parameterClass == classOf[ConfigMemorySize]) null @@ -336,7 +340,8 @@ object ConfigBeanImpl { beanInfo .getPropertyDescriptors() .exists(beanProp => - beanProp.getReadMethod != null && beanProp.getWriteMethod != null) + beanProp.getReadMethod != null && beanProp.getWriteMethod != null + ) } } diff --git a/sconfig/jvm/src/test/scala/ApiExamples.scala b/sconfig/jvm/src/test/scala/ApiExamples.scala index 529d601b..e0f69950 100644 --- a/sconfig/jvm/src/test/scala/ApiExamples.scala +++ b/sconfig/jvm/src/test/scala/ApiExamples.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011 Typesafe Inc. + * Copyright (C) 2011 Typesafe Inc. */ import org.junit.Assert._ import org.junit._ @@ -10,9 +10,9 @@ import language.implicitConversions import java.util.concurrent.TimeUnit /** - * This is to show how the API works and to be sure it's usable - * from outside of the library's package and in Scala. - * It isn't intended to be asserting anything or adding test coverage. + * This is to show how the API works and to be sure it's usable from outside of + * the library's package and in Scala. It isn't intended to be asserting + * anything or adding test coverage. */ class ApiExamples { @Test @@ -21,9 +21,9 @@ class ApiExamples { // you don't have to write the types explicitly of course, // just doing that to show what they are. - val a: Int = conf.getInt("ints.fortyTwo") + val a: Int = conf.getInt("ints.fortyTwo") val child: Config = conf.getConfig("ints") - val b: Int = child.getInt("fortyTwo") + val b: Int = child.getInt("fortyTwo") val ms: Long = conf.getDuration("durations.halfSecond", TimeUnit.MILLISECONDS) diff --git a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfParserTest.scala b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfParserTest.scala index 29e1b5b8..c3c2b4c6 100644 --- a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfParserTest.scala +++ b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfParserTest.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011 Typesafe Inc. + * Copyright (C) 2011 Typesafe Inc. */ package org.ekrich.config.impl @@ -70,7 +70,7 @@ class ConfParserTest extends TestUtils { } private def parsePath(s: String): Path = { - var firstException: ConfigException = null + var firstException: ConfigException = null var secondException: ConfigException = null // parse first by wrapping into a whole document and using @@ -158,16 +158,16 @@ class ConfParserTest extends TestUtils { assertEquals(path("1", "2", "3", "4"), parsePath("1.2.3.4")) for (invalid <- Seq( - "", - " ", - " \n \n ", - "a.", - ".b", - "a..b", - "a${b}c", - "\"\".", - ".\"\"" - )) { + "", + " ", + " \n \n ", + "a.", + ".b", + "a..b", + "a${b}c", + "\"\".", + ".\"\"" + )) { try { intercept[ConfigException.BadPath] { parsePath(invalid) @@ -284,7 +284,7 @@ class ConfParserTest extends TestUtils { def dropCurlies(s: String) = { // drop the outside curly braces val first = s.indexOf('{') - val last = s.lastIndexOf('}') + val last = s.lastIndexOf('}') s.substring(0, first) + s.substring(first + 1, last) + s.substring( last + 1, s.length() @@ -902,7 +902,7 @@ class ConfParserTest extends TestUtils { ) } - val actual = ex.getMessage + val actual = ex.getMessage val expected = ".*resource not found on classpath.*" assertTrue( s"expected match for <$expected> but got <$actual>", @@ -922,7 +922,7 @@ class ConfParserTest extends TestUtils { ) val expected = "This is in the included file" - val actual = conf.getString("foo") + val actual = conf.getString("foo") assertTrue( s"expected match for <$expected> but got <$actual>", actual.matches(expected) @@ -961,7 +961,7 @@ class ConfParserTest extends TestUtils { @Test def includeURLHeuristically(): Unit = { - val url = resourceFile("test01.conf").toURI().toURL().toExternalForm() + val url = resourceFile("test01.conf").toURI().toURL().toExternalForm() val conf = ConfigFactory.parseString("include " + quoteJsonString(url)) assertEquals(42, conf.getInt("ints.fortyTwo")) @@ -972,7 +972,7 @@ class ConfParserTest extends TestUtils { @Test def includeURLBasenameHeuristically(): Unit = { // "AnySyntax" trick doesn't work for url includes - val url = resourceFile("test01").toURI().toURL().toExternalForm() + val url = resourceFile("test01").toURI().toURL().toExternalForm() val conf = ConfigFactory.parseString("include " + quoteJsonString(url)) assertTrue("including basename URL doesn't load anything", conf.isEmpty) diff --git a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfigBeanFactoryTest.scala b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfigBeanFactoryTest.scala index a714b5ac..c5a0be6c 100644 --- a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfigBeanFactoryTest.scala +++ b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfigBeanFactoryTest.scala @@ -138,7 +138,7 @@ class ConfigBeanFactoryTest extends TestUtils { assertEquals(List(1, 2, 3).asJava, beanConfig.getOfInt) assertEquals(List(32L, 42L, 52L).asJava, beanConfig.getOfLong) assertEquals(List("a", "b", "c").asJava, beanConfig.getOfString) - //assertEquals(List(List("a", "b", "c").asJava, + // assertEquals(List(List("a", "b", "c").asJava, // List("a", "b", "c").asJava, // List("a", "b", "c").asJava).asJava, // beanConfig.getOfArray) diff --git a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfigDocumentTest.scala b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfigDocumentTest.scala index 23dee497..ff092fad 100644 --- a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfigDocumentTest.scala +++ b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfigDocumentTest.scala @@ -148,8 +148,7 @@ class ConfigDocumentTest extends TestUtils { configDocumentReplaceConfTest(origText, finalText, "[1,2,3,4,5]", "h.b.a") configDocumentReplaceJsonTest(origText, finalText, "[1,2,3,4,5]", "h.b.a") - finalText = - """{ + finalText = """{ "a":123, "b": 123.456, "c": true, @@ -175,7 +174,7 @@ class ConfigDocumentTest extends TestUtils { @Test def configDocumentMultiElementDuplicatesRemoved: Unit = { - var origText = "{a: b, a.b.c: d, a: e}" + var origText = "{a: b, a.b.c: d, a: e}" var configDoc = ConfigDocumentFactory.parseString(origText) assertEquals("{a: 2}", configDoc.withValueText("a", "2").render) @@ -190,7 +189,7 @@ class ConfigDocumentTest extends TestUtils { @Test def configDocumentSetNewValueBraceRoot: Unit = { - val origText = "{\n\t\"a\":\"b\",\n\t\"c\":\"d\"\n}" + val origText = "{\n\t\"a\":\"b\",\n\t\"c\":\"d\"\n}" val finalTextConf = "{\n\t\"a\":\"b\",\n\t\"c\":\"d\"\n\t\"e\" : \"f\"\n}" val finalTextJson = "{\n\t\"a\":\"b\",\n\t\"c\":\"d\",\n\t\"e\" : \"f\"\n}" configDocumentReplaceConfTest(origText, finalTextConf, "\"f\"", "\"e\"") @@ -199,14 +198,14 @@ class ConfigDocumentTest extends TestUtils { @Test def configDocumentSetNewValueNoBraces: Unit = { - val origText = "\"a\":\"b\",\n\"c\":\"d\"\n" + val origText = "\"a\":\"b\",\n\"c\":\"d\"\n" val finalText = "\"a\":\"b\",\n\"c\":\"d\"\n\"e\" : \"f\"\n" configDocumentReplaceConfTest(origText, finalText, "\"f\"", "\"e\"") } @Test def configDocumentSetNewValueMultiLevelConf: Unit = { - val origText = "a:b\nc:d" + val origText = "a:b\nc:d" val finalText = "a:b\nc:d\ne : {\n f : {\n g : 12\n }\n}" configDocumentReplaceConfTest(origText, finalText, "12", "e.f.g") } @@ -221,8 +220,8 @@ class ConfigDocumentTest extends TestUtils { @Test def configDocumentSetNewConfigValue: Unit = { - val origText = "{\"a\": \"b\"}" - val finalText = "{\"a\": 12}" + val origText = "{\"a\": \"b\"}" + val finalText = "{\"a\": 12}" val configDocHOCON = ConfigDocumentFactory.parseString(origText) val configDocJSON = ConfigDocumentFactory.parseString( origText, @@ -237,7 +236,7 @@ class ConfigDocumentTest extends TestUtils { @Test def configDocumentHasValue: Unit = { - val origText = "{a: b, a.b.c.d: e, c: {a: {b: c}}}" + val origText = "{a: b, a.b.c.d: e, c: {a: {b: c}}}" val configDoc = ConfigDocumentFactory.parseString(origText) assertTrue(configDoc.hasPath("a")) @@ -250,7 +249,7 @@ class ConfigDocumentTest extends TestUtils { @Test def configDocumentRemoveValue: Unit = { - val origText = "{a: b, a.b.c.d: e, c: {a: {b: c}}}" + val origText = "{a: b, a.b.c.d: e, c: {a: {b: c}}}" val configDoc = ConfigDocumentFactory.parseString(origText) assertEquals("{c: {a: {b: c}}}", configDoc.withoutPath("a").render) @@ -272,25 +271,25 @@ class ConfigDocumentTest extends TestUtils { @Test def configDocumentRemoveMultiple: Unit = { - val origText = "a { b: 42 }, a.b = 43, a { b: { c: 44 } }" + val origText = "a { b: 42 }, a.b = 43, a { b: { c: 44 } }" val configDoc = ConfigDocumentFactory.parseString(origText) - val removed = configDoc.withoutPath("a.b") + val removed = configDoc.withoutPath("a.b") assertEquals("a { }, a { }", removed.render) } @Test def configDocumentRemoveOverridden: Unit = { - val origText = "a { b: 42 }, a.b = 43, a { b: { c: 44 } }, a : 57 " + val origText = "a { b: 42 }, a.b = 43, a { b: { c: 44 } }, a : 57 " val configDoc = ConfigDocumentFactory.parseString(origText) - val removed = configDoc.withoutPath("a.b") + val removed = configDoc.withoutPath("a.b") assertEquals("a { }, a { }, a : 57 ", removed.render) } @Test def configDocumentRemoveNested: Unit = { - val origText = "a { b: 42 }, a.b = 43, a { b: { c: 44 } }" + val origText = "a { b: 42 }, a.b = 43, a { b: { c: 44 } }" val configDoc = ConfigDocumentFactory.parseString(origText) - val removed = configDoc.withoutPath("a.b.c") + val removed = configDoc.withoutPath("a.b.c") assertEquals("a { b: 42 }, a.b = 43, a { b: { } }", removed.render) } @@ -361,7 +360,7 @@ class ConfigDocumentTest extends TestUtils { new FileReader("src/test/resources/test03.conf") ) var line = fileReader.readLine() - val sb = new StringBuilder() + val sb = new StringBuilder() while (line != null) { sb.append(line) sb.append("\n") @@ -388,7 +387,7 @@ class ConfigDocumentTest extends TestUtils { @Test def configDocumentIndentationSingleLineObject: Unit = { // Proper insertion for single-line objects - var origText = "a { b: c }" + var origText = "a { b: c }" var configDocument = ConfigDocumentFactory.parseString(origText) assertEquals( "a { b: c, d : e }", @@ -429,7 +428,7 @@ class ConfigDocumentTest extends TestUtils { @Test def configDocumentIndentationMultiLineObject: Unit = { - var origText = "a {\n b: c\n}" + var origText = "a {\n b: c\n}" var configDocument = ConfigDocumentFactory.parseString(origText) assertEquals( "a {\n b: c\n e : f\n}", @@ -456,7 +455,7 @@ class ConfigDocumentTest extends TestUtils { @Test def configDocumentIndentationNested: Unit = { - var origText = "a { b { c { d: e } } }" + var origText = "a { b { c { d: e } } }" var configDocument = ConfigDocumentFactory.parseString(origText) assertEquals( "a { b { c { d: e, f : g } } }", @@ -473,7 +472,7 @@ class ConfigDocumentTest extends TestUtils { @Test def configDocumentIndentationEmptyObject: Unit = { - var origText = "a { }" + var origText = "a { }" var configDocument = ConfigDocumentFactory.parseString(origText) assertEquals("a { b : c }", configDocument.withValueText("a.b", "c").render) @@ -487,7 +486,7 @@ class ConfigDocumentTest extends TestUtils { @Test def configDocumentIndentationMultiLineValue: Unit = { - val origText = "a {\n b {\n c {\n d: e\n }\n }\n}" + val origText = "a {\n b {\n c {\n d: e\n }\n }\n}" val configDocument = ConfigDocumentFactory.parseString(origText) assertEquals( "a {\n b {\n c {\n d: e\n f : {\n g: h\n i: j\n k: {\n l: m\n }\n }\n }\n }\n}", @@ -507,7 +506,7 @@ class ConfigDocumentTest extends TestUtils { @Test def configDocumentIndentationMultiLineValueSingleLineObject: Unit = { // Weird indentation occurs when adding a multi-line value to a single-line object - val origText = "a { b { } }" + val origText = "a { b { } }" val configDocument = ConfigDocumentFactory.parseString(origText) assertEquals( "a { b { c : {\n c:d\n } } }", @@ -518,7 +517,7 @@ class ConfigDocumentTest extends TestUtils { @Test def configDocumentIndentationSingleLineObjectContainingMultiLineValue : Unit = { - val origText = "a { b {\n c: d\n} }" + val origText = "a { b {\n c: d\n} }" val configDocument = ConfigDocumentFactory.parseString(origText) assertEquals( @@ -529,7 +528,7 @@ class ConfigDocumentTest extends TestUtils { @Test def configDocumentIndentationReplacingWithMultiLineValue: Unit = { - var origText = "a {\n b {\n c : 22\n }\n}" + var origText = "a {\n b {\n c : 22\n }\n}" var configDocument = ConfigDocumentFactory.parseString(origText) assertEquals( @@ -548,7 +547,7 @@ class ConfigDocumentTest extends TestUtils { @Test def configDocumentIndentationValueWithInclude: Unit = { - val origText = "a {\n b {\n c : 22\n }\n}" + val origText = "a {\n b {\n c : 22\n }\n}" val configDocument = ConfigDocumentFactory.parseString(origText) assertEquals( @@ -561,7 +560,7 @@ class ConfigDocumentTest extends TestUtils { @Test def configDocumentIndentationBasedOnIncludeNode: Unit = { - val origText = "a : b\n include \"foo\"\n" + val origText = "a : b\n include \"foo\"\n" val configDocument = ConfigDocumentFactory.parseString(origText) assertEquals( @@ -572,7 +571,7 @@ class ConfigDocumentTest extends TestUtils { @Test def configDocumentEmptyTest: Unit = { - val origText = "" + val origText = "" val configDocument = ConfigDocumentFactory.parseString(origText) assertEquals("a : 1", configDocument.withValueText("a", "1").render) @@ -592,7 +591,7 @@ class ConfigDocumentTest extends TestUtils { @Test def configDocumentConfigObjectInsertion: Unit = { - val origText = "{ a : b }" + val origText = "{ a : b }" val configDocument = ConfigDocumentFactory.parseString(origText) val configVal = diff --git a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfigSubstitutionTest.scala b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfigSubstitutionTest.scala index 05722fd1..cac2798f 100644 --- a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfigSubstitutionTest.scala +++ b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfigSubstitutionTest.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011 Typesafe Inc. + * Copyright (C) 2011 Typesafe Inc. */ package org.ekrich.config.impl @@ -212,7 +212,7 @@ class ConfigSubstitutionTest extends TestUtils { @Test def substitutionsLookForward(): Unit = { - val obj = parseObject("""a=1,b=${a},a=2""") + val obj = parseObject("""a=1,b=${a},a=2""") val resolved = resolve(obj) assertEquals(2, resolved.getInt("b")) } @@ -353,7 +353,7 @@ class ConfigSubstitutionTest extends TestUtils { @Test def ignoreHiddenUndefinedSubst(): Unit = { // if a substitution is overridden then it shouldn't matter that it's undefined - val obj = parseObject("""a=${nonexistent},a=42""") + val obj = parseObject("""a=${nonexistent},a=42""") val resolved = resolve(obj) assertEquals(42, resolved.getInt("a")) } @@ -375,7 +375,7 @@ class ConfigSubstitutionTest extends TestUtils { @Test def ignoreHiddenCircularSubst(): Unit = { // if a substitution is overridden then it shouldn't matter that it's circular - val obj = parseObject("""a=${a},a=42""") + val obj = parseObject("""a=${a},a=42""") val resolved = resolve(obj) assertEquals(42, resolved.getInt("a")) } @@ -860,7 +860,7 @@ class ConfigSubstitutionTest extends TestUtils { |"a": ${testList} """.stripMargin) - //"testList.0" and "testList.1" are defined as envVars in build.sbt + // "testList.0" and "testList.1" are defined as envVars in build.sbt val resolved = resolve(props) assertEquals(List("0", "1"), resolved.getList("a").unwrapped.asScala) @@ -912,7 +912,7 @@ class ConfigSubstitutionTest extends TestUtils { var existed = 0 for (k <- resolved.root.keySet().asScala) { val envVarName = k.replace("key_", "") - val e = System.getenv(envVarName) + val e = System.getenv(envVarName) if (e != null) { existed += 1 assertEquals(e, resolved.getString(k)) @@ -959,7 +959,7 @@ class ConfigSubstitutionTest extends TestUtils { var existed = 0 for (k <- resolved.getObject("a").keySet().asScala) { val envVarName = k.replace("key_", "") - val e = System.getenv(envVarName) + val e = System.getenv(envVarName) if (e != null) { existed += 1 assertEquals(e, resolved.getConfig("a").getString(k)) @@ -984,28 +984,28 @@ class ConfigSubstitutionTest extends TestUtils { @Test def optionalOverrideNotProvided(): Unit = { - val obj = parseObject("""{ a: 42, a : ${?NOT_HERE} }""") + val obj = parseObject("""{ a: 42, a : ${?NOT_HERE} }""") val resolved = resolve(obj) assertEquals(42, resolved.getInt("a")) } @Test def optionalOverrideProvided(): Unit = { - val obj = parseObject("""{ HERE : 43, a: 42, a : ${?HERE} }""") + val obj = parseObject("""{ HERE : 43, a: 42, a : ${?HERE} }""") val resolved = resolve(obj) assertEquals(43, resolved.getInt("a")) } @Test def optionalOverrideOfObjectNotProvided(): Unit = { - val obj = parseObject("""{ a: { b : 42 }, a : ${?NOT_HERE} }""") + val obj = parseObject("""{ a: { b : 42 }, a : ${?NOT_HERE} }""") val resolved = resolve(obj) assertEquals(42, resolved.getInt("a.b")) } @Test def optionalOverrideOfObjectProvided(): Unit = { - val obj = parseObject("""{ HERE : 43, a: { b : 42 }, a : ${?HERE} }""") + val obj = parseObject("""{ HERE : 43, a: { b : 42 }, a : ${?HERE} }""") val resolved = resolve(obj) assertEquals(43, resolved.getInt("a")) assertFalse(resolved.hasPath("a.b")) @@ -1013,21 +1013,21 @@ class ConfigSubstitutionTest extends TestUtils { @Test def optionalVanishesFromArray(): Unit = { - val obj = parseObject("""{ a : [ 1, 2, 3, ${?NOT_HERE} ] }""") + val obj = parseObject("""{ a : [ 1, 2, 3, ${?NOT_HERE} ] }""") val resolved = resolve(obj) assertEquals(Seq(1, 2, 3), resolved.getIntList("a").asScala) } @Test def optionalUsedInArray(): Unit = { - val obj = parseObject("""{ HERE: 4, a : [ 1, 2, 3, ${?HERE} ] }""") + val obj = parseObject("""{ HERE: 4, a : [ 1, 2, 3, ${?HERE} ] }""") val resolved = resolve(obj) assertEquals(Seq(1, 2, 3, 4), resolved.getIntList("a").asScala) } @Test def substSelfReference(): Unit = { - val obj = parseObject("""a=1, a=${a}""") + val obj = parseObject("""a=1, a=${a}""") val resolved = resolve(obj) assertEquals(1, resolved.getInt("a")) } @@ -1046,21 +1046,21 @@ class ConfigSubstitutionTest extends TestUtils { @Test def substSelfReferenceOptional(): Unit = { - val obj = parseObject("""a=${?a}""") + val obj = parseObject("""a=${?a}""") val resolved = resolve(obj) assertEquals("optional self reference disappears", 0, resolved.root.size) } @Test def substSelfReferenceAlongPath(): Unit = { - val obj = parseObject("""a.b=1, a.b=${a.b}""") + val obj = parseObject("""a.b=1, a.b=${a.b}""") val resolved = resolve(obj) assertEquals(1, resolved.getInt("a.b")) } @Test def substSelfReferenceAlongLongerPath(): Unit = { - val obj = parseObject("""a.b.c=1, a.b.c=${a.b.c}""") + val obj = parseObject("""a.b.c=1, a.b.c=${a.b.c}""") val resolved = resolve(obj) assertEquals(1, resolved.getInt("a.b.c")) } @@ -1068,7 +1068,7 @@ class ConfigSubstitutionTest extends TestUtils { @Test def substSelfReferenceAlongPathMoreComplex(): Unit = { // this is an example from the spec - val obj = parseObject(""" + val obj = parseObject(""" foo : { a : { c : 1 } } foo : ${foo.a} foo : { a : 2 } @@ -1084,7 +1084,7 @@ class ConfigSubstitutionTest extends TestUtils { // we resolve and memoize a first or b first. currently // java 8's hash table makes it resolve OK, but // it's also allowed to throw an exception. - val obj = parseObject("""a=1, b=${a}, a=${b}""") + val obj = parseObject("""a=1, b=${a}, a=${b}""") val resolved = resolve(obj) assertEquals(1, resolved.getInt("a")) } @@ -1095,7 +1095,7 @@ class ConfigSubstitutionTest extends TestUtils { // resolve and memoize a, b, or c first. currently java // 8's hash table makes it resolve OK, but it's also // allowed to throw an exception. - val obj = parseObject("""a=1, b=${c}, c=${a}, a=${b}""") + val obj = parseObject("""a=1, b=${c}, c=${a}, a=${b}""") val resolved = resolve(obj) assertEquals(1, resolved.getInt("a")) } @@ -1104,10 +1104,10 @@ class ConfigSubstitutionTest extends TestUtils { def substSelfReferenceIndirectStackCycle(): Unit = { // this situation is undefined, depends on // whether we resolve a or b first. - val obj = parseObject("""a=1, b={c=5}, b=${a}, a=${b}""") + val obj = parseObject("""a=1, b={c=5}, b=${a}, a=${b}""") val resolved = resolve(obj) - val option1 = parseObject(""" b={c=5}, a={c=5} """).toConfig - val option2 = parseObject(""" b=1, a=1 """).toConfig + val option1 = parseObject(""" b={c=5}, a={c=5} """).toConfig + val option2 = parseObject(""" b=1, a=1 """).toConfig assertTrue( "not an expected possibility: " + resolved + " expected 1: " + option1 + " or 2: " + option2, @@ -1117,21 +1117,21 @@ class ConfigSubstitutionTest extends TestUtils { @Test def substSelfReferenceObject(): Unit = { - val obj = parseObject("""a={b=5}, a=${a}""") + val obj = parseObject("""a={b=5}, a=${a}""") val resolved = resolve(obj) assertEquals(5, resolved.getInt("a.b")) } @Test def substSelfReferenceObjectAlongPath(): Unit = { - val obj = parseObject("""a.b={c=5}, a.b=${a.b}""") + val obj = parseObject("""a.b={c=5}, a.b=${a.b}""") val resolved = resolve(obj) assertEquals(5, resolved.getInt("a.b.c")) } @Test def substSelfReferenceInConcat(): Unit = { - val obj = parseObject("""a=1, a=${a}foo""") + val obj = parseObject("""a=1, a=${a}foo""") val resolved = resolve(obj) assertEquals("1foo", resolved.getString("a")) } @@ -1160,35 +1160,35 @@ class ConfigSubstitutionTest extends TestUtils { @Test def substOptionalSelfReferenceInConcat(): Unit = { - val obj = parseObject("""a=${?a}foo""") + val obj = parseObject("""a=${?a}foo""") val resolved = resolve(obj) assertEquals("foo", resolved.getString("a")) } @Test def substOptionalIndirectSelfReferenceInConcat(): Unit = { - val obj = parseObject("""a=${?b}foo,b=${?a}""") + val obj = parseObject("""a=${?b}foo,b=${?a}""") val resolved = resolve(obj) assertEquals("foo", resolved.getString("a")) } @Test def substTwoOptionalSelfReferencesInConcat(): Unit = { - val obj = parseObject("""a=${?a}foo${?a}""") + val obj = parseObject("""a=${?a}foo${?a}""") val resolved = resolve(obj) assertEquals("foo", resolved.getString("a")) } @Test def substTwoOptionalSelfReferencesInConcatWithPriorValue(): Unit = { - val obj = parseObject("""a=1,a=${?a}foo${?a}""") + val obj = parseObject("""a=1,a=${?a}foo${?a}""") val resolved = resolve(obj) assertEquals("1foo1", resolved.getString("a")) } @Test def substSelfReferenceMiddleOfStack(): Unit = { - val obj = parseObject("""a=1, a=${a}, a=2""") + val obj = parseObject("""a=1, a=${a}, a=2""") val resolved = resolve(obj) // the substitution would be 1, but then 2 overrides assertEquals(2, resolved.getInt("a")) @@ -1196,7 +1196,7 @@ class ConfigSubstitutionTest extends TestUtils { @Test def substSelfReferenceObjectMiddleOfStack(): Unit = { - val obj = parseObject("""a={b=5}, a=${a}, a={c=6}""") + val obj = parseObject("""a={b=5}, a=${a}, a={c=6}""") val resolved = resolve(obj) assertEquals(5, resolved.getInt("a.b")) assertEquals(6, resolved.getInt("a.c")) @@ -1204,7 +1204,7 @@ class ConfigSubstitutionTest extends TestUtils { @Test def substOptionalSelfReferenceMiddleOfStack(): Unit = { - val obj = parseObject("""a=1, a=${?a}, a=2""") + val obj = parseObject("""a=1, a=${?a}, a=2""") val resolved = resolve(obj) // the substitution would be 1, but then 2 overrides assertEquals(2, resolved.getInt("a")) @@ -1214,28 +1214,28 @@ class ConfigSubstitutionTest extends TestUtils { def substSelfReferenceBottomOfStack(): Unit = { // self-reference should just be ignored since it's // overridden - val obj = parseObject("""a=${a}, a=1, a=2""") + val obj = parseObject("""a=${a}, a=1, a=2""") val resolved = resolve(obj) assertEquals(2, resolved.getInt("a")) } @Test def substOptionalSelfReferenceBottomOfStack(): Unit = { - val obj = parseObject("""a=${?a}, a=1, a=2""") + val obj = parseObject("""a=${?a}, a=1, a=2""") val resolved = resolve(obj) assertEquals(2, resolved.getInt("a")) } @Test def substSelfReferenceTopOfStack(): Unit = { - val obj = parseObject("""a=1, a=2, a=${a}""") + val obj = parseObject("""a=1, a=2, a=${a}""") val resolved = resolve(obj) assertEquals(2, resolved.getInt("a")) } @Test def substOptionalSelfReferenceTopOfStack(): Unit = { - val obj = parseObject("""a=1, a=2, a=${?a}""") + val obj = parseObject("""a=1, a=2, a=${?a}""") val resolved = resolve(obj) assertEquals(2, resolved.getInt("a")) } @@ -1245,7 +1245,7 @@ class ConfigSubstitutionTest extends TestUtils { // ${a} in the middle of the stack means "${a} in the stack // below us" and so ${a.b} means b inside the "${a} below us" // not b inside the final "${a}" - val obj = parseObject("""a={b={c=5}}, a=${a.b}, a={b=2}""") + val obj = parseObject("""a={b={c=5}}, a=${a.b}, a={b=2}""") val resolved = resolve(obj) assertEquals(5, resolved.getInt("a.c")) } @@ -1254,7 +1254,7 @@ class ConfigSubstitutionTest extends TestUtils { def substSelfReferenceAlongAPathInsideObject(): Unit = { // if the ${a.b} is _inside_ a field value instead of // _being_ the field value, it does not look backward. - val obj = parseObject("""a={b={c=5}}, a={ x : ${a.b} }, a={b=2}""") + val obj = parseObject("""a={b={c=5}}, a={ x : ${a.b} }, a={b=2}""") val resolved = resolve(obj) assertEquals(2, resolved.getInt("a.x")) } @@ -1265,7 +1265,7 @@ class ConfigSubstitutionTest extends TestUtils { // it's the value of a child field of bar, not bar // itself; so we use bar's current value, rather than // looking back in the merge stack - val obj = parseObject(""" + val obj = parseObject(""" bar : { foo : 42, baz : ${bar.foo} } @@ -1279,7 +1279,7 @@ class ConfigSubstitutionTest extends TestUtils { def substInChildFieldNotASelfReference2(): Unit = { // checking that having bar.foo later in the stack // doesn't break the behavior - val obj = parseObject(""" + val obj = parseObject(""" bar : { foo : 42, baz : ${bar.foo} } @@ -1294,7 +1294,7 @@ class ConfigSubstitutionTest extends TestUtils { def substInChildFieldNotASelfReference3(): Unit = { // checking that having bar.foo earlier in the merge // stack doesn't break the behavior. - val obj = parseObject(""" + val obj = parseObject(""" bar : { foo : 43 } bar : { foo : 42, baz : ${bar.foo} @@ -1309,7 +1309,7 @@ class ConfigSubstitutionTest extends TestUtils { def substInChildFieldNotASelfReference4(): Unit = { // checking that having bar set to non-object earlier // doesn't break the behavior. - val obj = parseObject(""" + val obj = parseObject(""" bar : 101 bar : { foo : 42, baz : ${bar.foo} @@ -1324,7 +1324,7 @@ class ConfigSubstitutionTest extends TestUtils { def substInChildFieldNotASelfReference5(): Unit = { // checking that having bar set to unresolved array earlier // doesn't break the behavior. - val obj = parseObject(""" + val obj = parseObject(""" x : 0 bar : [ ${x}, 1, 2, 3 ] bar : { foo : 42, @@ -1338,7 +1338,7 @@ class ConfigSubstitutionTest extends TestUtils { @Test def mutuallyReferringNotASelfReference(): Unit = { - val obj = parseObject(""" + val obj = parseObject(""" // bar.a should end up as 4 bar : { a : ${foo.d}, b : 1 } bar.b = 3 @@ -1353,14 +1353,14 @@ class ConfigSubstitutionTest extends TestUtils { @Test def substSelfReferenceMultipleTimes(): Unit = { - val obj = parseObject("""a=1,a=${a},a=${a},a=${a}""") + val obj = parseObject("""a=1,a=${a},a=${a},a=${a}""") val resolved = resolve(obj) assertEquals(1, resolved.getInt("a")) } @Test def substSelfReferenceInConcatMultipleTimes(): Unit = { - val obj = parseObject("""a=1,a=${a}x,a=${a}y,a=${a}z""") + val obj = parseObject("""a=1,a=${a}x,a=${a}y,a=${a}z""") val resolved = resolve(obj) assertEquals("1xyz", resolved.getString("a")) } @@ -1396,7 +1396,7 @@ class ConfigSubstitutionTest extends TestUtils { // this is testing that we can still refer to another // field in the same object, even though we are overriding // an earlier object. - val obj = parseObject("""a={ x : 42, y : ${a.x} }""") + val obj = parseObject("""a={ x : 42, y : ${a.x} }""") val resolved = resolve(obj) assertEquals( parseObject("{ x : 42, y : 42 }"), @@ -1405,7 +1405,7 @@ class ConfigSubstitutionTest extends TestUtils { // this is expected because if adding "a=1" here affects the outcome, // it would be flat-out bizarre. - val obj2 = parseObject("""a=1, a={ x : 42, y : ${a.x} }""") + val obj2 = parseObject("""a=1, a={ x : 42, y : ${a.x} }""") val resolved2 = resolve(obj2) assertEquals( parseObject("{ x : 42, y : 42 }"), diff --git a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfigTest.scala b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfigTest.scala index be3012d8..5636c27c 100644 --- a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfigTest.scala +++ b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfigTest.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011 Typesafe Inc. + * Copyright (C) 2011 Typesafe Inc. */ package org.ekrich.config.impl @@ -72,14 +72,14 @@ class ConfigTest extends TestUtils { case n => { val leftSplits = for { i <- (1 until n) - pair = objects.splitAt(i) - first = pair._1.reduceLeft(_.withFallback(_)) + pair = objects.splitAt(i) + first = pair._1.reduceLeft(_.withFallback(_)) second = pair._2.reduceLeft(_.withFallback(_)) } yield first.withFallback(second) val rightSplits = for { i <- (1 until n) - pair = objects.splitAt(i) - first = pair._1.reduceRight(_.withFallback(_)) + pair = objects.splitAt(i) + first = pair._1.reduceRight(_.withFallback(_)) second = pair._2.reduceRight(_.withFallback(_)) } yield first.withFallback(second) leftSplits.iterator ++ rightSplits.iterator @@ -106,8 +106,8 @@ class ConfigTest extends TestUtils { @Test def mergeTrivial(): Unit = { - val obj1 = parseObject("""{ "a" : 1 }""") - val obj2 = parseObject("""{ "b" : 2 }""") + val obj1 = parseObject("""{ "a" : 1 }""") + val obj2 = parseObject("""{ "b" : 2 }""") val merged = merge(obj1, obj2).toConfig assertEquals(1, merged.getInt("a")) @@ -124,7 +124,7 @@ class ConfigTest extends TestUtils { @Test def mergeOne(): Unit = { - val obj1 = parseObject("""{ "a" : 1 }""") + val obj1 = parseObject("""{ "a" : 1 }""") val merged = merge(obj1).toConfig assertEquals(1, merged.getInt("a")) @@ -133,8 +133,8 @@ class ConfigTest extends TestUtils { @Test def mergeOverride(): Unit = { - val obj1 = parseObject("""{ "a" : 1 }""") - val obj2 = parseObject("""{ "a" : 2 }""") + val obj1 = parseObject("""{ "a" : 1 }""") + val obj2 = parseObject("""{ "a" : 2 }""") val merged = merge(obj1, obj2).toConfig assertEquals(1, merged.getInt("a")) @@ -181,8 +181,8 @@ class ConfigTest extends TestUtils { @Test def mergeNested(): Unit = { - val obj1 = parseObject("""{ "root" : { "a" : 1, "z" : 101 } }""") - val obj2 = parseObject("""{ "root" : { "b" : 2, "z" : 102 } }""") + val obj1 = parseObject("""{ "root" : { "a" : 1, "z" : 101 } }""") + val obj2 = parseObject("""{ "root" : { "b" : 2, "z" : 102 } }""") val merged = merge(obj1, obj2).toConfig assertEquals(1, merged.getInt("root.a")) @@ -194,8 +194,8 @@ class ConfigTest extends TestUtils { @Test def mergeWithEmpty(): Unit = { - val obj1 = parseObject("""{ "a" : 1 }""") - val obj2 = parseObject("""{ }""") + val obj1 = parseObject("""{ "a" : 1 }""") + val obj2 = parseObject("""{ }""") val merged = merge(obj1, obj2).toConfig assertEquals(1, merged.getInt("a")) @@ -209,8 +209,8 @@ class ConfigTest extends TestUtils { @Test def mergeOverrideObjectAndPrimitive(): Unit = { - val obj1 = parseObject("""{ "a" : 1 }""") - val obj2 = parseObject("""{ "a" : { "b" : 42 } }""") + val obj1 = parseObject("""{ "a" : 1 }""") + val obj2 = parseObject("""{ "a" : { "b" : 42 } }""") val merged = merge(obj1, obj2).toConfig assertEquals(1, merged.getInt("a")) @@ -226,8 +226,8 @@ class ConfigTest extends TestUtils { @Test def mergeOverrideObjectAndSubstitution(): Unit = { - val obj1 = parseObject("""{ "a" : 1 }""") - val obj2 = parseObject("""{ "a" : { "b" : ${c} }, "c" : 42 }""") + val obj1 = parseObject("""{ "a" : 1 }""") + val obj2 = parseObject("""{ "a" : { "b" : ${c} }, "c" : 42 }""") val merged = merge(obj1, obj2).toConfig assertEquals(1, merged.getInt("a")) @@ -376,8 +376,8 @@ class ConfigTest extends TestUtils { ) val fixUpCycle = parseObject(""" { "a" : { "b" : { "c" : 57 } } } """) - val merged = mergeUnresolved(fixUpCycle, cycleObject) - val v = resolveNoSystem(subst("foo"), merged) + val merged = mergeUnresolved(fixUpCycle, cycleObject) + val v = resolveNoSystem(subst("foo"), merged) assertEquals(intValue(57), v) } @@ -403,7 +403,7 @@ class ConfigTest extends TestUtils { } // TODO: it would be nicer if the above threw BadValue with an // explanation about the cycle. - //assertTrue(e2.getMessage().contains("cycle")) + // assertTrue(e2.getMessage().contains("cycle")) } @Test @@ -494,9 +494,9 @@ class ConfigTest extends TestUtils { // can return a new object anytime it likes) but want to be sure we do the // optimizations. - val empty = SimpleConfigObject.empty(null) - val primitive = intValue(42) - val emptyIgnoringFallbacks = empty.withFallback(primitive) + val empty = SimpleConfigObject.empty(null) + val primitive = intValue(42) + val emptyIgnoringFallbacks = empty.withFallback(primitive) val nonEmptyIgnoringFallbacks = nonEmpty.withFallback(primitive) assertEquals(false, empty.ignoresFallbacks) @@ -563,8 +563,8 @@ class ConfigTest extends TestUtils { @Test def testListsWithFallback(): Unit = { - val list1 = ConfigValueFactory.fromIterable(Seq(1, 2, 3).asJava) - val list2 = ConfigValueFactory.fromIterable(Seq(4, 5, 6).asJava) + val list1 = ConfigValueFactory.fromIterable(Seq(1, 2, 3).asJava) + val list2 = ConfigValueFactory.fromIterable(Seq(4, 5, 6).asJava) val merged1 = list1.withFallback(list2) val merged2 = list2.withFallback(list1) assertEquals("lists did not merge 1", list1, merged1) @@ -911,7 +911,7 @@ class ConfigTest extends TestUtils { def assertDurationAsTimeUnit(unit: TimeUnit): Unit = { def ns2unit(l: Long) = unit.convert(l, NANOSECONDS) def ms2unit(l: Long) = unit.convert(l, MILLISECONDS) - def s2unit(i: Int) = unit.convert(i.toLong, SECONDS) + def s2unit(i: Int) = unit.convert(i.toLong, SECONDS) assertEquals(ms2unit(1000L), conf.getDuration("durations.second", unit)) assertEquals(s2unit(1), conf.getDuration("durations.second", unit)) assertEquals( @@ -1012,7 +1012,7 @@ class ConfigTest extends TestUtils { @Test def test01SystemFallbacks(): Unit = { val conf = ConfigFactory.load("test01") - val jv = System.getProperty("java.version") + val jv = System.getProperty("java.version") assertNotNull(jv) assertEquals(jv, conf.getString("system.javaversion")) val home = System.getenv("HOME") @@ -1099,7 +1099,7 @@ class ConfigTest extends TestUtils { // we can't ever test an expected serialization here because it // will have system props in it that vary by test system, // and the ConfigOrigin in there will also vary by test system - val conf = ConfigFactory.load("test01") + val conf = ConfigFactory.load("test01") val confCopy = checkSerializable(conf) } @@ -1313,10 +1313,10 @@ class ConfigTest extends TestUtils { def renderRoundTrip(): Unit = { val allBooleans = true :: false :: Nil val optionsCombos = { - for (formatted <- allBooleans; - originComments <- allBooleans; - comments <- allBooleans; - json <- allBooleans) + for (formatted <- allBooleans; + originComments <- allBooleans; + comments <- allBooleans; + json <- allBooleans) yield ConfigRenderOptions.defaults .setFormatted(formatted) .setOriginComments(originComments) @@ -1326,7 +1326,7 @@ class ConfigTest extends TestUtils { for (i <- 1 to 10) { val numString = i.toString - val name = "/test" + { if (numString.size == 1) "0" else "" } + numString + val name = "/test" + { if (numString.size == 1) "0" else "" } + numString val conf = ConfigFactory.parseResourcesAnySyntax( classOf[ConfigTest], name, @@ -1334,8 +1334,8 @@ class ConfigTest extends TestUtils { ) for (renderOptions <- optionsCombos) { val unresolvedRender = conf.root.render(renderOptions) - val resolved = conf.resolve() - val resolvedRender = resolved.root.render(renderOptions) + val resolved = conf.resolve() + val resolvedRender = resolved.root.render(renderOptions) val unresolvedParsed = ConfigFactory.parseString( unresolvedRender, ConfigParseOptions.defaults @@ -1398,7 +1398,7 @@ class ConfigTest extends TestUtils { def serializeRoundTrip(): Unit = { for (i <- 1 to 10) { val numString = i.toString - val name = "/test" + { if (numString.size == 1) "0" else "" } + numString + val name = "/test" + { if (numString.size == 1) "0" else "" } + numString val conf = ConfigFactory.parseResourcesAnySyntax( classOf[ConfigTest], name, @@ -1508,7 +1508,7 @@ class ConfigTest extends TestUtils { // the a=42 is present here to be sure it gets ignored when we resolveWith val unresolved = ConfigFactory.parseString("foo = ${a}, a = 42") assertEquals(42, unresolved.resolve().getInt("foo")) - val source = ConfigFactory.parseString("a = 43") + val source = ConfigFactory.parseString("a = 43") val resolved = unresolved.resolveWith(source) assertEquals(43, resolved.getInt("foo")) } diff --git a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfigValueTest.scala b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfigValueTest.scala index d46620f5..8b9eba65 100644 --- a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfigValueTest.scala +++ b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfigValueTest.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011 Typesafe Inc. + * Copyright (C) 2011 Typesafe Inc. */ package org.ekrich.config.impl @@ -22,9 +22,9 @@ import FileUtils._ class ConfigValueTest extends TestUtils { @Test def configOriginEquality(): Unit = { - val a = SimpleConfigOrigin.newSimple("foo") + val a = SimpleConfigOrigin.newSimple("foo") val sameAsA = SimpleConfigOrigin.newSimple("foo") - val b = SimpleConfigOrigin.newSimple("bar") + val b = SimpleConfigOrigin.newSimple("bar") checkEqualObjects(a, a) checkEqualObjects(a, sameAsA) @@ -39,9 +39,9 @@ class ConfigValueTest extends TestUtils { @Test def configIntEquality(): Unit = { - val a = intValue(42) + val a = intValue(42) val sameAsA = intValue(42) - val b = intValue(43) + val b = intValue(43) checkEqualObjects(a, a) checkEqualObjects(a, sameAsA) @@ -62,9 +62,9 @@ class ConfigValueTest extends TestUtils { @Test def configLongEquality(): Unit = { - val a = longValue(Integer.MAX_VALUE + 42L) + val a = longValue(Integer.MAX_VALUE + 42L) val sameAsA = longValue(Integer.MAX_VALUE + 42L) - val b = longValue(Integer.MAX_VALUE + 43L) + val b = longValue(Integer.MAX_VALUE + 43L) checkEqualObjects(a, a) checkEqualObjects(a, sameAsA) @@ -86,10 +86,10 @@ class ConfigValueTest extends TestUtils { @Test def configIntAndLongEquality(): Unit = { - val longVal = longValue(42L) - val intValue = longValue(42) + val longVal = longValue(42L) + val intValue = longValue(42) val longValueB = longValue(43L) - val intValueB = longValue(43) + val intValueB = longValue(43) checkEqualObjects(intValue, longVal) checkEqualObjects(intValueB, longValueB) @@ -99,9 +99,9 @@ class ConfigValueTest extends TestUtils { @Test def configDoubleEquality(): Unit = { - val a = doubleValue(3.14) + val a = doubleValue(3.14) val sameAsA = doubleValue(3.14) - val b = doubleValue(4.14) + val b = doubleValue(4.14) checkEqualObjects(a, a) checkEqualObjects(a, sameAsA) @@ -123,10 +123,10 @@ class ConfigValueTest extends TestUtils { @Test def configIntAndDoubleEquality(): Unit = { - val doubleVal = doubleValue(3.0) - val intValue = longValue(3) + val doubleVal = doubleValue(3.0) + val intValue = longValue(3) val doubleValueB = doubleValue(4.0) - val intValueB = doubleValue(4) + val intValueB = doubleValue(4) checkEqualObjects(intValue, doubleVal) checkEqualObjects(intValueB, doubleValueB) @@ -183,15 +183,15 @@ class ConfigValueTest extends TestUtils { @Test def configObjectEquality(): Unit = { - val aMap = configMap("a" -> 1, "b" -> 2, "c" -> 3) + val aMap = configMap("a" -> 1, "b" -> 2, "c" -> 3) val sameAsAMap = configMap("a" -> 1, "b" -> 2, "c" -> 3) - val bMap = configMap("a" -> 3, "b" -> 4, "c" -> 5) + val bMap = configMap("a" -> 3, "b" -> 4, "c" -> 5) // different keys is a different case in the equals implementation - val cMap = configMap("x" -> 3, "y" -> 4, "z" -> 5) - val a = new SimpleConfigObject(fakeOrigin(), aMap) + val cMap = configMap("x" -> 3, "y" -> 4, "z" -> 5) + val a = new SimpleConfigObject(fakeOrigin(), aMap) val sameAsA = new SimpleConfigObject(fakeOrigin(), sameAsAMap) - val b = new SimpleConfigObject(fakeOrigin(), bMap) - val c = new SimpleConfigObject(fakeOrigin(), cMap) + val b = new SimpleConfigObject(fakeOrigin(), bMap) + val c = new SimpleConfigObject(fakeOrigin(), cMap) checkEqualObjects(a, a) checkEqualObjects(a, sameAsA) @@ -224,8 +224,8 @@ class ConfigValueTest extends TestUtils { "0001_b050000000101040000000802000000020001_2010103000000010001_x" val aMap = configMap("a" -> 1, "b" -> 2, "c" -> 3) - val a = new SimpleConfigObject(fakeOrigin(), aMap) - val b = checkSerializableOldFormat(expectedSerialization, a) + val a = new SimpleConfigObject(fakeOrigin(), aMap) + val b = checkSerializableOldFormat(expectedSerialization, a) assertEquals(1, b.toConfig.getInt("a")) // check that deserialized Config and ConfigObject refer to each other assertTrue(b.toConfig.root eq b) @@ -241,8 +241,8 @@ class ConfigValueTest extends TestUtils { "0001_b050000000101040000000802000000020001_2010103000000010101_x" val aMap = configMap("a" -> 1, "b" -> 2, "c" -> 3) - val a = new SimpleConfigObject(fakeOrigin(), aMap) - val b = checkSerializableOldFormat(expectedSerialization, a.toConfig) + val a = new SimpleConfigObject(fakeOrigin(), aMap) + val b = checkSerializableOldFormat(expectedSerialization, a.toConfig) assertEquals(1, b.getInt("a")) // check that deserialized Config and ConfigObject refer to each other assertTrue(b.root.toConfig eq b) @@ -258,8 +258,8 @@ class ConfigValueTest extends TestUtils { "0001_c050000000101040000000802000000030001_3010103000000010001_x" val aMap = configMap("a" -> 1, "b" -> 2, "c" -> 3) - val a = new SimpleConfigObject(fakeOrigin(), aMap) - val b = checkSerializable(expectedSerialization, a) + val a = new SimpleConfigObject(fakeOrigin(), aMap) + val b = checkSerializable(expectedSerialization, a) assertEquals(1, b.toConfig.getInt("a")) // check that deserialized Config and ConfigObject refer to each other assertTrue(b.toConfig.root eq b) @@ -275,37 +275,41 @@ class ConfigValueTest extends TestUtils { "0001_c050000000101040000000802000000030001_3010103000000010101_x" val aMap = configMap("a" -> 1, "b" -> 2, "c" -> 3) - val a = new SimpleConfigObject(fakeOrigin(), aMap) - val b = checkSerializable(expectedSerialization, a.toConfig) + val a = new SimpleConfigObject(fakeOrigin(), aMap) + val b = checkSerializable(expectedSerialization, a.toConfig) assertEquals(1, b.getInt("a")) // check that deserialized Config and ConfigObject refer to each other assertTrue(b.root.toConfig eq b) } /** - * Reproduces the issue #461. - *

- * We use a custom de-/serializer that encodes String objects in a JDK-incompatible way. Encoding used here - * is rather simplistic: a long indicating the length in bytes (JDK uses a variable length integer) followed - * by the string's bytes. Running this test with the original SerializedConfigValue.readExternal() - * implementation results in an EOFException thrown during deserialization. + * Reproduces the issue: + * + * #461. + * + *

We use a custom de-/serializer that encodes String objects in a + * JDK-incompatible way. Encoding used here is rather simplistic: a long + * indicating the length in bytes (JDK uses a variable length integer) + * followed by the string's bytes. Running this test with the original + * SerializedConfigValue.readExternal() implementation results in an + * EOFException thrown during deserialization. */ @Test def configConfigCustomSerializable(): Unit = { - val aMap = configMap("a" -> 1, "b" -> 2, "c" -> 3) + val aMap = configMap("a" -> 1, "b" -> 2, "c" -> 3) val expected = new SimpleConfigObject(fakeOrigin(), aMap).toConfig - val actual = checkSerializableWithCustomSerializer(expected) + val actual = checkSerializableWithCustomSerializer(expected) assertEquals(expected, actual) } @Test def configListEquality(): Unit = { - val aScalaSeq = Seq(1, 2, 3) map { intValue(_): AbstractConfigValue } - val aList = new SimpleConfigList(fakeOrigin(), aScalaSeq.asJava) + val aScalaSeq = Seq(1, 2, 3) map { intValue(_): AbstractConfigValue } + val aList = new SimpleConfigList(fakeOrigin(), aScalaSeq.asJava) val sameAsAList = new SimpleConfigList(fakeOrigin(), aScalaSeq.asJava) - val bScalaSeq = Seq(4, 5, 6) map { intValue(_): AbstractConfigValue } - val bList = new SimpleConfigList(fakeOrigin(), bScalaSeq.asJava) + val bScalaSeq = Seq(4, 5, 6) map { intValue(_): AbstractConfigValue } + val bList = new SimpleConfigList(fakeOrigin(), bScalaSeq.asJava) checkEqualObjects(aList, aList) checkEqualObjects(aList, sameAsAList) @@ -321,17 +325,17 @@ class ConfigValueTest extends TestUtils { "040000000802000000010001_101050000000101040000000802000000020001_201050000000101" + "040000000802000000030001_3010103000000010001_x" val aScalaSeq = Seq(1, 2, 3) map { intValue(_): AbstractConfigValue } - val aList = new SimpleConfigList(fakeOrigin(), aScalaSeq.asJava) - val bList = checkSerializable(expectedSerialization, aList) + val aList = new SimpleConfigList(fakeOrigin(), aScalaSeq.asJava) + val bList = checkSerializable(expectedSerialization, aList) assertEquals(1, bList.get(0).unwrapped) } @Test def configReferenceEquality(): Unit = { - val a = subst("foo") + val a = subst("foo") val sameAsA = subst("foo") - val b = subst("bar") - val c = subst("foo", optional = true) + val b = subst("bar") + val c = subst("foo", optional = true) assertTrue("wrong type " + a, a.isInstanceOf[ConfigReference]) assertTrue("wrong type " + b, b.isInstanceOf[ConfigReference]) @@ -352,10 +356,10 @@ class ConfigValueTest extends TestUtils { @Test def configConcatenationEquality(): Unit = { - val a = substInString("foo") + val a = substInString("foo") val sameAsA = substInString("foo") - val b = substInString("bar") - val c = substInString("foo", optional = true) + val b = substInString("bar") + val c = substInString("foo", optional = true) assertTrue("wrong type " + a, a.isInstanceOf[ConfigConcatenation]) assertTrue("wrong type " + b, b.isInstanceOf[ConfigConcatenation]) @@ -410,8 +414,8 @@ class ConfigValueTest extends TestUtils { @Test def configDelayedMergeObjectEquality(): Unit = { val empty = SimpleConfigObject.empty() - val s1 = subst("foo") - val s2 = subst("bar") + val s1 = subst("foo") + val s2 = subst("bar") val a = new ConfigDelayedMergeObject( fakeOrigin(), List[AbstractConfigValue](empty, s1, s2).asJava @@ -433,8 +437,8 @@ class ConfigValueTest extends TestUtils { @Test def configDelayedMergeObjectNotSerializable(): Unit = { val empty = SimpleConfigObject.empty() - val s1 = subst("foo") - val s2 = subst("bar") + val s1 = subst("foo") + val s2 = subst("bar") val a = new ConfigDelayedMergeObject( fakeOrigin(), List[AbstractConfigValue](empty, s1, s2).asJava @@ -567,7 +571,7 @@ class ConfigValueTest extends TestUtils { assertEquals(1, l.lastIndexOf(scalaSeq(1))) val li = l.listIterator() - var i = 0 + var i = 0 while (li.hasNext()) { assertEquals(i > 0, li.hasPrevious()) assertEquals(i, li.nextIndex()) @@ -665,9 +669,12 @@ class ConfigValueTest extends TestUtils { val obj = parseConfig( "{ a : " + a + ", b : " + b + ", c : " + c + ", d : " + d + "}" ) - assertEquals(Seq(a, b, c, d), Seq("a", "b", "c", "d") map { - obj.getString(_) - }) + assertEquals( + Seq(a, b, c, d), + Seq("a", "b", "c", "d") map { + obj.getString(_) + } + ) // make sure it still works if we're doing concatenation val obj2 = parseConfig( @@ -747,7 +754,7 @@ class ConfigValueTest extends TestUtils { @Test def newNumberWorks(): Unit = { - def nL(v: Long) = ConfigNumber.newNumber(fakeOrigin(), v, null) + def nL(v: Long) = ConfigNumber.newNumber(fakeOrigin(), v, null) def nD(v: Double) = ConfigNumber.newNumber(fakeOrigin(), v, null) // the general idea is that the destination type should depend @@ -777,9 +784,9 @@ class ConfigValueTest extends TestUtils { @Test def configOriginFileAndLine(): Unit = { - val hasFilename = SimpleConfigOrigin.newFile("foo") - val noFilename = SimpleConfigOrigin.newSimple("bar") - val filenameWithLine = hasFilename.withLineNumber(3) + val hasFilename = SimpleConfigOrigin.newFile("foo") + val noFilename = SimpleConfigOrigin.newSimple("bar") + val filenameWithLine = hasFilename.withLineNumber(3) val noFilenameWithLine = noFilename.withLineNumber(4) assertEquals("foo", hasFilename.filename) @@ -802,7 +809,7 @@ class ConfigValueTest extends TestUtils { // the filename is made absolute when converting to url assertTrue(hasFilename.url.toExternalForm.contains("foo")) assertNull(noFilename.url) - val rootFile = SimpleConfigOrigin.newFile("/baz") + val rootFile = SimpleConfigOrigin.newFile("/baz") val rootFileURL = if (isWindows) s"file:/$userDrive/baz" else "file:/baz" assertEquals(rootFileURL, rootFile.url.toExternalForm) @@ -944,7 +951,7 @@ class ConfigValueTest extends TestUtils { @Test def atPathWorksOneElement(): Unit = { - val v = ConfigValueFactory.fromAnyRef(42: Integer) + val v = ConfigValueFactory.fromAnyRef(42: Integer) val config = v.atPath("a") assertEquals(parseConfig("a=42"), config) assertTrue(config.getValue("a") eq v) @@ -953,7 +960,7 @@ class ConfigValueTest extends TestUtils { @Test def atPathWorksTwoElements(): Unit = { - val v = ConfigValueFactory.fromAnyRef(42: Integer) + val v = ConfigValueFactory.fromAnyRef(42: Integer) val config = v.atPath("a.b") assertEquals(parseConfig("a.b=42"), config) assertTrue(config.getValue("a.b") eq v) @@ -962,7 +969,7 @@ class ConfigValueTest extends TestUtils { @Test def atPathWorksFourElements(): Unit = { - val v = ConfigValueFactory.fromAnyRef(42: Integer) + val v = ConfigValueFactory.fromAnyRef(42: Integer) val config = v.atPath("a.b.c.d") assertEquals(parseConfig("a.b.c.d=42"), config) assertTrue(config.getValue("a.b.c.d") eq v) @@ -971,7 +978,7 @@ class ConfigValueTest extends TestUtils { @Test def atKeyWorks(): Unit = { - val v = ConfigValueFactory.fromAnyRef(42: Integer) + val v = ConfigValueFactory.fromAnyRef(42: Integer) val config = v.atKey("a") assertEquals(parseConfig("a=42"), config) assertTrue(config.getValue("a") eq v) @@ -980,7 +987,7 @@ class ConfigValueTest extends TestUtils { @Test def withValueDepth1FromEmpty(): Unit = { - val v = ConfigValueFactory.fromAnyRef(42: Integer) + val v = ConfigValueFactory.fromAnyRef(42: Integer) val config = ConfigFactory.empty().withValue("a", v) assertEquals(parseConfig("a=42"), config) assertTrue(config.getValue("a") eq v) @@ -988,7 +995,7 @@ class ConfigValueTest extends TestUtils { @Test def withValueDepth2FromEmpty(): Unit = { - val v = ConfigValueFactory.fromAnyRef(42: Integer) + val v = ConfigValueFactory.fromAnyRef(42: Integer) val config = ConfigFactory.empty().withValue("a.b", v) assertEquals(parseConfig("a.b=42"), config) assertTrue(config.getValue("a.b") eq v) @@ -996,7 +1003,7 @@ class ConfigValueTest extends TestUtils { @Test def withValueDepth3FromEmpty(): Unit = { - val v = ConfigValueFactory.fromAnyRef(42: Integer) + val v = ConfigValueFactory.fromAnyRef(42: Integer) val config = ConfigFactory.empty().withValue("a.b.c", v) assertEquals(parseConfig("a.b.c=42"), config) assertTrue(config.getValue("a.b.c") eq v) @@ -1004,8 +1011,8 @@ class ConfigValueTest extends TestUtils { @Test def withValueDepth1OverwritesExisting(): Unit = { - val v = ConfigValueFactory.fromAnyRef(47: Integer) - val old = v.atPath("a") + val v = ConfigValueFactory.fromAnyRef(47: Integer) + val old = v.atPath("a") val config = old.withValue("a", ConfigValueFactory.fromAnyRef(42: Integer)) assertEquals(parseConfig("a=42"), config) assertEquals(42, config.getInt("a")) @@ -1013,7 +1020,7 @@ class ConfigValueTest extends TestUtils { @Test def withValueDepth2OverwritesExisting(): Unit = { - val v = ConfigValueFactory.fromAnyRef(47: Integer) + val v = ConfigValueFactory.fromAnyRef(47: Integer) val old = v.atPath("a.b") val config = old.withValue("a.b", ConfigValueFactory.fromAnyRef(42: Integer)) @@ -1023,7 +1030,7 @@ class ConfigValueTest extends TestUtils { @Test def withValueInsideExistingObject(): Unit = { - val v = ConfigValueFactory.fromAnyRef(47: Integer) + val v = ConfigValueFactory.fromAnyRef(47: Integer) val old = v.atPath("a.c") val config = old.withValue("a.b", ConfigValueFactory.fromAnyRef(42: Integer)) @@ -1080,7 +1087,7 @@ class ConfigValueTest extends TestUtils { bases .sliding(4) .map({ seq => (seq.head, seq.tail.tail.tail.head) }) - val withFlipped = combos ++ combos.map(_.swap) + val withFlipped = combos ++ combos.map(_.swap) val withDuplicate = withFlipped ++ withFlipped.map(p => (p._1, p._1)) val values = withDuplicate.flatMap({ combo => Seq( @@ -1102,7 +1109,7 @@ class ConfigValueTest extends TestUtils { ) ) }) - def top(v: SimpleConfigList) = v.origin + def top(v: SimpleConfigList) = v.origin def middle(v: SimpleConfigList) = v.get(0).origin def bottom(v: SimpleConfigList) = if (v.get(0).isInstanceOf[ConfigList]) @@ -1110,7 +1117,7 @@ class ConfigValueTest extends TestUtils { else None - //System.err.println("values=\n " + values.map(v => top(v).description + ", " + middle(v).description + ", " + bottom(v).map(_.description)).mkString("\n ")) + // System.err.println("values=\n " + values.map(v => top(v).description + ", " + middle(v).description + ", " + bottom(v).map(_.description)).mkString("\n ")) for (v <- values) { val deserialized = checkSerializable(v) // double-check that checkSerializable verified the origins @@ -1130,7 +1137,7 @@ class ConfigValueTest extends TestUtils { SimpleConfigOrigin.newSimple("\n5\n6\n7\n"), java.util.Collections.singletonList(v.asInstanceOf[AbstractConfigValue]) ) - val conf = ConfigFactory.empty().withValue("bar", list) + val conf = ConfigFactory.empty().withValue("bar", list) val rendered = conf.root.render def assertHas(s: String): Unit = assertTrue(s"has ${s.replace("\n", "\\n")} in it", rendered.contains(s)) @@ -1148,7 +1155,7 @@ class ConfigValueTest extends TestUtils { @Test def renderSorting(): Unit = { - val config = parseConfig("""0=a,1=b,2=c,3=d,10=e,20=f,30=g""") + val config = parseConfig("""0=a,1=b,2=c,3=d,10=e,20=f,30=g""") val rendered = config.root.render(ConfigRenderOptions.concise) assertEquals( """{"0":"a","1":"b","2":"c","3":"d","10":"e","20":"f","30":"g"}""", diff --git a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/EquivalentsTest.scala b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/EquivalentsTest.scala index 7be486f3..89bcb223 100644 --- a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/EquivalentsTest.scala +++ b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/EquivalentsTest.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011 Typesafe Inc. + * Copyright (C) 2011 Typesafe Inc. */ package org.ekrich.config.impl @@ -15,7 +15,7 @@ import FileUtils._ class EquivalentsTest extends TestUtils { private def equivDirs() = { val rawEquivs = resourceDir.listFiles() - val equivs = rawEquivs.filter({ f => f.getName().startsWith("equiv") }) + val equivs = rawEquivs.filter({ f => f.getName().startsWith("equiv") }) equivs } @@ -53,7 +53,7 @@ class EquivalentsTest extends TestUtils { // to be a test, but not sure how to convince junit to do that. @Test def testEquivalents(): Unit = { - var dirCount = 0 + var dirCount = 0 var fileCount = 0 for (equiv <- equivDirs()) { dirCount += 1 diff --git a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/FileUtils.scala b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/FileUtils.scala index d37aa0aa..0257d730 100644 --- a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/FileUtils.scala +++ b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/FileUtils.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011 Typesafe Inc. + * Copyright (C) 2011 Typesafe Inc. */ package org.ekrich.config.impl @@ -7,11 +7,11 @@ import java.io.File import java.util.Locale /** - * Extracted from TestUtils as they contain - * File and Path and are not useful on Scala.js + * Extracted from TestUtils as they contain File and Path and are not useful on + * Scala.js * - * Note: Some functions may only be used in this file so they - * could be made private. + * Note: Some functions may only be used in this file so they could be made + * private. */ object FileUtils { // Some functions duplicated in TestUtils diff --git a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/HttpTest.scala b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/HttpTest.scala index 43556f94..a78d54b8 100644 --- a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/HttpTest.scala +++ b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/HttpTest.scala @@ -14,11 +14,11 @@ class HttpTest extends TestUtils { private def foreachSyntax(body: Option[ConfigSyntax] => Unit): Unit = { for (syntax <- Seq( - Some(ConfigSyntax.JSON), - Some(ConfigSyntax.CONF), - Some(ConfigSyntax.PROPERTIES), - None - )) + Some(ConfigSyntax.JSON), + Some(ConfigSyntax.CONF), + Some(ConfigSyntax.PROPERTIES), + None + )) body(syntax) } @@ -113,9 +113,9 @@ class HttpTest extends TestUtils { object HttpTest { import ToyHttp.{Request, Response} - final val jsonContentType = "application/json" + final val jsonContentType = "application/json" final val propertiesContentType = "text/x-java-properties" - final val hoconContentType = "application/hocon" + final val hoconContentType = "application/hocon" private var server: Option[ToyHttp] = None @@ -160,10 +160,14 @@ object HttpTest { // currently, a suffix-less include like this will cause // us to search for foo.conf, foo.json, foo.properties, but // not load plain foo. - Response(200, hoconContentType, """ + Response( + 200, + hoconContentType, + """ include "foo" include "foo/bar" - """) + """ + ) case "/foo/bar.conf" => Response(200, hoconContentType, "{ bar = 43 }") diff --git a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/JsonTest.scala b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/JsonTest.scala index 4ff5dbe7..6dc05834 100644 --- a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/JsonTest.scala +++ b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/JsonTest.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011 Typesafe Inc. + * Copyright (C) 2011 Typesafe Inc. */ package org.ekrich.config.impl diff --git a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/PublicApiTest.scala b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/PublicApiTest.scala index 574775c6..c81415e0 100644 --- a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/PublicApiTest.scala +++ b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/PublicApiTest.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011 Typesafe Inc. + * Copyright (C) 2011 Typesafe Inc. */ package org.ekrich.config.impl @@ -31,10 +31,10 @@ class PublicApiTest extends TestUtils { def basicLoadAndGet(): Unit = { val conf = ConfigFactory.load("test01") - val a = conf.getInt("ints.fortyTwo") + val a = conf.getInt("ints.fortyTwo") val child = conf.getConfig("ints") - val c = child.getInt("fortyTwo") - val ms = conf.getDuration("durations.halfSecond", TimeUnit.MILLISECONDS) + val c = child.getInt("fortyTwo") + val ms = conf.getDuration("durations.halfSecond", TimeUnit.MILLISECONDS) // should have used system variables if (System.getenv("HOME") != null) @@ -160,9 +160,9 @@ class PublicApiTest extends TestUtils { class WeirdNumber(v: Double) extends java.lang.Number { override def doubleValue = v - override def intValue = v.intValue - override def longValue = v.longValue - override def floatValue = v.floatValue + override def intValue = v.intValue + override def longValue = v.longValue + override def floatValue = v.floatValue } val weirdNumber = new WeirdNumber(5.1) @@ -208,7 +208,7 @@ class PublicApiTest extends TestUtils { @Test def fromJavaCollection(): Unit = { val emptyListValue = Collections.emptyList[AbstractConfigValue] - val aListValue = List(1, 2, 3).map(intValue(_): AbstractConfigValue).asJava + val aListValue = List(1, 2, 3).map(intValue(_): AbstractConfigValue).asJava testFromValue( new SimpleConfigList(fakeOrigin(), emptyListValue), @@ -476,8 +476,8 @@ class PublicApiTest extends TestUtils { sealed trait IncludeKind case object IncludeKindHeuristic extends IncludeKind - case object IncludeKindFile extends IncludeKind - case object IncludeKindURL extends IncludeKind + case object IncludeKindFile extends IncludeKind + case object IncludeKindURL extends IncludeKind case object IncludeKindClasspath extends IncludeKind case class Included(name: String, fallback: ConfigIncluder, kind: IncludeKind) @@ -1065,39 +1065,39 @@ class PublicApiTest extends TestUtils { // check the various overloads that take a loader parameter for (c <- Seq( - ConfigFactory.parseResources(loaderA1, "reference.conf"), - ConfigFactory.parseResourcesAnySyntax(loaderA1, "reference"), - ConfigFactory.parseResources( - loaderA1, - "reference.conf", - ConfigParseOptions.defaults - ), - ConfigFactory.parseResourcesAnySyntax( - loaderA1, - "reference", - ConfigParseOptions.defaults - ), - ConfigFactory.load(loaderA1, "application"), - ConfigFactory.load( - loaderA1, - "application", - ConfigParseOptions.defaults, - ConfigResolveOptions.defaults - ), - ConfigFactory.load( - loaderA1, - "application", - ConfigParseOptions.defaults, - ConfigResolveOptions.defaults - ), - ConfigFactory.load(loaderA1, ConfigFactory.parseString("")), - ConfigFactory.load( - loaderA1, - ConfigFactory.parseString(""), - ConfigResolveOptions.defaults - ), - ConfigFactory.defaultReference(loaderA1) - )) { + ConfigFactory.parseResources(loaderA1, "reference.conf"), + ConfigFactory.parseResourcesAnySyntax(loaderA1, "reference"), + ConfigFactory.parseResources( + loaderA1, + "reference.conf", + ConfigParseOptions.defaults + ), + ConfigFactory.parseResourcesAnySyntax( + loaderA1, + "reference", + ConfigParseOptions.defaults + ), + ConfigFactory.load(loaderA1, "application"), + ConfigFactory.load( + loaderA1, + "application", + ConfigParseOptions.defaults, + ConfigResolveOptions.defaults + ), + ConfigFactory.load( + loaderA1, + "application", + ConfigParseOptions.defaults, + ConfigResolveOptions.defaults + ), + ConfigFactory.load(loaderA1, ConfigFactory.parseString("")), + ConfigFactory.load( + loaderA1, + ConfigFactory.parseString(""), + ConfigResolveOptions.defaults + ), + ConfigFactory.defaultReference(loaderA1) + )) { assertEquals(1, c.getInt("a")) assertFalse("no b", c.hasPath("b")) } @@ -1105,36 +1105,36 @@ class PublicApiTest extends TestUtils { // check providing the loader via ConfigParseOptions val withLoader = ConfigParseOptions.defaults.setClassLoader(loaderA1) for (c <- Seq( - ConfigFactory.parseResources("reference.conf", withLoader), - ConfigFactory.parseResourcesAnySyntax("reference", withLoader), - ConfigFactory - .load("application", withLoader, ConfigResolveOptions.defaults) - )) { + ConfigFactory.parseResources("reference.conf", withLoader), + ConfigFactory.parseResourcesAnySyntax("reference", withLoader), + ConfigFactory + .load("application", withLoader, ConfigResolveOptions.defaults) + )) { assertEquals(1, c.getInt("a")) assertFalse("no b", c.hasPath("b")) } // check not providing the loader for (c <- Seq( - ConfigFactory.parseResources("reference.conf"), - ConfigFactory.parseResourcesAnySyntax("reference"), - ConfigFactory - .parseResources("reference.conf", ConfigParseOptions.defaults), - ConfigFactory - .parseResourcesAnySyntax("reference", ConfigParseOptions.defaults), - ConfigFactory.load("application"), - ConfigFactory.load( - "application", - ConfigParseOptions.defaults, - ConfigResolveOptions.defaults - ), - ConfigFactory.load(ConfigFactory.parseString("")), - ConfigFactory.load( - ConfigFactory.parseString(""), - ConfigResolveOptions.defaults - ), - ConfigFactory.defaultReference() - )) { + ConfigFactory.parseResources("reference.conf"), + ConfigFactory.parseResourcesAnySyntax("reference"), + ConfigFactory + .parseResources("reference.conf", ConfigParseOptions.defaults), + ConfigFactory + .parseResourcesAnySyntax("reference", ConfigParseOptions.defaults), + ConfigFactory.load("application"), + ConfigFactory.load( + "application", + ConfigParseOptions.defaults, + ConfigResolveOptions.defaults + ), + ConfigFactory.load(ConfigFactory.parseString("")), + ConfigFactory.load( + ConfigFactory.parseString(""), + ConfigResolveOptions.defaults + ), + ConfigFactory.defaultReference() + )) { assertFalse("no a", c.hasPath("a")) assertFalse("no b", c.hasPath("b")) } @@ -1142,27 +1142,27 @@ class PublicApiTest extends TestUtils { // check providing the loader via current context withContextClassLoader(loaderA1) { for (c <- Seq( - ConfigFactory.parseResources("reference.conf"), - ConfigFactory.parseResourcesAnySyntax("reference"), - ConfigFactory - .parseResources("reference.conf", ConfigParseOptions.defaults), - ConfigFactory.parseResourcesAnySyntax( - "reference", - ConfigParseOptions.defaults - ), - ConfigFactory.load("application"), - ConfigFactory.load( - "application", - ConfigParseOptions.defaults, - ConfigResolveOptions.defaults - ), - ConfigFactory.load(ConfigFactory.parseString("")), - ConfigFactory.load( - ConfigFactory.parseString(""), - ConfigResolveOptions.defaults - ), - ConfigFactory.defaultReference() - )) { + ConfigFactory.parseResources("reference.conf"), + ConfigFactory.parseResourcesAnySyntax("reference"), + ConfigFactory + .parseResources("reference.conf", ConfigParseOptions.defaults), + ConfigFactory.parseResourcesAnySyntax( + "reference", + ConfigParseOptions.defaults + ), + ConfigFactory.load("application"), + ConfigFactory.load( + "application", + ConfigParseOptions.defaults, + ConfigResolveOptions.defaults + ), + ConfigFactory.load(ConfigFactory.parseString("")), + ConfigFactory.load( + ConfigFactory.parseString(""), + ConfigResolveOptions.defaults + ), + ConfigFactory.defaultReference() + )) { assertEquals(1, c.getInt("a")) assertFalse("no b", c.hasPath("b")) } @@ -1196,27 +1196,27 @@ class PublicApiTest extends TestUtils { // check the various overloads that take a loader parameter for (c <- Seq( - ConfigFactory.parseResources(loaderA1, "application.conf"), - ConfigFactory.parseResourcesAnySyntax(loaderA1, "application"), - ConfigFactory.parseResources( - loaderA1, - "application.conf", - ConfigParseOptions.defaults - ), - ConfigFactory.parseResourcesAnySyntax( - loaderA1, - "application", - ConfigParseOptions.defaults - ), - ConfigFactory.load(loaderA1, "application"), - ConfigFactory.load( - loaderA1, - "application", - ConfigParseOptions.defaults, - ConfigResolveOptions.defaults - ), - ConfigFactory.defaultApplication(loaderA1) - )) { + ConfigFactory.parseResources(loaderA1, "application.conf"), + ConfigFactory.parseResourcesAnySyntax(loaderA1, "application"), + ConfigFactory.parseResources( + loaderA1, + "application.conf", + ConfigParseOptions.defaults + ), + ConfigFactory.parseResourcesAnySyntax( + loaderA1, + "application", + ConfigParseOptions.defaults + ), + ConfigFactory.load(loaderA1, "application"), + ConfigFactory.load( + loaderA1, + "application", + ConfigParseOptions.defaults, + ConfigResolveOptions.defaults + ), + ConfigFactory.defaultApplication(loaderA1) + )) { assertEquals(1, c.getInt("a")) assertFalse("no b", c.hasPath("b")) } @@ -1224,35 +1224,35 @@ class PublicApiTest extends TestUtils { // check providing the loader via ConfigParseOptions val withLoader = ConfigParseOptions.defaults.setClassLoader(loaderA1) for (c <- Seq( - ConfigFactory.parseResources("application.conf", withLoader), - ConfigFactory.parseResourcesAnySyntax("application", withLoader), - ConfigFactory.defaultApplication(withLoader), - ConfigFactory.load(withLoader, ConfigResolveOptions.defaults), - ConfigFactory - .load("application", withLoader, ConfigResolveOptions.defaults) - )) { + ConfigFactory.parseResources("application.conf", withLoader), + ConfigFactory.parseResourcesAnySyntax("application", withLoader), + ConfigFactory.defaultApplication(withLoader), + ConfigFactory.load(withLoader, ConfigResolveOptions.defaults), + ConfigFactory + .load("application", withLoader, ConfigResolveOptions.defaults) + )) { assertEquals(1, c.getInt("a")) assertFalse("no b", c.hasPath("b")) } // check not providing the loader for (c <- Seq( - ConfigFactory.parseResources("application.conf"), - ConfigFactory.parseResourcesAnySyntax("application"), - ConfigFactory - .parseResources("application.conf", ConfigParseOptions.defaults), - ConfigFactory.parseResourcesAnySyntax( - "application", - ConfigParseOptions.defaults - ), - ConfigFactory.load("application"), - ConfigFactory.defaultApplication(), - ConfigFactory.load( - "application", - ConfigParseOptions.defaults, - ConfigResolveOptions.defaults - ) - )) { + ConfigFactory.parseResources("application.conf"), + ConfigFactory.parseResourcesAnySyntax("application"), + ConfigFactory + .parseResources("application.conf", ConfigParseOptions.defaults), + ConfigFactory.parseResourcesAnySyntax( + "application", + ConfigParseOptions.defaults + ), + ConfigFactory.load("application"), + ConfigFactory.defaultApplication(), + ConfigFactory.load( + "application", + ConfigParseOptions.defaults, + ConfigResolveOptions.defaults + ) + )) { assertFalse("no a", c.hasPath("a")) assertFalse("no b", c.hasPath("b")) } @@ -1260,22 +1260,22 @@ class PublicApiTest extends TestUtils { // check providing the loader via current context withContextClassLoader(loaderA1) { for (c <- Seq( - ConfigFactory.parseResources("application.conf"), - ConfigFactory.parseResourcesAnySyntax("application"), - ConfigFactory - .parseResources("application.conf", ConfigParseOptions.defaults), - ConfigFactory.parseResourcesAnySyntax( - "application", - ConfigParseOptions.defaults - ), - ConfigFactory.load("application"), - ConfigFactory.defaultApplication(), - ConfigFactory.load( - "application", - ConfigParseOptions.defaults, - ConfigResolveOptions.defaults - ) - )) { + ConfigFactory.parseResources("application.conf"), + ConfigFactory.parseResourcesAnySyntax("application"), + ConfigFactory + .parseResources("application.conf", ConfigParseOptions.defaults), + ConfigFactory.parseResourcesAnySyntax( + "application", + ConfigParseOptions.defaults + ), + ConfigFactory.load("application"), + ConfigFactory.defaultApplication(), + ConfigFactory.load( + "application", + ConfigParseOptions.defaults, + ConfigResolveOptions.defaults + ) + )) { assertEquals(1, c.getInt("a")) assertFalse("no b", c.hasPath("b")) } @@ -1492,18 +1492,18 @@ class PublicApiTest extends TestUtils { @Test def invalidateCaches(): Unit = { val conf0 = ConfigFactory.load() - val sys0 = ConfigFactory.systemProperties() + val sys0 = ConfigFactory.systemProperties() val conf1 = ConfigFactory.load() - val sys1 = ConfigFactory.systemProperties() + val sys1 = ConfigFactory.systemProperties() ConfigFactory.invalidateCaches() val conf2 = ConfigFactory.load() - val sys2 = ConfigFactory.systemProperties() + val sys2 = ConfigFactory.systemProperties() System.setProperty("invalidateCachesTest", "Hello!") ConfigFactory.invalidateCaches() val conf3 = ConfigFactory.load() - val sys3 = ConfigFactory.systemProperties() + val sys3 = ConfigFactory.systemProperties() val conf4 = ConfigFactory.load() - val sys4 = ConfigFactory.systemProperties() + val sys4 = ConfigFactory.systemProperties() System.clearProperty("invalidateCachesTest") assertTrue("stuff gets cached sys", sys0 eq sys1) @@ -1571,7 +1571,7 @@ class PublicApiTest extends TestUtils { @Test def invalidateReferenceConfig(): Unit = { - val orig = ConfigFactory.defaultReference() + val orig = ConfigFactory.defaultReference() val cached = ConfigFactory.defaultReference() assertTrue("reference config was cached", orig eq cached) @@ -1582,7 +1582,7 @@ class PublicApiTest extends TestUtils { @Test def invalidateFullConfig(): Unit = { - val orig = ConfigFactory.load() + val orig = ConfigFactory.load() val cached = ConfigFactory.load() assertTrue("full config was cached", orig eq cached) @@ -1605,9 +1605,12 @@ class PublicApiTest extends TestUtils { // from https://github.com/lightbend/config/issues/188 withScratchDirectory("heuristicIncludeChecksClasspath") { dir => val f = new File(dir, "foo.conf") - writeFile(f, """ + writeFile( + f, + """ include "onclasspath" -""") +""" + ) val conf = ConfigFactory.parseFile(f) assertEquals(42, conf.getInt("onclasspath")) } @@ -1625,8 +1628,8 @@ include "onclasspath" // treat the filename as relative to the including file // if file() is specified, so `include file("bar-file.conf")` // fails. - //assertEquals("got bar-file.conf", 44, conf.getInt("bar-file")) - //assertEquals("got subdir/baz.conf", 45, conf.getInt("baz")) + // assertEquals("got bar-file.conf", 44, conf.getInt("bar-file")) + // assertEquals("got subdir/baz.conf", 45, conf.getInt("baz")) assertFalse("did not get bar-file.conf", conf.hasPath("bar-file")) assertFalse("did not get subdir/baz.conf", conf.hasPath("baz")) } @@ -1695,6 +1698,6 @@ class TestStrategy extends DefaultConfigLoadingStrategy { object TestStrategy { private var invocations = 0 - def getIncovations() = invocations - def increment() = invocations += 1 + def getIncovations() = invocations + def increment() = invocations += 1 } diff --git a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ToyHttp.scala b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ToyHttp.scala index c074cd81..1f0e488d 100644 --- a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ToyHttp.scala +++ b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ToyHttp.scala @@ -66,7 +66,7 @@ final class ToyHttp(handler: ToyHttp.Request => ToyHttp.Response) { } private def handleRequest(socket: Socket): Unit = { - val in = socket.getInputStream + val in = socket.getInputStream val out = socket.getOutputStream try { // HTTP requests look like this: @@ -75,11 +75,11 @@ final class ToyHttp(handler: ToyHttp.Request => ToyHttp.Response) { // OtherHeader: foo // \r\n val reader = new BufferedReader(new java.io.InputStreamReader(in)) - val path = parsePath(reader) + val path = parsePath(reader) val header = parseHeader(reader) - //System.err.println(s"request path '$path' headers $header") + // System.err.println(s"request path '$path' headers $header") val response = handler(Request(path, header)) - //System.err.println(s"response $response") + // System.err.println(s"response $response") sendResponse(out, response) } finally { in.close() @@ -89,10 +89,10 @@ final class ToyHttp(handler: ToyHttp.Request => ToyHttp.Response) { private def parseHeader(reader: BufferedReader): Map[String, String] = { def readHeaders(sofar: Map[String, String]): Map[String, String] = { - val line = reader.readLine() + val line = reader.readLine() val colon = line.indexOf(':') if (colon > 0) { - val name = line.substring(0, colon).toLowerCase() + val name = line.substring(0, colon).toLowerCase() val value = line.substring(colon + 1).replaceAll("^[ \t]+", "") readHeaders(sofar + (name -> value)) } else { @@ -105,8 +105,8 @@ final class ToyHttp(handler: ToyHttp.Request => ToyHttp.Response) { private def parsePath(reader: BufferedReader): String = { val methodPathProto = reader.readLine().split(" +") - val method = methodPathProto(0) - val path = methodPathProto(1) + val method = methodPathProto(0) + val path = methodPathProto(1) path } @@ -119,8 +119,8 @@ final class ToyHttp(handler: ToyHttp.Request => ToyHttp.Response) { } private def sendResponse(out: OutputStream, response: Response): Unit = { - //val stuff = new java.io.ByteArrayOutputStream - //val writer = new PrintWriter(new OutputStreamWriter(stuff, StandardCharsets.UTF_8)) + // val stuff = new java.io.ByteArrayOutputStream + // val writer = new PrintWriter(new OutputStreamWriter(stuff, StandardCharsets.UTF_8)) val writer = new PrintWriter( new OutputStreamWriter(out, StandardCharsets.UTF_8) ) diff --git a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ValidationTest.scala b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ValidationTest.scala index d0a0693d..ea4ef03f 100644 --- a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ValidationTest.scala +++ b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ValidationTest.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011 Typesafe Inc. + * Copyright (C) 2011 Typesafe Inc. */ package org.ekrich.config.impl @@ -79,7 +79,7 @@ class ValidationTest extends TestUtils { @Test def validationCatchesUnresolved(): Unit = { val reference = parseConfig("""{ a : 2 }""") - val conf = parseConfig("""{ b : ${c}, c : 42 }""") + val conf = parseConfig("""{ b : ${c}, c : 42 }""") val e = intercept[ConfigException.NotResolved] { conf.checkValid(reference) } @@ -92,7 +92,7 @@ class ValidationTest extends TestUtils { @Test def validationCatchesListOverriddenWithNumber(): Unit = { val reference = parseConfig("""{ a : [{},{},{}] }""") - val conf = parseConfig("""{ a : 42 }""") + val conf = parseConfig("""{ a : 42 }""") val e = intercept[ConfigException.ValidationFailed] { conf.checkValid(reference) } @@ -105,7 +105,7 @@ class ValidationTest extends TestUtils { @Test def validationCatchesListOverriddenWithDifferentList(): Unit = { val reference = parseConfig("""{ a : [true,false,false] }""") - val conf = parseConfig("""{ a : [42,43] }""") + val conf = parseConfig("""{ a : [42,43] }""") val e = intercept[ConfigException.ValidationFailed] { conf.checkValid(reference) } @@ -119,7 +119,7 @@ class ValidationTest extends TestUtils { def validationFailedSerializable(): Unit = { // Reusing a previous test case to generate an error val reference = parseConfig("""{ a : [{},{},{}] }""") - val conf = parseConfig("""{ a : 42 }""") + val conf = parseConfig("""{ a : 42 }""") val e = intercept[ConfigException.ValidationFailed] { conf.checkValid(reference) } @@ -132,14 +132,14 @@ class ValidationTest extends TestUtils { @Test def validationAllowsListOverriddenWithSameTypeList(): Unit = { val reference = parseConfig("""{ a : [1,2,3] }""") - val conf = parseConfig("""{ a : [4,5] }""") + val conf = parseConfig("""{ a : [4,5] }""") conf.checkValid(reference) } @Test def validationCatchesListOverriddenWithNoIndexesObject(): Unit = { val reference = parseConfig("""{ a : [1,2,3] }""") - val conf = parseConfig("""{ a : { notANumber: foo } }""") + val conf = parseConfig("""{ a : { notANumber: foo } }""") val e = intercept[ConfigException.ValidationFailed] { conf.checkValid(reference) } @@ -152,7 +152,7 @@ class ValidationTest extends TestUtils { @Test def validationAllowsListOverriddenWithIndexedObject(): Unit = { val reference = parseConfig("""{ a : [a,b,c] }""") - val conf = parseConfig("""{ a : { "0" : x, "1" : y } }""") + val conf = parseConfig("""{ a : { "0" : x, "1" : y } }""") conf.checkValid(reference) assertEquals( "got the sequence from overriding list with indexed object", diff --git a/sconfig/shared/src/main/scala-2/org/ekrich/config/ConfigSyntax.scala b/sconfig/shared/src/main/scala-2/org/ekrich/config/ConfigSyntax.scala index 325ba518..10ed0ac5 100644 --- a/sconfig/shared/src/main/scala-2/org/ekrich/config/ConfigSyntax.scala +++ b/sconfig/shared/src/main/scala-2/org/ekrich/config/ConfigSyntax.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config @@ -7,11 +7,10 @@ import java.{lang => jl} /** * The syntax of a character stream (JSON, HOCON - * aka ".conf", or HOCON aka + * ".conf", or Java properties). - * */ final class ConfigSyntax private (name: String, ordinal: Int) extends jl.Enum[ConfigSyntax](name, ordinal) @@ -19,18 +18,18 @@ final class ConfigSyntax private (name: String, ordinal: Int) object ConfigSyntax { /** - * Pedantically strict JSON format; no - * comments, no unexpected commas, no duplicate keys in the same object. - * Associated with the .json file extension and - * application/json Content-Type. + * Pedantically strict JSON format; no comments, + * no unexpected commas, no duplicate keys in the same object. Associated with + * the .json file extension and application/json + * Content-Type. */ final val JSON = new ConfigSyntax("JSON", 0) /** * The JSON-superset HOCON format. Associated with the .conf file extension - * and application/hocon Content-Type. + * href="https://github.com/lightbend/config/blob/master/HOCON.md">HOCON + * format. Associated with the .conf file extension and + * application/hocon Content-Type. */ final val CONF = new ConfigSyntax("CONF", 1) diff --git a/sconfig/shared/src/main/scala-2/org/ekrich/config/ConfigValueType.scala b/sconfig/shared/src/main/scala-2/org/ekrich/config/ConfigValueType.scala index 31dc22cc..7a63f5f9 100644 --- a/sconfig/shared/src/main/scala-2/org/ekrich/config/ConfigValueType.scala +++ b/sconfig/shared/src/main/scala-2/org/ekrich/config/ConfigValueType.scala @@ -1,24 +1,24 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config import java.{lang => jl} /** - * The type of a configuration value (following the - * [[http://json.org JSON]] type schema). + * The type of a configuration value (following the [[http://json.org JSON]] + * type schema). */ final class ConfigValueType private (name: String, ordinal: Int) extends jl.Enum[ConfigValueType](name, ordinal) object ConfigValueType { - final val OBJECT = new ConfigValueType("OBJECT", 0) - final val LIST = new ConfigValueType("LIST", 1) - final val NUMBER = new ConfigValueType("NUMBER", 2) + final val OBJECT = new ConfigValueType("OBJECT", 0) + final val LIST = new ConfigValueType("LIST", 1) + final val NUMBER = new ConfigValueType("NUMBER", 2) final val BOOLEAN = new ConfigValueType("BOOLEAN", 3) - final val NULL = new ConfigValueType("NULL", 4) - final val STRING = new ConfigValueType("STRING", 5) + final val NULL = new ConfigValueType("NULL", 4) + final val STRING = new ConfigValueType("STRING", 5) private[this] final val _values: Array[ConfigValueType] = Array(OBJECT, LIST, NUMBER, BOOLEAN, NULL, STRING) diff --git a/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/ConfigIncludeKind.scala b/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/ConfigIncludeKind.scala index 2c269ed7..770d3399 100644 --- a/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/ConfigIncludeKind.scala +++ b/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/ConfigIncludeKind.scala @@ -6,8 +6,8 @@ final class ConfigIncludeKind private (name: String, ordinal: Int) extends jl.Enum[ConfigIncludeKind](name, ordinal) object ConfigIncludeKind { - final val URL = new ConfigIncludeKind("URL", 0) - final val FILE = new ConfigIncludeKind("FILE", 1) + final val URL = new ConfigIncludeKind("URL", 0) + final val FILE = new ConfigIncludeKind("FILE", 1) final val CLASSPATH = new ConfigIncludeKind("CLASSPATH", 2) final val HEURISTIC = new ConfigIncludeKind("HEURISTIC", 3) diff --git a/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/FromMapMode.scala b/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/FromMapMode.scala index 8e53b11f..8eac6d88 100644 --- a/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/FromMapMode.scala +++ b/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/FromMapMode.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl @@ -10,7 +10,7 @@ final class FromMapMode private (name: String, ordinal: Int) object FromMapMode { final val KEYS_ARE_PATHS = new FromMapMode("KEYS_ARE_PATHS", 0) - final val KEYS_ARE_KEYS = new FromMapMode("KEYS_ARE_KEYS", 1) + final val KEYS_ARE_KEYS = new FromMapMode("KEYS_ARE_KEYS", 1) private[this] final val _values: Array[FromMapMode] = Array(KEYS_ARE_PATHS, KEYS_ARE_KEYS) diff --git a/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/MemoryUnit.scala b/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/MemoryUnit.scala index d3c0472e..98efe0b6 100644 --- a/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/MemoryUnit.scala +++ b/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/MemoryUnit.scala @@ -15,13 +15,13 @@ private[impl] final class MemoryUnit private[impl] ( } private object MemoryUnit { - final val BYTES = new MemoryUnit("BYTES", 0, "", 1024, 0) - final val KILOBYTES = new MemoryUnit("KILOBYTES", 1, "kilo", 1000, 1) - final val MEGABYTES = new MemoryUnit("MEGABYTES", 2, "mega", 1000, 2) - final val GIGABYTES = new MemoryUnit("GIGABYTES", 3, "giga", 1000, 3) - final val TERABYTES = new MemoryUnit("TERABYTES", 4, "tera", 1000, 4) - final val PETABYTES = new MemoryUnit("PETABYTES", 5, "peta", 1000, 5) - final val EXABYTES = new MemoryUnit("EXABYTES", 6, "exa", 1000, 6) + final val BYTES = new MemoryUnit("BYTES", 0, "", 1024, 0) + final val KILOBYTES = new MemoryUnit("KILOBYTES", 1, "kilo", 1000, 1) + final val MEGABYTES = new MemoryUnit("MEGABYTES", 2, "mega", 1000, 2) + final val GIGABYTES = new MemoryUnit("GIGABYTES", 3, "giga", 1000, 3) + final val TERABYTES = new MemoryUnit("TERABYTES", 4, "tera", 1000, 4) + final val PETABYTES = new MemoryUnit("PETABYTES", 5, "peta", 1000, 5) + final val EXABYTES = new MemoryUnit("EXABYTES", 6, "exa", 1000, 6) final val ZETTABYTES = new MemoryUnit("ZETTABYTES", 7, "zetta", 1000, 7) final val YOTTABYTES = new MemoryUnit("YOTTABYTES", 8, "yotta", 1000, 8) @@ -32,7 +32,7 @@ private object MemoryUnit { final val PEBIBYTES = new MemoryUnit("PEBIBYTES", 13, "pebi", 1024, 5) final val EXBIBYTES = new MemoryUnit("EXBIBYTES", 14, "exbi", 1024, 6) final val ZEBIBYTES = new MemoryUnit("ZEBIBYTES", 15, "zebi", 1024, 7) - final val OBIBYTES = new MemoryUnit("OBIBYTES", 16, "yobi", 1024, 8) + final val OBIBYTES = new MemoryUnit("OBIBYTES", 16, "yobi", 1024, 8) private[this] val _values: Array[MemoryUnit] = Array( @@ -73,16 +73,16 @@ private object MemoryUnit { map.put("B", unit) map.put("", unit) // no unit specified means bytes } else { - val first = unit.prefix.substring(0, 1) + val first = unit.prefix.substring(0, 1) val firstUpper = first.toUpperCase if (unit.powerOf == 1024) { - map.put(first, unit) // 512m - map.put(firstUpper, unit) // 512M - map.put(firstUpper + "i", unit) // 512Mi + map.put(first, unit) // 512m + map.put(firstUpper, unit) // 512M + map.put(firstUpper + "i", unit) // 512Mi map.put(firstUpper + "iB", unit) // 512MiB } else if (unit.powerOf == 1000) { if (unit.power == 1) map.put(first + "B", unit) // 512kB - else map.put(firstUpper + "B", unit) // 512MB + else map.put(firstUpper + "B", unit) // 512MB } else throw new RuntimeException("broken MemoryUnit enum") } } diff --git a/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/OriginType.scala b/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/OriginType.scala index 2cdf02f3..aa8a1a24 100644 --- a/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/OriginType.scala +++ b/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/OriginType.scala @@ -7,9 +7,9 @@ final class OriginType private (name: String, ordinal: Int) extends jl.Enum[OriginType](name, ordinal) object OriginType { - final val GENERIC = new OriginType("GENERIC", 0) - final val FILE = new OriginType("FILE", 1) - final val URL = new OriginType("URL", 2) + final val GENERIC = new OriginType("GENERIC", 0) + final val FILE = new OriginType("FILE", 1) + final val URL = new OriginType("URL", 2) final val RESOURCE = new OriginType("RESOURCE", 3) private[this] final val _values: Array[OriginType] = diff --git a/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/ResolveStatus.scala b/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/ResolveStatus.scala index fdcd93c6..c8dc4cd5 100644 --- a/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/ResolveStatus.scala +++ b/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/ResolveStatus.scala @@ -11,7 +11,7 @@ class ResolveStatus private (name: String, ordinal: Int) object ResolveStatus { final val UNRESOLVED = new ResolveStatus("UNRESOLVED", 0) - final val RESOLVED = new ResolveStatus("RESOLVED", 1) + final val RESOLVED = new ResolveStatus("RESOLVED", 1) private[this] final val _values: Array[ResolveStatus] = Array(UNRESOLVED, RESOLVED) diff --git a/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/SerializedField.scala b/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/SerializedField.scala index edb8a002..4d33d25a 100644 --- a/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/SerializedField.scala +++ b/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/SerializedField.scala @@ -12,18 +12,18 @@ object SerializedField { // end of a list of fields final val END_MARKER = new SerializedField("END_MARKER", 1) // Fields at the root - final val ROOT_VALUE = new SerializedField("ROOT_VALUE", 2) + final val ROOT_VALUE = new SerializedField("ROOT_VALUE", 2) final val ROOT_WAS_CONFIG = new SerializedField("ROOT_WAS_CONFIG", 3) // Fields that make up a value - final val VALUE_DATA = new SerializedField("VALUE_DATA", 4) + final val VALUE_DATA = new SerializedField("VALUE_DATA", 4) final val VALUE_ORIGIN = new SerializedField("VALUE_ORIGIN", 5) // Fields that make up an origin final val ORIGIN_DESCRIPTION = new SerializedField("ORIGIN_DESCRIPTION", 6) final val ORIGIN_LINE_NUMBER = new SerializedField("ORIGIN_LINE_NUMBER", 7) final val ORIGIN_END_LINE_NUMBER = new SerializedField("ORIGIN_END_LINE_NUMBER", 8) - final val ORIGIN_TYPE = new SerializedField("ORIGIN_TYPE", 9) - final val ORIGIN_URL = new SerializedField("ORIGIN_URL", 10) + final val ORIGIN_TYPE = new SerializedField("ORIGIN_TYPE", 9) + final val ORIGIN_URL = new SerializedField("ORIGIN_URL", 10) final val ORIGIN_COMMENTS = new SerializedField("ORIGIN_COMMENTS", 11) final val ORIGIN_NULL_URL = new SerializedField("ORIGIN_NULL_URL", 12) final val ORIGIN_NULL_COMMENTS = diff --git a/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/SerializedValueType.scala b/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/SerializedValueType.scala index 57857e75..34f91b04 100644 --- a/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/SerializedValueType.scala +++ b/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/SerializedValueType.scala @@ -17,7 +17,7 @@ object SerializedValueType { final val NULL = new SerializedValueType("NULL", 0, ConfigValueType.NULL) final val BOOLEAN = new SerializedValueType("BOOLEAN", 1, ConfigValueType.BOOLEAN) - final val INT = new SerializedValueType("INT", 2, ConfigValueType.NUMBER) + final val INT = new SerializedValueType("INT", 2, ConfigValueType.NUMBER) final val LONG = new SerializedValueType("LONG", 3, ConfigValueType.NUMBER) final val DOUBLE = new SerializedValueType("DOUBLE", 4, ConfigValueType.NUMBER) diff --git a/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/TokenType.scala b/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/TokenType.scala index 228e23c7..1c6087e9 100644 --- a/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/TokenType.scala +++ b/sconfig/shared/src/main/scala-2/org/ekrich/config/impl/TokenType.scala @@ -6,23 +6,23 @@ final class TokenType private (name: String, ordinal: Int) extends jl.Enum[TokenType](name, ordinal) object TokenType { - final val START = new TokenType("START", 0) - final val END = new TokenType("END", 1) - final val COMMA = new TokenType("COMMA", 2) - final val EQUALS = new TokenType("EQUALS", 3) - final val COLON = new TokenType("COLON", 4) - final val OPEN_CURLY = new TokenType("OPEN_CURLY", 5) - final val CLOSE_CURLY = new TokenType("CLOSE_CURLY", 6) - final val OPEN_SQUARE = new TokenType("OPEN_SQUARE", 7) - final val CLOSE_SQUARE = new TokenType("CLOSE_SQUARE", 8) - final val VALUE = new TokenType("VALUE", 9) - final val NEWLINE = new TokenType("NEWLINE", 10) - final val UNQUOTED_TEXT = new TokenType("UNQUOTED_TEXT", 11) + final val START = new TokenType("START", 0) + final val END = new TokenType("END", 1) + final val COMMA = new TokenType("COMMA", 2) + final val EQUALS = new TokenType("EQUALS", 3) + final val COLON = new TokenType("COLON", 4) + final val OPEN_CURLY = new TokenType("OPEN_CURLY", 5) + final val CLOSE_CURLY = new TokenType("CLOSE_CURLY", 6) + final val OPEN_SQUARE = new TokenType("OPEN_SQUARE", 7) + final val CLOSE_SQUARE = new TokenType("CLOSE_SQUARE", 8) + final val VALUE = new TokenType("VALUE", 9) + final val NEWLINE = new TokenType("NEWLINE", 10) + final val UNQUOTED_TEXT = new TokenType("UNQUOTED_TEXT", 11) final val IGNORED_WHITESPACE = new TokenType("IGNORED_WHITESPACE", 12) - final val SUBSTITUTION = new TokenType("SUBSTITUTION", 13) - final val PROBLEM = new TokenType("PROBLEM", 14) - final val COMMENT = new TokenType("COMMENT", 15) - final val PLUS_EQUALS = new TokenType("PLUS_EQUALS", 16) + final val SUBSTITUTION = new TokenType("SUBSTITUTION", 13) + final val PROBLEM = new TokenType("PROBLEM", 14) + final val COMMENT = new TokenType("COMMENT", 15) + final val PLUS_EQUALS = new TokenType("PLUS_EQUALS", 16) private[this] final val _values: Array[TokenType] = Array( diff --git a/sconfig/shared/src/main/scala-3/org/ekrich/config/ConfigSyntax.scala b/sconfig/shared/src/main/scala-3/org/ekrich/config/ConfigSyntax.scala index 31678719..102a0e96 100644 --- a/sconfig/shared/src/main/scala-3/org/ekrich/config/ConfigSyntax.scala +++ b/sconfig/shared/src/main/scala-3/org/ekrich/config/ConfigSyntax.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config @@ -7,26 +7,26 @@ import java.{lang => jl} /** * The syntax of a character stream (JSON, HOCON - * aka ".conf", or HOCON aka + * ".conf", or Java properties). - * */ enum ConfigSyntax extends jl.Enum[ConfigSyntax] { + /** - * Pedantically strict JSON format; no - * comments, no unexpected commas, no duplicate keys in the same object. - * Associated with the .json file extension and - * application/json Content-Type. + * Pedantically strict JSON format; no comments, + * no unexpected commas, no duplicate keys in the same object. Associated with + * the .json file extension and application/json + * Content-Type. */ case JSON /** * The JSON-superset HOCON format. Associated with the .conf file extension - * and application/hocon Content-Type. + * href="https://github.com/lightbend/config/blob/master/HOCON.md" >HOCON + * format. Associated with the .conf file extension and + * application/hocon Content-Type. */ case CONF diff --git a/sconfig/shared/src/main/scala-3/org/ekrich/config/ConfigValueType.scala b/sconfig/shared/src/main/scala-3/org/ekrich/config/ConfigValueType.scala index a332bd18..fe0e830a 100644 --- a/sconfig/shared/src/main/scala-3/org/ekrich/config/ConfigValueType.scala +++ b/sconfig/shared/src/main/scala-3/org/ekrich/config/ConfigValueType.scala @@ -1,13 +1,13 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config import java.{lang => jl} /** - * The type of a configuration value (following the - * [[http://json.org JSON]] type schema). + * The type of a configuration value (following the [[http://json.org JSON]] + * type schema). */ enum ConfigValueType extends jl.Enum[ConfigValueType] { case OBJECT, LIST, NUMBER, BOOLEAN, NULL, STRING diff --git a/sconfig/shared/src/main/scala-3/org/ekrich/config/impl/FromMapMode.scala b/sconfig/shared/src/main/scala-3/org/ekrich/config/impl/FromMapMode.scala index 98804f2e..185ced46 100644 --- a/sconfig/shared/src/main/scala-3/org/ekrich/config/impl/FromMapMode.scala +++ b/sconfig/shared/src/main/scala-3/org/ekrich/config/impl/FromMapMode.scala @@ -1,4 +1,3 @@ - package org.ekrich.config.impl import java.{lang => jl} diff --git a/sconfig/shared/src/main/scala-3/org/ekrich/config/impl/MemoryUnit.scala b/sconfig/shared/src/main/scala-3/org/ekrich/config/impl/MemoryUnit.scala index 5f517f89..ab184219 100644 --- a/sconfig/shared/src/main/scala-3/org/ekrich/config/impl/MemoryUnit.scala +++ b/sconfig/shared/src/main/scala-3/org/ekrich/config/impl/MemoryUnit.scala @@ -4,19 +4,17 @@ import java.{lang => jl} import java.{math => jm} import java.{util => ju} -enum MemoryUnit(val prefix: String, - val powerOf: Int, - val power: Int) +enum MemoryUnit(val prefix: String, val powerOf: Int, val power: Int) extends jl.Enum[MemoryUnit] { val bytes = jm.BigInteger.valueOf(powerOf.toLong).pow(power) - case BYTES extends MemoryUnit("", 1024, 0) - case KILOBYTES extends MemoryUnit("kilo", 1000, 1) - case MEGABYTES extends MemoryUnit("mega", 1000, 2) - case GIGABYTES extends MemoryUnit("giga", 1000, 3) - case TERABYTES extends MemoryUnit("tera", 1000, 4) - case PETABYTES extends MemoryUnit("peta", 1000, 5) - case EXABYTES extends MemoryUnit("exa", 1000, 6) + case BYTES extends MemoryUnit("", 1024, 0) + case KILOBYTES extends MemoryUnit("kilo", 1000, 1) + case MEGABYTES extends MemoryUnit("mega", 1000, 2) + case GIGABYTES extends MemoryUnit("giga", 1000, 3) + case TERABYTES extends MemoryUnit("tera", 1000, 4) + case PETABYTES extends MemoryUnit("peta", 1000, 5) + case EXABYTES extends MemoryUnit("exa", 1000, 6) case ZETTABYTES extends MemoryUnit("zetta", 1000, 7) case YOTTABYTES extends MemoryUnit("yotta", 1000, 8) @@ -27,7 +25,7 @@ enum MemoryUnit(val prefix: String, case PEBIBYTES extends MemoryUnit("pebi", 1024, 5) case EXBIBYTES extends MemoryUnit("exbi", 1024, 6) case ZEBIBYTES extends MemoryUnit("zebi", 1024, 7) - case OBIBYTES extends MemoryUnit("yobi", 1024, 8) + case OBIBYTES extends MemoryUnit("yobi", 1024, 8) } @@ -43,12 +41,12 @@ private object MemoryUnit { map.put("B", unit) map.put("", unit) // no unit specified means bytes } else { - val first = unit.prefix.substring(0, 1) + val first = unit.prefix.substring(0, 1) val firstUpper = first.toUpperCase if (unit.powerOf == 1024) { - map.put(first, unit) // 512m - map.put(firstUpper, unit) // 512M - map.put(firstUpper + "i", unit) // 512Mi + map.put(first, unit) // 512m + map.put(firstUpper, unit) // 512M + map.put(firstUpper + "i", unit) // 512Mi map.put(firstUpper + "iB", unit) // 512MiB } else if (unit.powerOf == 1000) { if (unit.power == 1) map.put(first + "B", unit) // 512kB diff --git a/sconfig/shared/src/main/scala-3/org/ekrich/config/impl/ResolveStatus.scala b/sconfig/shared/src/main/scala-3/org/ekrich/config/impl/ResolveStatus.scala index a6d76a89..0e97987c 100644 --- a/sconfig/shared/src/main/scala-3/org/ekrich/config/impl/ResolveStatus.scala +++ b/sconfig/shared/src/main/scala-3/org/ekrich/config/impl/ResolveStatus.scala @@ -12,7 +12,8 @@ enum ResolveStatus extends jl.Enum[ResolveStatus] { object ResolveStatus { def fromValues( - values: ju.Collection[_ <: AbstractConfigValue]): ResolveStatus = { + values: ju.Collection[_ <: AbstractConfigValue] + ): ResolveStatus = { import scala.jdk.CollectionConverters._ values.asScala.find(_.resolveStatus == ResolveStatus.UNRESOLVED) match { case Some(_) => ResolveStatus.UNRESOLVED diff --git a/sconfig/shared/src/main/scala-3/org/ekrich/config/impl/SerializedField.scala b/sconfig/shared/src/main/scala-3/org/ekrich/config/impl/SerializedField.scala index 3d625672..355161b1 100644 --- a/sconfig/shared/src/main/scala-3/org/ekrich/config/impl/SerializedField.scala +++ b/sconfig/shared/src/main/scala-3/org/ekrich/config/impl/SerializedField.scala @@ -4,12 +4,12 @@ import java.{lang => jl} // this is how we try to be extensible enum SerializedField extends jl.Enum[SerializedField] { - case UNKNOWN, // represents a field code we didn't recognize - END_MARKER, // end of a list of fields - ROOT_VALUE, // Fields at the root + case UNKNOWN, // represents a field code we didn't recognize + END_MARKER, // end of a list of fields + ROOT_VALUE, // Fields at the root ROOT_WAS_CONFIG, - VALUE_DATA, // Fields that make up a value - VALUE_ORIGIN, + VALUE_DATA, // Fields that make up a value + VALUE_ORIGIN, ORIGIN_DESCRIPTION, // Fields that make up an origin ORIGIN_LINE_NUMBER, ORIGIN_END_LINE_NUMBER, diff --git a/sconfig/shared/src/main/scala-3/org/ekrich/config/impl/SerializedValueType.scala b/sconfig/shared/src/main/scala-3/org/ekrich/config/impl/SerializedValueType.scala index 454e58c0..18444910 100644 --- a/sconfig/shared/src/main/scala-3/org/ekrich/config/impl/SerializedValueType.scala +++ b/sconfig/shared/src/main/scala-3/org/ekrich/config/impl/SerializedValueType.scala @@ -6,17 +6,17 @@ import org.ekrich.config.ConfigValue import org.ekrich.config.ConfigValueType import org.ekrich.config.ConfigException -enum SerializedValueType(val configType: ConfigValueType) - extends jl.Enum[SerializedValueType] { - // the ordinals here are in the wire format, caution - case NULL extends SerializedValueType(ConfigValueType.NULL) - case BOOLEAN extends SerializedValueType(ConfigValueType.BOOLEAN) - case INT extends SerializedValueType(ConfigValueType.NUMBER) - case LONG extends SerializedValueType(ConfigValueType.NUMBER) - case DOUBLE extends SerializedValueType(ConfigValueType.NUMBER) - case STRING extends SerializedValueType(ConfigValueType.STRING) - case LIST extends SerializedValueType(ConfigValueType.LIST) - case OBJECT extends SerializedValueType(ConfigValueType.OBJECT) +enum SerializedValueType(val configType: ConfigValueType) + extends jl.Enum[SerializedValueType] { + // the ordinals here are in the wire format, caution + case NULL extends SerializedValueType(ConfigValueType.NULL) + case BOOLEAN extends SerializedValueType(ConfigValueType.BOOLEAN) + case INT extends SerializedValueType(ConfigValueType.NUMBER) + case LONG extends SerializedValueType(ConfigValueType.NUMBER) + case DOUBLE extends SerializedValueType(ConfigValueType.NUMBER) + case STRING extends SerializedValueType(ConfigValueType.STRING) + case LIST extends SerializedValueType(ConfigValueType.LIST) + case OBJECT extends SerializedValueType(ConfigValueType.OBJECT) } object SerializedValueType { @@ -25,7 +25,8 @@ object SerializedValueType { values(b) else throw new IllegalArgumentException( - s"No enum SerializedValueType ordinal $b") + s"No enum SerializedValueType ordinal $b" + ) private[impl] def forValue(value: ConfigValue): SerializedValueType = { val t = value.valueType @@ -37,13 +38,14 @@ object SerializedValueType { var n = 0 while (n < values.length) { val st = values(n) - if (st.configType eq t){ + if (st.configType eq t) { return st } n += 1 } } throw new ConfigException.BugOrBroken( - "don't know how to serialize " + value) + "don't know how to serialize " + value + ) } } diff --git a/sconfig/shared/src/main/scala-3/org/ekrich/config/impl/TokenType.scala b/sconfig/shared/src/main/scala-3/org/ekrich/config/impl/TokenType.scala index f5ee707b..498a7d8c 100644 --- a/sconfig/shared/src/main/scala-3/org/ekrich/config/impl/TokenType.scala +++ b/sconfig/shared/src/main/scala-3/org/ekrich/config/impl/TokenType.scala @@ -1,10 +1,12 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl import java.{lang => jl} enum TokenType extends jl.Enum[TokenType] { - case START, END, COMMA, EQUALS, COLON, OPEN_CURLY, CLOSE_CURLY, OPEN_SQUARE, CLOSE_SQUARE, VALUE, NEWLINE, UNQUOTED_TEXT, IGNORED_WHITESPACE, SUBSTITUTION, PROBLEM, COMMENT, PLUS_EQUALS + case START, END, COMMA, EQUALS, COLON, OPEN_CURLY, CLOSE_CURLY, OPEN_SQUARE, + CLOSE_SQUARE, VALUE, NEWLINE, UNQUOTED_TEXT, IGNORED_WHITESPACE, + SUBSTITUTION, PROBLEM, COMMENT, PLUS_EQUALS } diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/Config.scala b/sconfig/shared/src/main/scala/org/ekrich/config/Config.scala index ad521eff..0d4ca421 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/Config.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/Config.scala @@ -15,116 +15,99 @@ import scala.annotation.varargs /** * An immutable map from config paths to config values. Paths are dot-separated * expressions such as foo.bar.baz. Values are as in JSON - * (booleans, strings, numbers, lists, or objects), represented by - * {@link ConfigValue} instances. Values accessed through the - * Config interface are never null. + * (booleans, strings, numbers, lists, or objects), represented by {@link + * ConfigValue} instances. Values accessed through the Config + * interface are never null. * - *

- * {@code Config} is an immutable object and thus safe to use from multiple + *

{@code Config} is an immutable object and thus safe to use from multiple * threads. There's never a need for "defensive copies." * - *

- * Fundamental operations on a {@code Config} include getting configuration + *

Fundamental operations on a {@code Config} include getting configuration * values, resolving substitutions with [[#resolve()* resolve()]], and * merging configs using * [[#withFallback(other:org\.ekrich\.config\.ConfigMergeable)* withFallback(ConfigMergeable)]]. * - *

- * All operations return a new immutable {@code Config} rather than modifying - * the original instance. + *

All operations return a new immutable {@code Config} rather than + * modifying the original instance. * - *

- * Examples + *

Examples * - *

- * You can find an example app and library - * [[https://github.com/lightbend/config/tree/master/examples on GitHub]]. - * Also be sure to read the `package-summary.html#package_description` package overview]] - * which describes the big picture as shown in those examples. + *

You can find an example app and library + * [[https://github.com/lightbend/config/tree/master/examples on GitHub]]. Also + * be sure to read the `package-summary.html#package_description` package + * overview]] which describes the big picture as shown in those examples. * - *

- * Paths, keys, and Config vs. ConfigObject + *

Paths, keys, and Config vs. ConfigObject * - *

- * Config is a view onto a tree of {@link ConfigObject}; the + *

Config is a view onto a tree of {@link ConfigObject}; the * corresponding object tree can be found through {@link Config#root}. * ConfigObject is a map from config keys, rather than * paths, to config values. Think of ConfigObject as a JSON object * and Config as a configuration API. * - *

- * The API tries to consistently use the terms "key" and "path." A key is a key - * in a JSON object; it's just a string that's the key in a map. A "path" is a - * parseable expression with a syntax and it refers to a series of keys. Path + *

The API tries to consistently use the terms "key" and "path." A key is a + * key in a JSON object; it's just a string that's the key in a map. A "path" is + * a parseable expression with a syntax and it refers to a series of keys. Path * expressions are described in the * [[https://github.com/lightbend/config/blob/master/HOCON.md spec for Human-Optimized Config Object Notation]]. - * In brief, a path is - * period-separated so "a.b.c" looks for key c in object b in object a in the - * root object. Sometimes double quotes are needed around special characters in - * path expressions. + * In brief, a path is period-separated so "a.b.c" looks for key c in object b + * in object a in the root object. Sometimes double quotes are needed around + * special characters in path expressions. * - *

- * The API for a {@code Config} is in terms of path expressions, while the API - * for a {@code ConfigObject} is in terms of keys. Conceptually, {@code Config} - * is a one-level map from paths to values, while a - * {@code ConfigObject} is a tree of nested maps from keys to values. + *

The API for a {@code Config} is in terms of path expressions, while the + * API for a {@code ConfigObject} is in terms of keys. Conceptually, {@code + * Config} is a one-level map from paths to values, while a {@code + * ConfigObject} is a tree of nested maps from keys to values. * - *

- * Use [[ConfigUtil$.joinPath(elements:String*)* ConfigUtil.joinPath(String*)]] - * and [[ConfigUtil$.splitPath ConfigUtil.splitPath(String)]] - * to convert between path expressions and individual path elements (keys). + *

Use + * [[ConfigUtil$.joinPath(elements:String*)* ConfigUtil.joinPath(String*)]] and + * [[ConfigUtil$.splitPath ConfigUtil.splitPath(String)]] to convert between + * path expressions and individual path elements (keys). * - *

- * Another difference between {@code Config} and {@code ConfigObject} is that - * conceptually, {@code ConfigValue}s with a {@link ConfigValue#valueType - * valueType} of {@link ConfigValueType#NULL NULL} exist in a - * {@code ConfigObject}, while a {@code Config} treats null values as if they - * were missing. (With the exception of two methods: {@link Config#hasPathOrNull} - * and {@link Config#getIsNull} let you detect null values.) + *

Another difference between {@code Config} and {@code ConfigObject} is + * that conceptually, {@code ConfigValue}s with a {@link ConfigValue#valueType + * valueType} of {@link ConfigValueType#NULL NULL} exist in a {@code + * ConfigObject}, while a {@code Config} treats null values as if they were + * missing. (With the exception of two methods: {@link Config#hasPathOrNull} and + * {@link Config#getIsNull} let you detect null values.) * - *

- * Getting configuration values + *

Getting configuration values * - *

- * The "getters" on a {@code Config} all work in the same way. They never return - * null, nor do they return a {@code ConfigValue} with - * {@link ConfigValue#valueType valueType} of {@link ConfigValueType#NULL - * NULL}. Instead, they throw {@link ConfigException.Missing} if the value is + *

The "getters" on a {@code Config} all work in the same way. They never + * return null, nor do they return a {@code ConfigValue} with {@link + * ConfigValue#valueType valueType} of {@link ConfigValueType#NULL NULL}. + * Instead, they throw {@link ConfigException.Missing} if the value is * completely absent or set to null. If the value is set to null, a subtype of * {@code ConfigException.Missing} called {@link ConfigException.Null} will be * thrown. {@link ConfigException.WrongType} will be thrown anytime you ask for * a type and the value has an incompatible type. Reasonable type conversions * are performed for you though. * - *

- * Iteration + *

Iteration * - *

- * If you want to iterate over the contents of a {@code Config}, you can get its - * {@code ConfigObject} with {@link #root}, and then iterate over the - * {@code ConfigObject} (which implements java.util.Map). Or, you - * can use {@link #entrySet} which recurses the object tree for you and builds - * up a Set of all path-value pairs where the value is not null. + *

If you want to iterate over the contents of a {@code Config}, you can get + * its {@code ConfigObject} with {@link #root}, and then iterate over the {@code + * ConfigObject} (which implements java.util.Map). Or, you can use + * {@link #entrySet} which recurses the object tree for you and builds up a + * Set of all path-value pairs where the value is not null. * * '''Resolving substitutions''' * - * ''Substitutions'' are the `\${foo.bar}` syntax in config - * files, described in the specification. Resolving substitutions replaces these references with real - * values. + * >specification. Resolving substitutions replaces these references with + * real values. * - *

- * Before using a {@code Config} it's necessary to call [[#resolve()* resolve()]] - * to handle substitutions (though [[ConfigFactory$.load()* ConfigFactory.load()]] and similar - * methods will do the resolve for you already). + *

Before using a {@code Config} it's necessary to call + * [[#resolve()* resolve()]] to handle substitutions (though + * [[ConfigFactory$.load()* ConfigFactory.load()]] and similar methods will do + * the resolve for you already). * - *

- * Merging + *

Merging * - *

- * The full Config for your application can be constructed using - * the associative operation + *

The full Config for your application can be constructed + * using the associative operation * [[#withFallback(other:org\.ekrich\.config\.ConfigMergeable)* withFallback(ConfigMergeable)]]. * If you use [[ConfigFactory$.load()* ConfigFactory.load()]] (recommended), it * merges system properties over the top of application.conf over @@ -134,36 +117,30 @@ import scala.annotation.varargs * application.conf, keeping reference.conf at the * bottom and system properties at the top). * - *

- * Serialization + *

Serialization * - *

- * Convert a Config to a JSON or HOCON string by calling + *

Convert a Config to a JSON or HOCON string by calling * [[#root root]] to get the [[ConfigObject]] and then call - * [[ConfigValue!.render:String* render]] - * on the root object, myConfig.root.render. There's also a variant + * [[ConfigValue!.render:String* render]] on the root object, + * myConfig.root.render. There's also a variant * [[ConfigValue!.render(options:org\.ekrich\.config\.ConfigRenderOptions)* render(ConfigRenderOptions)]] - * inherited from [[ConfigValue]] which allows you to control - * the format of the rendered string. (See {@link ConfigRenderOptions}.) Note - * that Config does not remember the formatting of the original - * file, so if you load, modify, and re-save a config file, it will be - * substantially reformatted. + * inherited from [[ConfigValue]] which allows you to control the format of the + * rendered string. (See {@link ConfigRenderOptions}.) Note that + * Config does not remember the formatting of the original file, so + * if you load, modify, and re-save a config file, it will be substantially + * reformatted. * - *

- * As an alternative to [[ConfigValue!.render:String* render]], the - * toString method produces a debug-output-oriented - * representation (which is not valid JSON). + *

As an alternative to [[ConfigValue!.render:String* render]], the + * toString method produces a debug-output-oriented representation + * (which is not valid JSON). * - *

- * Java serialization is supported as well for Config and all + *

Java serialization is supported as well for Config and all * subtypes of ConfigValue. * - *

- * This is an interface but don't implement it yourself + *

This is an interface but don't implement it yourself * - *

- * Do not implement {@code Config}; it should only be implemented by - * the config library. Arbitrary implementations will not work because the + *

Do not implement {@code Config}; it should only be implemented + * by the config library. Arbitrary implementations will not work because the * library internals assume a specific concrete implementation. Also, this * interface is likely to grow new methods over time, so third-party * implementations will break. @@ -172,55 +149,51 @@ trait Config extends ConfigMergeable { /** * Gets the {@code Config} as a tree of {@link ConfigObject}. This is a - * constant-time operation (it is not proportional to the number of values - * in the {@code Config}). + * constant-time operation (it is not proportional to the number of values in + * the {@code Config}). * - * @return the root object in the configuration + * @return + * the root object in the configuration */ def root: ConfigObject /** - * Gets the origin of the {@code Config}, which may be a file, or a file - * with a line number, or just a descriptive phrase. + * Gets the origin of the {@code Config}, which may be a file, or a file with + * a line number, or just a descriptive phrase. * - * @return the origin of the {@code Config} for use in error messages + * @return + * the origin of the {@code Config} for use in error messages */ def origin: ConfigOrigin override def withFallback(other: ConfigMergeable): Config /** - * Returns a replacement config with all substitutions (the - * `\${foo.bar}` syntax, see - * [[https://github.com/ekrich/sconfig/blob/master/HOCON.md HOCON spec]] - * for resolved. Substitutions are looked up using this - * `Config` as the root object, that is, a substitution - * `\${foo.bar}` will be replaced with the result of - * `getValue("foo.bar")`. - * - *

- * This method uses {@link ConfigResolveOptions#defaults}, there is + * Returns a replacement config with all substitutions (the `\${foo.bar}` + * syntax, see + * [[https://github.com/ekrich/sconfig/blob/master/HOCON.md HOCON spec]] for + * resolved. Substitutions are looked up using this `Config` as the root + * object, that is, a substitution `\${foo.bar}` will be replaced with the + * result of `getValue("foo.bar")`. + * + *

This method uses {@link ConfigResolveOptions#defaults}, there is * another variant * [[#resolve(options:org\.ekrich\.config\.ConfigResolveOptions)* resolve(ConfigResolveOptions)]] * which lets you specify non-default options. * - *

- * A given {@link Config} must be resolved before using it to retrieve + *

A given {@link Config} must be resolved before using it to retrieve * config values, but ideally should be resolved one time for your entire * stack of fallbacks (see {@link Config#withFallback}). Otherwise, some - * substitutions that could have resolved with all fallbacks available may - * not resolve, which will be potentially confusing for your application's - * users. + * substitutions that could have resolved with all fallbacks available may not + * resolve, which will be potentially confusing for your application's users. * - *

- * resolve should be invoked on root config objects, rather + *

resolve should be invoked on root config objects, rather * than on a subtree (a subtree is the result of something like * config.getConfig("foo")). The problem with - * resolve on a subtree is that substitutions are relative to - * the root of the config and the subtree will have no way to get values - * from the root. For example, if you did - * config.getConfig("foo").resolve on the below config file, - * it would not work: + * resolve on a subtree is that substitutions are relative to the + * root of the config and the subtree will have no way to get values from the + * root. For example, if you did config.getConfig("foo").resolve + * on the below config file, it would not work: * * {{{ * common-value = 10 @@ -229,21 +202,20 @@ trait Config extends ConfigMergeable { * } * }}} * - *

- * Many methods on {@link ConfigFactory} such as + *

Many methods on {@link ConfigFactory} such as * [[ConfigFactory$.load()* ConfigFactory.load()]] automatically resolve the * loaded Config on the loaded stack of config files. * - *

- * Resolving an already-resolved config is a harmless no-op, but again, it + *

Resolving an already-resolved config is a harmless no-op, but again, it * is best to resolve an entire stack of fallbacks (such as all your config * files combined) rather than resolving each one individually. * - * @return an immutable object with substitutions resolved + * @return + * an immutable object with substitutions resolved * @throws ConfigException.UnresolvedSubstitution - * if any substitutions refer to nonexistent paths + * if any substitutions refer to nonexistent paths * @throws ConfigException - * some other config exception if there are other problems + * some other config exception if there are other problems */ def resolve(): Config @@ -252,22 +224,25 @@ trait Config extends ConfigMergeable { * options. * * @param options - * resolve options - * @return the resolved Config (may be only partially resolved if options are set to allow unresolved) + * resolve options + * @return + * the resolved Config (may be only partially resolved if + * options are set to allow unresolved) */ def resolve(options: ConfigResolveOptions): Config /** * Checks whether the config is completely resolved. After a successful call - * to [[#resolve()* resolve()]] it will be completely resolved, but after calling + * to [[#resolve()* resolve()]] it will be completely resolved, but after + * calling * [[#resolve(options:org\.ekrich\.config\.ConfigResolveOptions)* resolve(ConfigResolveOptions)]] * with allowUnresolved set in the options, it may or may not be * completely resolved. A newly-loaded config may or may not be completely - * resolved depending on whether there were substitutions present in the - * file. + * resolved depending on whether there were substitutions present in the file. * - * @return true if there are no unresolved substitutions remaining in this - * configuration. + * @return + * true if there are no unresolved substitutions remaining in this + * configuration. * @since 1.2.0 */ def isResolved: Boolean @@ -275,166 +250,151 @@ trait Config extends ConfigMergeable { /** * Like [[#resolve()* resolve()]] except that substitution values are looked * up in the given source, rather than in this instance. This is a - * special-purpose method which doesn't make sense to use in most cases; - * it's only needed if you're constructing some sort of app-specific custom - * approach to configuration. The more usual approach if you have a source - * of substitution values would be to merge that source into your config - * stack using {@link Config#withFallback} and then resolve. - *

- * Note that this method does NOT look in this instance for substitution - * values. If you want to do that, you could either merge this instance into - * your value source using {@link Config#withFallback}, or you could resolve - * multiple times with multiple sources (using - * {@link ConfigResolveOptions#setAllowUnresolved} so the partial - * resolves don't fail). + * special-purpose method which doesn't make sense to use in most cases; it's + * only needed if you're constructing some sort of app-specific custom + * approach to configuration. The more usual approach if you have a source of + * substitution values would be to merge that source into your config stack + * using {@link Config#withFallback} and then resolve.

Note that this + * method does NOT look in this instance for substitution values. If you want + * to do that, you could either merge this instance into your value source + * using {@link Config#withFallback}, or you could resolve multiple times with + * multiple sources (using {@link ConfigResolveOptions#setAllowUnresolved} so + * the partial resolves don't fail). * * @param source - * configuration to pull values from - * @return an immutable object with substitutions resolved + * configuration to pull values from + * @return + * an immutable object with substitutions resolved * @throws ConfigException.UnresolvedSubstitution - * if any substitutions refer to paths which are not in the - * source + * if any substitutions refer to paths which are not in the source * @throws ConfigException - * some other config exception if there are other problems + * some other config exception if there are other problems * @since 1.2.0 */ def resolveWith(source: Config): Config /** - * Like [[#resolveWith(source:org\.ekrich\.config\.Config)* resolveWith(Config)]] + * Like + * [[#resolveWith(source:org\.ekrich\.config\.Config)* resolveWith(Config)]] * but allows you to specify non-default options. * * @param source - * source configuration to pull values from + * source configuration to pull values from * @param options - * resolve options - * @return the resolved Config (may be only partially resolved - * if options are set to allow unresolved) + * resolve options + * @return + * the resolved Config (may be only partially resolved if + * options are set to allow unresolved) * @since 1.2.0 */ def resolveWith(source: Config, options: ConfigResolveOptions): Config /** - * Validates this config against a reference config, throwing an exception - * if it is invalid. The purpose of this method is to "fail early" with a + * Validates this config against a reference config, throwing an exception if + * it is invalid. The purpose of this method is to "fail early" with a * comprehensive list of problems; in general, anything this method can find - * would be detected later when trying to use the config, but it's often - * more user-friendly to fail right away when loading the config. + * would be detected later when trying to use the config, but it's often more + * user-friendly to fail right away when loading the config. * - *

- * Using this method is always optional, since you can "fail late" instead. + *

Using this method is always optional, since you can "fail late" + * instead. * - *

- * You must restrict validation to paths you "own" (those whose meaning are - * defined by your code module). If you validate globally, you may trigger + *

You must restrict validation to paths you "own" (those whose meaning + * are defined by your code module). If you validate globally, you may trigger * errors about paths that happen to be in the config but have nothing to do * with your module. It's best to allow the modules owning those paths to * validate them. Also, if every module validates only its own stuff, there * isn't as much redundant work being done. * - *

- * If no paths are specified in checkValid's parameter list, + *

If no paths are specified in checkValid's parameter list, * validation is for the entire config. * - *

- * If you specify paths that are not in the reference config, those paths + *

If you specify paths that are not in the reference config, those paths * are ignored. (There's nothing to validate.) * - *

- * Here's what validation involves: - * - *

    - *
  • All paths found in the reference config must be present in this - * config or an exception will be thrown. - *
  • - * Some changes in type from the reference config to this config will cause - * an exception to be thrown. Not all potential type problems are detected, - * in particular it's assumed that strings are compatible with everything - * except objects and lists. This is because string types are often "really" - * some other type (system properties always start out as strings, or a - * string like "5ms" could be used with - * [[#getDuration(path:String)* getDuration(String)]]). - * Also, it's allowed to set any type to null or override null with any type. - *
  • - * Any unresolved substitutions in this config will cause a validation - * failure; both the reference config and this config should be resolved - * before validation. If the reference config is unresolved, it's a bug in - * the caller of this method. - *
- * - *

- * If you want to allow a certain setting to have a flexible type (or - * otherwise want validation to be looser for some settings), you could - * either remove the problematic setting from the reference config provided - * to this method, or you could intercept the validation exception and - * screen out certain problems. Of course, this will only work if all other - * callers of this method are careful to restrict validation to their own - * paths, as they should be. - * - *

- * If validation fails, the thrown exception contains a list of all problems - * found. See {@link ConfigException.ValidationFailed#problems}. The - * exception's getMessage will have all the problems - * concatenated into one huge string, as well. - * - *

- * Again, checkValid can't guess every domain-specific way a - * setting can be invalid, so some problems may arise later when attempting - * to use the config. checkValid is limited to reporting - * generic, but common, problems such as missing settings and blatant type + *

Here's what validation involves: + * + *

  • All paths found in the reference config must be present in this + * config or an exception will be thrown.
  • Some changes in type from the + * reference config to this config will cause an exception to be thrown. Not + * all potential type problems are detected, in particular it's assumed that + * strings are compatible with everything except objects and lists. This is + * because string types are often "really" some other type (system properties + * always start out as strings, or a string like "5ms" could be used with + * [[#getDuration(path:String)* getDuration(String)]]). Also, it's allowed to + * set any type to null or override null with any type.
  • Any unresolved + * substitutions in this config will cause a validation failure; both the + * reference config and this config should be resolved before validation. If + * the reference config is unresolved, it's a bug in the caller of this + * method.
+ * + *

If you want to allow a certain setting to have a flexible type (or + * otherwise want validation to be looser for some settings), you could either + * remove the problematic setting from the reference config provided to this + * method, or you could intercept the validation exception and screen out + * certain problems. Of course, this will only work if all other callers of + * this method are careful to restrict validation to their own paths, as they + * should be. + * + *

If validation fails, the thrown exception contains a list of all + * problems found. See {@link ConfigException.ValidationFailed#problems}. The + * exception's getMessage will have all the problems concatenated + * into one huge string, as well. + * + *

Again, checkValid can't guess every domain-specific way a + * setting can be invalid, so some problems may arise later when attempting to + * use the config. checkValid is limited to reporting generic, + * but common, problems such as missing settings and blatant type * incompatibilities. * * @param reference - * a reference configuration + * a reference configuration * @param restrictToPaths - * only validate values underneath these paths that your code - * module owns and understands + * only validate values underneath these paths that your code module owns + * and understands * @throws ConfigException.ValidationFailed - * if there are any validation issues + * if there are any validation issues * @throws ConfigException.NotResolved - * if this config is not resolved + * if this config is not resolved * @throws ConfigException.BugOrBroken - * if the reference config is unresolved or caller otherwise - * misuses the API + * if the reference config is unresolved or caller otherwise misuses the API */ @varargs def checkValid(reference: Config, restrictToPaths: String*): Unit /** * Checks whether a value is present and non-null at the given path. This - * differs in two ways from {@code Map.containsKey} as implemented by - * {@link ConfigObject}: it looks for a path expression, not a key; and it - * returns false for null values, while {@code containsKey} returns true - * indicating that the object contains a null value for the key. + * differs in two ways from {@code Map.containsKey} as implemented by {@link + * ConfigObject}: it looks for a path expression, not a key; and it returns + * false for null values, while {@code containsKey} returns true indicating + * that the object contains a null value for the key. * - *

- * If a path exists according to {@link #hasPath}, then - * {@link #getValue} will never throw an exception. However, the - * typed getters, such as {@link #getInt}, will still throw if the - * value is not convertible to the requested type. + *

If a path exists according to {@link #hasPath}, then {@link #getValue} + * will never throw an exception. However, the typed getters, such as {@link + * #getInt}, will still throw if the value is not convertible to the requested + * type. * - *

- * Note that path expressions have a syntax and sometimes require quoting - * (see [[ConfigUtil$.joinPath(elements:String*)*]] and {@link ConfigUtil#splitPath}). + *

Note that path expressions have a syntax and sometimes require quoting + * (see [[ConfigUtil$.joinPath(elements:String*)*]] and {@link + * ConfigUtil#splitPath}). * * @param path - * the path expression - * @return true if a non-null value is present at the path + * the path expression + * @return + * true if a non-null value is present at the path * @throws ConfigException.BadPath - * if the path expression is invalid + * if the path expression is invalid */ def hasPath(path: String): Boolean /** - * Checks whether a value is present at the given path, even - * if the value is null. Most of the getters on - * Config will throw if you try to get a null - * value, so if you plan to call {@link #getValue}, - * {@link #getInt}, or another getter you may want to - * use plain {@link #hasPath} rather than this method. - * - *

- * To handle all three cases (unset, null, and a non-null value) - * the code might look like: + * Checks whether a value is present at the given path, even if the value is + * null. Most of the getters on Config will throw if you try to + * get a null value, so if you plan to call {@link #getValue}, {@link + * #getInt}, or another getter you may want to use plain {@link #hasPath} + * rather than this method. + * + *

To handle all three cases (unset, null, and a non-null value) the code + * might look like: * {{{ * if (config.hasPathOrNull(path)) { * if (config.getIsNull(path)) { @@ -447,21 +407,21 @@ trait Config extends ConfigMergeable { * } * }}} * - *

However, the usual thing is to allow entirely unset - * paths to be a bug that throws an exception (because you set - * a default in your reference.conf), so in that - * case it's OK to call {@link #getIsNull} without - * checking hasPathOrNull first. + *

However, the usual thing is to allow entirely unset paths to be a bug + * that throws an exception (because you set a default in your + * reference.conf), so in that case it's OK to call {@link + * #getIsNull} without checking hasPathOrNull first. * - *

- * Note that path expressions have a syntax and sometimes require quoting - * (see [[ConfigUtil$.joinPath(elements:String*)*]] and {@link ConfigUtil#splitPath}). + *

Note that path expressions have a syntax and sometimes require quoting + * (see [[ConfigUtil$.joinPath(elements:String*)*]] and {@link + * ConfigUtil#splitPath}). * * @param path - * the path expression - * @return true if a value is present at the path, even if the value is null + * the path expression + * @return + * true if a value is present at the path, even if the value is null * @throws ConfigException.BadPath - * if the path expression is invalid + * if the path expression is invalid */ def hasPathOrNull(path: String): Boolean @@ -469,446 +429,453 @@ trait Config extends ConfigMergeable { * Returns true if the {@code Config}'s root object contains no key-value * pairs. * - * @return true if the configuration is empty + * @return + * true if the configuration is empty */ def isEmpty: Boolean /** * Returns the set of path-value pairs, excluding any null values, found by - * recursing {@link #root the root object}. Note that this is very - * different from root.entrySet which returns the set of - * immediate-child keys in the root object and includes null values. - *

- * Entries contain path expressions meaning there may be quoting - * and escaping involved. Parse path expressions with - * {@link ConfigUtil#splitPath}. - *

- * Because a Config is conceptually a single-level map from - * paths to values, there will not be any {@link ConfigObject} values in the - * entries (that is, all entries represent leaf nodes). Use - * {@link ConfigObject} rather than Config if you want a tree. - * (OK, this is a slight lie: Config entries may contain - * {@link ConfigList} and the lists may contain objects. But no objects are - * directly included as entry values.) - * - * @return set of paths with non-null values, built up by recursing the - * entire tree of { @link ConfigObject} and creating an entry for - * each leaf value. + * recursing {@link #root the root object}. Note that this is very different + * from root.entrySet which returns the set of immediate-child + * keys in the root object and includes null values.

Entries contain + * path expressions meaning there may be quoting and escaping + * involved. Parse path expressions with {@link ConfigUtil#splitPath}.

+ * Because a Config is conceptually a single-level map from paths + * to values, there will not be any {@link ConfigObject} values in the entries + * (that is, all entries represent leaf nodes). Use {@link ConfigObject} + * rather than Config if you want a tree. (OK, this is a slight + * lie: Config entries may contain {@link ConfigList} and the + * lists may contain objects. But no objects are directly included as entry + * values.) + * + * @return + * set of paths with non-null values, built up by recursing the entire tree + * of { @link ConfigObject} and creating an entry for each leaf value. */ def entrySet: ju.Set[ju.Map.Entry[String, ConfigValue]] /** - * Checks whether a value is set to null at the given path, - * but throws an exception if the value is entirely - * unset. This method will not throw if {@link #hasPathOrNull} - * returned true for the same path, so to avoid any possible exception check - * hasPathOrNull first. However, an exception - * for unset paths will usually be the right thing (because a - * reference.conf should exist that has the path - * set, the path should never be unset unless something is - * broken). - * - *

- * Note that path expressions have a syntax and sometimes require quoting - * (see [[ConfigUtil$.joinPath(elements:String*)*]] and {@link ConfigUtil#splitPath}). + * Checks whether a value is set to null at the given path, but throws an + * exception if the value is entirely unset. This method will not throw if + * {@link #hasPathOrNull} returned true for the same path, so to avoid any + * possible exception check hasPathOrNull first. However, an + * exception for unset paths will usually be the right thing (because a + * reference.conf should exist that has the path set, the path + * should never be unset unless something is broken). + * + *

Note that path expressions have a syntax and sometimes require quoting + * (see [[ConfigUtil$.joinPath(elements:String*)*]] and {@link + * ConfigUtil#splitPath}). * * @param path - * the path expression - * @return true if the value exists and is null, false if it - * exists and is not null + * the path expression + * @return + * true if the value exists and is null, false if it exists and is not null * @throws ConfigException.BadPath - * if the path expression is invalid + * if the path expression is invalid * @throws ConfigException.Missing - * if value is not set at all + * if value is not set at all */ def getIsNull(path: String): Boolean /** - * * @param path - * path expression - * @return the boolean value at the requested path + * path expression + * @return + * the boolean value at the requested path * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to boolean + * if value is not convertible to boolean */ def getBoolean(path: String): Boolean /** * @param path - * path expression - * @return the numeric value at the requested path + * path expression + * @return + * the numeric value at the requested path * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to a number + * if value is not convertible to a number */ def getNumber(path: String): jl.Number /** - * Gets the integer at the given path. If the value at the - * path has a fractional (floating point) component, it - * will be discarded and only the integer part will be - * returned (it works like a "narrowing primitive conversion" - * in the Java language specification). + * Gets the integer at the given path. If the value at the path has a + * fractional (floating point) component, it will be discarded and only the + * integer part will be returned (it works like a "narrowing primitive + * conversion" in the Java language specification). * * @param path - * path expression - * @return the 32-bit integer value at the requested path + * path expression + * @return + * the 32-bit integer value at the requested path * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to an int (for example it is out - * of range, or it's a boolean value) + * if value is not convertible to an int (for example it is out of range, or + * it's a boolean value) */ def getInt(path: String): Int /** - * Gets the long integer at the given path. If the value at - * the path has a fractional (floating point) component, it - * will be discarded and only the integer part will be - * returned (it works like a "narrowing primitive conversion" - * in the Java language specification). + * Gets the long integer at the given path. If the value at the path has a + * fractional (floating point) component, it will be discarded and only the + * integer part will be returned (it works like a "narrowing primitive + * conversion" in the Java language specification). * * @param path - * path expression - * @return the 64-bit long value at the requested path + * path expression + * @return + * the 64-bit long value at the requested path * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to a long + * if value is not convertible to a long */ def getLong(path: String): Long /** * @param path - * path expression - * @return the floating-point value at the requested path + * path expression + * @return + * the floating-point value at the requested path * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to a double + * if value is not convertible to a double */ def getDouble(path: String): Double /** * @param path - * path expression - * @return the string value at the requested path + * path expression + * @return + * the string value at the requested path * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to a string + * if value is not convertible to a string */ def getString(path: String): String /** * @param enumClass - * an enum class - * @param < T> - * a generic denoting a specific type of enum + * an enum class + * @param [T] + * a generic denoting a specific type of enum * @param path - * path expression - * @return the { @code Enum} value at the requested path - * of the requested enum class + * path expression + * @return + * the { @code Enum} value at the requested path of the requested enum class * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to an Enum + * if value is not convertible to an Enum */ def getEnum[T <: jl.Enum[T]](enumClass: Class[T], path: String): T /** * @param path - * path expression - * @return the { @link ConfigObject} value at the requested path + * path expression + * @return + * the { @link ConfigObject} value at the requested path * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to an object + * if value is not convertible to an object */ def getObject(path: String): ConfigObject /** * @param path - * path expression - * @return the nested {@code Config} value at the requested path + * path expression + * @return + * the nested {@code Config} value at the requested path * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to a Config + * if value is not convertible to a Config */ def getConfig(path: String): Config /** * Gets the value at the path as an unwrapped Java boxed value ( - * `java.lang.Boolean` `java.lang.Integer`, and - * so on - see {@link ConfigValue#unwrapped}). + * `java.lang.Boolean` `java.lang.Integer`, and so on - see {@link + * ConfigValue#unwrapped}). * * @param path - * path expression - * @return the unwrapped value at the requested path + * path expression + * @return + * the unwrapped value at the requested path * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null */ def getAnyRef(path: String): AnyRef /** - * Gets the value at the given path, unless the value is a - * null value or missing, in which case it throws just like - * the other getters. Use {@code get} on the {@link Config#root} - * object (or other object in the tree) if you + * Gets the value at the given path, unless the value is a null value or + * missing, in which case it throws just like the other getters. Use {@code + * get} on the {@link Config#root} object (or other object in the tree) if you * want an unprocessed value. * * @param path - * path expression - * @return the value at the requested path + * path expression + * @return + * the value at the requested path * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null */ def getValue(path: String): ConfigValue /** * Gets a value as a size in bytes (parses special strings like "128M"). If - * the value is already a number, then it's left alone; if it's a string, - * it's parsed understanding unit suffixes such as "128K", as documented in - * the [[https://github.com/lightbend/config/blob/master/HOCON.md the spec]]. + * the value is already a number, then it's left alone; if it's a string, it's + * parsed understanding unit suffixes such as "128K", as documented in the + * [[https://github.com/lightbend/config/blob/master/HOCON.md the spec]]. * * @param path - * path expression - * @return the value at the requested path, in bytes + * path expression + * @return + * the value at the requested path, in bytes * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to Long or String + * if value is not convertible to Long or String * @throws ConfigException.BadValue - * if value cannot be parsed as a size in bytes + * if value cannot be parsed as a size in bytes */ def getBytes(path: String): jl.Long /** - * Gets a value as an amount of memory (parses special strings like "128M"). If - * the value is already a number, then it's left alone; if it's a string, + * Gets a value as an amount of memory (parses special strings like "128M"). + * If the value is already a number, then it's left alone; if it's a string, * it's parsed understanding unit suffixes such as "128K", as documented in * the [[https://github.com/lightbend/config/blob/master/HOCON.md the spec]]. * * @since 1.3.0 * @param path - * path expression - * @return the value at the requested path, in bytes + * path expression + * @return + * the value at the requested path, in bytes * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to Long or String + * if value is not convertible to Long or String * @throws ConfigException.BadValue - * if value cannot be parsed as a size in bytes + * if value cannot be parsed as a size in bytes */ def getMemorySize(path: String): ConfigMemorySize /** - * Gets a value as a duration in a specified - * `java.util.concurrent.TimeUnit`. If the value is already a - * number, then it's taken as milliseconds and then converted to the - * requested TimeUnit; if it's a string, it's parsed understanding units - * suffixes like "10m" or "5ns" as documented in the the * spec. This method never returns null. * * @since 1.3.0 * @param path - * path expression - * @return the duration value at the requested path + * path expression + * @return + * the duration value at the requested path * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to Long or String + * if value is not convertible to Long or String * @throws ConfigException.BadValue - * if value cannot be parsed as a number of the given TimeUnit + * if value cannot be parsed as a number of the given TimeUnit */ def getDuration(path: String): Duration /** - * Gets a value as a java.time.Period. If the value is - * already a number, then it's taken as days; if it's - * a string, it's parsed understanding units suffixes like - * "10d" or "5w" as documented in the the * spec. This method never returns null. * * @since 1.3.0 * @param path - * path expression - * @return the period value at the requested path + * path expression + * @return + * the period value at the requested path * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to Long or String + * if value is not convertible to Long or String * @throws ConfigException.BadValue - * if value cannot be parsed as a number of the given TimeUnit + * if value cannot be parsed as a number of the given TimeUnit */ def getPeriod(path: String): Period /** - * Gets a value as a java.time.temporal.TemporalAmount. - * This method will first try get get the value as a java.time.Duration, and if unsuccessful, - * then as a java.time.Period. - * This means that values like "5m" will be parsed as 5 minutes rather than 5 months + * Gets a value as a java.time.temporal.TemporalAmount. This method will first + * try get get the value as a java.time.Duration, and if unsuccessful, then as + * a java.time.Period. This means that values like "5m" will be parsed as 5 + * minutes rather than 5 months * - * @param path path expression - * @return the temporal value at the requested path + * @param path + * path expression + * @return + * the temporal value at the requested path * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to Long or String + * if value is not convertible to Long or String * @throws ConfigException.BadValue - * if value cannot be parsed as a TemporalAmount + * if value cannot be parsed as a TemporalAmount */ def getTemporal(path: String): TemporalAmount /** * Gets a list value (with any element type) as a {@link ConfigList}, which - * implements {@code java.util.List}. Throws if the path is - * unset or null. + * implements {@code java.util.List}. Throws if the path is unset + * or null. * * @param path - * the path to the list value. - * @return the { @link ConfigList} at the path + * the path to the list value. + * @return + * the { @link ConfigList} at the path * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to a ConfigList + * if value is not convertible to a ConfigList */ def getList(path: String): ConfigList /** - * Gets a list value with boolean elements. Throws if the - * path is unset or null or not a list or contains values not - * convertible to boolean. + * Gets a list value with boolean elements. Throws if the path is unset or + * null or not a list or contains values not convertible to boolean. * * @param path - * the path to the list value. - * @return the list at the path + * the path to the list value. + * @return + * the list at the path * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to a list of booleans + * if value is not convertible to a list of booleans */ def getBooleanList(path: String): ju.List[jl.Boolean] /** - * Gets a list value with number elements. Throws if the - * path is unset or null or not a list or contains values not - * convertible to number. + * Gets a list value with number elements. Throws if the path is unset or null + * or not a list or contains values not convertible to number. * * @param path - * the path to the list value. - * @return the list at the path + * the path to the list value. + * @return + * the list at the path * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to a list of numbers + * if value is not convertible to a list of numbers */ def getNumberList(path: String): ju.List[jl.Number] /** - * Gets a list value with int elements. Throws if the - * path is unset or null or not a list or contains values not - * convertible to int. + * Gets a list value with int elements. Throws if the path is unset or null or + * not a list or contains values not convertible to int. * * @param path - * the path to the list value. - * @return the list at the path + * the path to the list value. + * @return + * the list at the path * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to a list of ints + * if value is not convertible to a list of ints */ def getIntList(path: String): ju.List[jl.Integer] /** - * Gets a list value with long elements. Throws if the - * path is unset or null or not a list or contains values not - * convertible to long. + * Gets a list value with long elements. Throws if the path is unset or null + * or not a list or contains values not convertible to long. * * @param path - * the path to the list value. - * @return the list at the path + * the path to the list value. + * @return + * the list at the path * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to a list of longs + * if value is not convertible to a list of longs */ def getLongList(path: String): ju.List[jl.Long] /** - * Gets a list value with double elements. Throws if the - * path is unset or null or not a list or contains values not - * convertible to double. + * Gets a list value with double elements. Throws if the path is unset or null + * or not a list or contains values not convertible to double. * * @param path - * the path to the list value. - * @return the list at the path + * the path to the list value. + * @return + * the list at the path * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to a list of doubles + * if value is not convertible to a list of doubles */ def getDoubleList(path: String): ju.List[jl.Double] /** - * Gets a list value with string elements. Throws if the - * path is unset or null or not a list or contains values not - * convertible to string. + * Gets a list value with string elements. Throws if the path is unset or null + * or not a list or contains values not convertible to string. * * @param path - * the path to the list value. - * @return the list at the path + * the path to the list value. + * @return + * the list at the path * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to a list of strings + * if value is not convertible to a list of strings */ def getStringList(path: String): ju.List[String] /** - * Gets a list value with {@code Enum} elements. Throws if the - * path is unset or null or not a list or contains values not - * convertible to {@code Enum}. + * Gets a list value with {@code Enum} elements. Throws if the path is unset + * or null or not a list or contains values not convertible to {@code Enum}. * * @param enumClass - * the enum class - * @param < T> - * a generic denoting a specific type of enum + * the enum class + * @param [T] + * a generic denoting a specific type of enum * @param path - * the path to the list value. - * @return the list at the path + * the path to the list value. + * @return + * the list at the path * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to a list of { @code Enum} + * if value is not convertible to a list of { @code Enum} */ def getEnumList[T <: jl.Enum[T]]( enumClass: Class[T], @@ -916,62 +883,66 @@ trait Config extends ConfigMergeable { ): ju.List[T] /** - * Gets a list value with object elements. Throws if the - * path is unset or null or not a list or contains values not - * convertible to ConfigObject. + * Gets a list value with object elements. Throws if the path is unset or null + * or not a list or contains values not convertible to + * ConfigObject. * * @param path - * the path to the list value. - * @return the list at the path + * the path to the list value. + * @return + * the list at the path * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to a list of objects + * if value is not convertible to a list of objects */ def getObjectList(path: String): ju.List[_ <: ConfigObject] /** - * Gets a list value with Config elements. - * Throws if the path is unset or null or not a list or - * contains values not convertible to Config. + * Gets a list value with Config elements. Throws if the path is + * unset or null or not a list or contains values not convertible to + * Config. * * @param path - * the path to the list value. - * @return the list at the path + * the path to the list value. + * @return + * the list at the path * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to a list of configs + * if value is not convertible to a list of configs */ def getConfigList(path: String): ju.List[_ <: Config] /** - * Gets a list value with any kind of elements. Throws if the - * path is unset or null or not a list. Each element is - * "unwrapped" (see {@link ConfigValue#unwrapped}). + * Gets a list value with any kind of elements. Throws if the path is unset or + * null or not a list. Each element is "unwrapped" (see {@link + * ConfigValue#unwrapped}). * * @param path - * the path to the list value. - * @return the list at the path + * the path to the list value. + * @return + * the list at the path * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to a list + * if value is not convertible to a list */ def getAnyRefList(path: String): ju.List[_ <: AnyRef] /** - * Gets a list value with elements representing a size in - * bytes. Throws if the path is unset or null or not a list - * or contains values not convertible to memory sizes. + * Gets a list value with elements representing a size in bytes. Throws if the + * path is unset or null or not a list or contains values not convertible to + * memory sizes. * * @param path - * the path to the list value. - * @return the list at the path + * the path to the list value. + * @return + * the list at the path * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to a list of memory sizes + * if value is not convertible to a list of memory sizes */ def getBytesList(path: String): ju.List[jl.Long] @@ -981,12 +952,13 @@ trait Config extends ConfigMergeable { * * @since 1.3.0 * @param path - * a path expression - * @return list of memory sizes + * a path expression + * @return + * list of memory sizes * @throws ConfigException.Missing - * if value is absent or null + * if value is absent or null * @throws ConfigException.WrongType - * if value is not convertible to a list of memory sizes + * if value is not convertible to a list of memory sizes */ def getMemorySizeList(path: String): ju.List[ConfigMemorySize] @@ -997,10 +969,11 @@ trait Config extends ConfigMergeable { * * @since 1.2.0 * @param path - * a path expression + * a path expression * @param unit - * time units of the returned values - * @return list of durations, in the requested units + * time units of the returned values + * @return + * list of durations, in the requested units */ def getDurationList(path: String, unit: TimeUnit): ju.List[jl.Long] @@ -1010,75 +983,78 @@ trait Config extends ConfigMergeable { * * @since 1.3.0 * @param path - * a path expression - * @return list of durations + * a path expression + * @return + * list of durations */ def getDurationList(path: String): ju.List[Duration] /** - * Clone the config with only the given path (and its children) retained; - * all sibling paths are removed. - *

- * Note that path expressions have a syntax and sometimes require quoting - * (see [[ConfigUtil$.joinPath(elements:String*)*]] and {@link ConfigUtil#splitPath}). + * Clone the config with only the given path (and its children) retained; all + * sibling paths are removed.

Note that path expressions have a syntax and + * sometimes require quoting (see [[ConfigUtil$.joinPath(elements:String*)*]] + * and {@link ConfigUtil#splitPath}). * * @param path - * path to keep - * @return a copy of the config minus all paths except the one specified + * path to keep + * @return + * a copy of the config minus all paths except the one specified */ def withOnlyPath(path: String): Config /** - * Clone the config with the given path removed. - *

- * Note that path expressions have a syntax and sometimes require quoting - * (see [[ConfigUtil$.joinPath(elements:String*)*]] and {@link ConfigUtil#splitPath}). + * Clone the config with the given path removed.

Note that path + * expressions have a syntax and sometimes require quoting (see + * [[ConfigUtil$.joinPath(elements:String*)*]] and {@link + * ConfigUtil#splitPath}). * * @param path - * path expression to remove - * @return a copy of the config minus the specified path + * path expression to remove + * @return + * a copy of the config minus the specified path */ def withoutPath(path: String): Config /** - * Places the config inside another {@code Config} at the given path. - *

- * Note that path expressions have a syntax and sometimes require quoting - * (see [[ConfigUtil$.joinPath(elements:String*)*]] and {@link ConfigUtil#splitPath}). + * Places the config inside another {@code Config} at the given path.

Note + * that path expressions have a syntax and sometimes require quoting (see + * [[ConfigUtil$.joinPath(elements:String*)*]] and {@link + * ConfigUtil#splitPath}). * * @param path - * path expression to store this config at. - * @return a { @code Config} instance containing this config at the given - * path. + * path expression to store this config at. + * @return + * a { @code Config} instance containing this config at the given path. */ def atPath(path: String): Config /** * Places the config inside a {@code Config} at the given key. See also * atPath. Note that a key is NOT a path expression (see - * [[ConfigUtil$.joinPath(elements:String*)*]] and {@link ConfigUtil#splitPath}). + * [[ConfigUtil$.joinPath(elements:String*)*]] and {@link + * ConfigUtil#splitPath}). * * @param key - * key to store this config at. - * @return a {@code Config} instance containing this config at the given - * key. + * key to store this config at. + * @return + * a {@code Config} instance containing this config at the given key. */ def atKey(key: String): Config /** - * Returns a {@code Config} based on this one, but with the given path set - * to the given value. Does not modify this instance (since it's immutable). - * If the path already has a value, that value is replaced. To remove a - * value, use withoutPath. - *

- * Note that path expressions have a syntax and sometimes require quoting - * (see [[ConfigUtil$.joinPath(elements:String*)*]] and {@link ConfigUtil#splitPath}). + * Returns a {@code Config} based on this one, but with the given path set to + * the given value. Does not modify this instance (since it's immutable). If + * the path already has a value, that value is replaced. To remove a value, + * use withoutPath.

Note that path expressions have a syntax and sometimes + * require quoting (see [[ConfigUtil$.joinPath(elements:String*)*]] and {@link + * ConfigUtil#splitPath}). * * @param path - * path expression for the value's new location + * path expression for the value's new location * @param value - * value at the new path - * @return the new instance with the new map entry + * value at the new path + * @return + * the new instance with the new map entry */ def withValue(path: String, value: ConfigValue): Config } diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigException.scala b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigException.scala index 12108077..3a8d4151 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigException.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigException.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config @@ -15,8 +15,7 @@ import jl.reflect.Field import org.ekrich.config.impl.ConfigImplUtil /** - * All exceptions thrown by the library are subclasses of - * `ConfigException`. + * All exceptions thrown by the library are subclasses of `ConfigException`. */ @SerialVersionUID(1L) abstract class ConfigException(message: String, cause: Throwable) @@ -24,7 +23,11 @@ abstract class ConfigException(message: String, cause: Throwable) with Serializable { @transient var origin: ConfigOrigin = null - protected def this(origin: ConfigOrigin, message: String, cause: Throwable) = { + protected def this( + origin: ConfigOrigin, + message: String, + cause: Throwable + ) = { this(ConfigException.makeMessage(origin, message), cause) this.origin = origin } @@ -96,7 +99,6 @@ object ConfigException { /** * Exception indicating that the type of a value does not match the type you * requested. - * */ @SerialVersionUID(1L) class WrongType(origin: ConfigOrigin, message: String, cause: Throwable) @@ -150,8 +152,8 @@ object ConfigException { } /** - * Exception indicates that the setting was treated as missing because it - * was set to null. + * Exception indicates that the setting was treated as missing because it was + * set to null. */ @SerialVersionUID(1L) object Null { @@ -178,9 +180,7 @@ object ConfigException { /** * Exception indicating that a value was messed up, for example you may have - * asked for a duration and the value can't be sensibly parsed as a - * duration. - * + * asked for a duration and the value can't be sensibly parsed as a duration. */ @SerialVersionUID(1L) class BadValue(origin: ConfigOrigin, message: String, cause: Throwable) @@ -207,9 +207,8 @@ object ConfigException { } /** - * Exception indicating that a path expression was invalid. Try putting - * double quotes around path elements that contain "special" characters. - * + * Exception indicating that a path expression was invalid. Try putting double + * quotes around path elements that contain "special" characters. */ @SerialVersionUID(1L) class BadPath(origin: ConfigOrigin, message: String, cause: Throwable) @@ -245,11 +244,10 @@ object ConfigException { } /** - * Exception indicating that there's a bug in something (possibly the - * library itself) or the runtime environment is broken. This exception - * should never be handled; instead, something should be fixed to keep the - * exception from occurring. This exception can be thrown by any method in - * the library. + * Exception indicating that there's a bug in something (possibly the library + * itself) or the runtime environment is broken. This exception should never + * be handled; instead, something should be fixed to keep the exception from + * occurring. This exception can be thrown by any method in the library. */ @SerialVersionUID(1L) class BugOrBroken(message: String, cause: Throwable) @@ -259,7 +257,6 @@ object ConfigException { /** * Exception indicating that there was an IO error. - * */ @SerialVersionUID(1L) class IO(origin: ConfigOrigin, message: String, cause: Throwable) @@ -270,7 +267,6 @@ object ConfigException { /** * Exception indicating that there was a parse error. - * */ @SerialVersionUID(1L) class Parse(origin: ConfigOrigin, message: String, cause: Throwable) @@ -317,8 +313,9 @@ object ConfigException { */ @SerialVersionUID(1L) class ValidationProblem( - val path: String, // the path of the problem setting - @transient val origin: ConfigOrigin = null, // the origin of the problem setting + val path: String, // the path of the problem setting + @transient val origin: ConfigOrigin = + null, // the origin of the problem setting val problem: String ) // description of the problem extends Serializable { @@ -343,10 +340,10 @@ object ConfigException { } /** - * Exception indicating that [[Config#checkValid]] found validity - * problems. The problems are available via the [[ValidationFailed#problems]] method. - * The `getMessage` of this exception is a potentially very - * long string listing all the problems found. + * Exception indicating that [[Config#checkValid]] found validity problems. + * The problems are available via the [[ValidationFailed#problems]] method. + * The `getMessage` of this exception is a potentially very long string + * listing all the problems found. */ @SerialVersionUID(1L) object ValidationFailed { 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 ae9458d4..0d949968 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigFactory.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigFactory.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config @@ -14,54 +14,52 @@ import java.util.concurrent.Callable /** * Contains static methods for creating [[Config]] instances. * - * See also [[ConfigValueFactory]] which contains static methods for - * converting Java values into a [[ConfigObject]]. You can then convert a - * [[ConfigObject]] into a [[Config]] with [[ConfigObject#toConfig ConfigObject.toConfig()]]. + * See also [[ConfigValueFactory]] which contains static methods for converting + * Java values into a [[ConfigObject]]. You can then convert a [[ConfigObject]] + * into a [[Config]] with [[ConfigObject#toConfig ConfigObject.toConfig()]]. * * The static methods with "load" in the name do some sort of higher-level * operation potentially parsing multiple resources and resolving substitutions, - * while the ones with "parse" in the name just create a [[ConfigValue]] - * from a resource and nothing else. + * while the ones with "parse" in the name just create a [[ConfigValue]] from a + * resource and nothing else. * * You can find an example app and library package - * overview which describes the big picture as shown in those - * examples. + * [[https://github.com/ekrich/sconfig/tree/master/examples on GitHub]]. Also be + * sure to read the package + * overview which describes the big picture as shown in those examples. */ object ConfigFactory { private val STRATEGY_PROPERTY_NAME = "config.strategy" /** * Loads an application's configuration from the given classpath resource or - * classpath resource basename, sandwiches it between default reference - * config and default overrides, and then resolves it. The classpath - * resource is "raw" (it should have no "/" prefix, and is not made relative - * to any package, so it's like `ClassLoader.getResource` not - * `Class.getResource`). + * classpath resource basename, sandwiches it between default reference config + * and default overrides, and then resolves it. The classpath resource is + * "raw" (it should have no "/" prefix, and is not made relative to any + * package, so it's like `ClassLoader.getResource` not `Class.getResource`). * * Resources are loaded from the current thread's * `Thread.getContextClassLoader`. In general, a library needs its * configuration to come from the class loader used to load that library, so * the proper "reference.conf" are present. * - * The loaded object will already be resolved (substitutions have already - * been processed). As a result, if you add more fallbacks then they won't - * be seen by substitutions. Substitutions are the `\${foo.bar}` syntax. If - * you want to parse additional files or something then you need to use + * The loaded object will already be resolved (substitutions have already been + * processed). As a result, if you add more fallbacks then they won't be seen + * by substitutions. Substitutions are the `\${foo.bar}` syntax. If you want + * to parse additional files or something then you need to use * [[#load(config:org\.ekrich\.config\.Config)* load(Config)]]. * * To load a standalone resource (without the default reference and default * overrides), use * [[#parseResourcesAnySyntax(resourceBasename:String)* parseResourcesAnySyntax(String)]] - * rather than this - * method. To load only the reference config use [[#defaultReference()* defaultReference()]] - * and to load only the overrides use [[#defaultOverrides()* defaultOverrides()]]. + * rather than this method. To load only the reference config use + * [[#defaultReference()* defaultReference()]] and to load only the overrides + * use [[#defaultOverrides()* defaultOverrides()]]. * * @param resourceBasename - * name (optionally without extension) of a resource on classpath - * @return configuration for an application relative to context class loader + * name (optionally without extension) of a resource on classpath + * @return + * configuration for an application relative to context class loader */ def load(resourceBasename: String): Config = load( @@ -71,20 +69,24 @@ object ConfigFactory { ) /** - * Like [[#load(resourceBasename:String)* ConfigFactory.load(String)]] - * but uses the supplied class loader instead of the current thread's - * context class loader. + * Like [[#load(resourceBasename:String)* ConfigFactory.load(String)]] but + * uses the supplied class loader instead of the current thread's context + * class loader. * * To load a standalone resource (without the default reference and default * overrides), use * [[#parseResourcesAnySyntax(loader:ClassLoader,resourceBasename:String)* parseResourcesAnySyntax(ClassLoader,String)]] * rather than this method. To load only the reference config use - * [[#defaultReference(loader:ClassLoader)* defaultReference(ClassLoader)]] and to load only the overrides use + * [[#defaultReference(loader:ClassLoader)* defaultReference(ClassLoader)]] + * and to load only the overrides use * [[#defaultOverrides(loader:ClassLoader)* defaultOverrides(ClassLoader)]]. * - * @param loader class loader to look for resources in - * @param resourceBasename basename (no .conf/.json/.properties suffix) - * @return configuration for an application relative to given class loader + * @param loader + * class loader to look for resources in + * @param resourceBasename + * basename (no .conf/.json/.properties suffix) + * @return + * configuration for an application relative to given class loader */ def load(loader: ClassLoader, resourceBasename: String): Config = load( @@ -94,16 +96,17 @@ object ConfigFactory { ) /** - * Like [[#load(resourceBasename:String)* ConfigFactory.load(String)]] - * but allows you to specify parse and resolve options. + * Like [[#load(resourceBasename:String)* ConfigFactory.load(String)]] but + * allows you to specify parse and resolve options. * * @param resourceBasename - * the classpath resource name with optional extension + * the classpath resource name with optional extension * @param parseOptions - * options to use when parsing the resource + * options to use when parsing the resource * @param resolveOptions - * options to use when resolving the stack - * @return configuration for an application + * options to use when resolving the stack + * @return + * configuration for an application */ def load( resourceBasename: String, @@ -123,16 +126,16 @@ object ConfigFactory { * [[ConfigParseOptions]]. * * @param loader - * class loader in which to find resources (overrides loader in - * parse options) + * class loader in which to find resources (overrides loader in parse + * options) * @param resourceBasename - * the classpath resource name with optional extension + * the classpath resource name with optional extension * @param parseOptions - * options to use when parsing the resource (class loader - * overridden) + * options to use when parsing the resource (class loader overridden) * @param resolveOptions - * options to use when resolving the stack - * @return configuration for an application + * options to use when resolving the stack + * @return + * configuration for an application */ def load( loader: ClassLoader, @@ -160,40 +163,43 @@ object ConfigFactory { else options /** - * Assembles a standard configuration using a custom `Config` - * object rather than loading "application.conf". The `Config` - * object will be sandwiched between the default reference config and - * default overrides and then resolved. + * Assembles a standard configuration using a custom `Config` object rather + * than loading "application.conf". The `Config` object will be sandwiched + * between the default reference config and default overrides and then + * resolved. * * @param config - * the application's portion of the configuration - * @return resolved configuration with overrides and fallbacks added + * the application's portion of the configuration + * @return + * resolved configuration with overrides and fallbacks added */ def load(config: Config): Config = load(checkedContextClassLoader("load"), config) /** - * Like [[#load(config:org\.ekrich\.config\.Config)* load(Config)]] - * but allows you to specify the class loader for looking up resources. + * Like [[#load(config:org\.ekrich\.config\.Config)* load(Config)]] but allows + * you to specify the class loader for looking up resources. * * @param loader - * the class loader to use to find resources + * the class loader to use to find resources * @param config - * the application's portion of the configuration - * @return resolved configuration with overrides and fallbacks added + * the application's portion of the configuration + * @return + * resolved configuration with overrides and fallbacks added */ def load(loader: ClassLoader, config: Config): Config = load(loader, config, ConfigResolveOptions.defaults) /** - * Like [[#load(config:org\.ekrich\.config\.Config)* load(Config)]] - * but allows you to specify [[ConfigResolveOptions]]. + * Like [[#load(config:org\.ekrich\.config\.Config)* load(Config)]] but allows + * you to specify [[ConfigResolveOptions]]. * * @param config - * the application's portion of the configuration + * the application's portion of the configuration * @param resolveOptions - * options for resolving the assembled config stack - * @return resolved configuration with overrides and fallbacks added + * options for resolving the assembled config stack + * @return + * resolved configuration with overrides and fallbacks added */ def load(config: Config, resolveOptions: ConfigResolveOptions): Config = load(checkedContextClassLoader("load"), config, resolveOptions) @@ -201,16 +207,17 @@ object ConfigFactory { /** * Like * [[#load(config:org\.ekrich\.config\.Config,resolveOptions:org\.ekrich\.config\.ConfigResolveOptions)* load(Config,ConfigResolveOptions)]] - * but allows you to specify a class loader other than the context class loader. + * but allows you to specify a class loader other than the context class + * loader. * * @param loader - * class loader to use when looking up override and reference - * configs + * class loader to use when looking up override and reference configs * @param config - * the application's portion of the configuration + * the application's portion of the configuration * @param resolveOptions - * options for resolving the assembled config stack - * @return resolved configuration with overrides and fallbacks added + * options for resolving the assembled config stack + * @return + * resolved configuration with overrides and fallbacks added */ def load( loader: ClassLoader, @@ -225,15 +232,16 @@ object ConfigFactory { /** * Loads a default configuration, equivalent to * [[#load(config:org\.ekrich\.config\.Config)* load(Config)]] - * `ConfigFactory.load(defaultApplication()) in most cases. This - * configuration should be used by libraries and frameworks unless an - * application provides a different one. + * `ConfigFactory.load(defaultApplication()) in most cases. This configuration + * should be used by libraries and frameworks unless an application provides a + * different one. * - * This method may return a cached singleton so will not see changes to - * system properties or config files. (Use [[#invalidateCaches invalidateCaches()]] to - * force it to reload.) + * This method may return a cached singleton so will not see changes to system + * properties or config files. (Use [[#invalidateCaches invalidateCaches()]] + * to force it to reload.) * - * @return configuration for an application + * @return + * configuration for an application */ def load(): Config = { val loader = checkedContextClassLoader("load") @@ -244,19 +252,21 @@ object ConfigFactory { * Like [[#load()* load()]] but allows specifying parse options. * * @param parseOptions - * Options for parsing resources - * @return configuration for an application + * Options for parsing resources + * @return + * configuration for an application */ def load(parseOptions: ConfigParseOptions): Config = load(parseOptions, ConfigResolveOptions.defaults) /** - * Like [[#load()* load()]] but allows specifying a class loader other than the - * thread's current context class loader. + * Like [[#load()* load()]] but allows specifying a class loader other than + * the thread's current context class loader. * * @param loader - * class loader for finding resources - * @return configuration for an application + * class loader for finding resources + * @return + * configuration for an application */ def load(loader: ClassLoader): Config = { val withLoader = @@ -269,42 +279,46 @@ object ConfigFactory { } /** - * Like [[#load()* load()]] but allows specifying a class loader other than the - * thread's current context class loader and also specify parse options. + * Like [[#load()* load()]] but allows specifying a class loader other than + * the thread's current context class loader and also specify parse options. * * @param loader - * class loader for finding resources (overrides any loader in parseOptions) + * class loader for finding resources (overrides any loader in parseOptions) * @param parseOptions - * Options for parsing resources - * @return configuration for an application + * Options for parsing resources + * @return + * configuration for an application */ def load(loader: ClassLoader, parseOptions: ConfigParseOptions): Config = load(parseOptions.setClassLoader(loader)) /** - * Like [[#load()* load()]] but allows specifying a class loader other than the - * thread's current context class loader and also specify resolve options. + * Like [[#load()* load()]] but allows specifying a class loader other than + * the thread's current context class loader and also specify resolve options. * * @param loader - * class loader for finding resources + * class loader for finding resources * @param resolveOptions - * options for resolving the assembled config stack - * @return configuration for an application + * options for resolving the assembled config stack + * @return + * configuration for an application */ def load(loader: ClassLoader, resolveOptions: ConfigResolveOptions): Config = load(loader, ConfigParseOptions.defaults, resolveOptions) /** - * Like [[#load()* load()]] but allows specifying a class loader other than the - * thread's current context class loader, parse options, and resolve options. + * Like [[#load()* load()]] but allows specifying a class loader other than + * the thread's current context class loader, parse options, and resolve + * options. * * @param loader - * class loader for finding resources (overrides any loader in parseOptions) + * class loader for finding resources (overrides any loader in parseOptions) * @param parseOptions - * Options for parsing resources + * Options for parsing resources * @param resolveOptions - * options for resolving the assembled config stack - * @return configuration for an application + * options for resolving the assembled config stack + * @return + * configuration for an application */ def load( loader: ClassLoader, @@ -320,10 +334,11 @@ object ConfigFactory { * options. * * @param parseOptions - * Options for parsing resources + * Options for parsing resources * @param resolveOptions - * options for resolving the assembled config stack - * @return configuration for an application + * options for resolving the assembled config stack + * @return + * configuration for an application * @since 1.3.0 */ def load( @@ -335,38 +350,39 @@ object ConfigFactory { } /** - * Obtains the default reference configuration, which is currently created - * by merging all resources "reference.conf" found on the classpath and + * Obtains the default reference configuration, which is currently created by + * merging all resources "reference.conf" found on the classpath and * overriding the result with system properties. The returned reference * configuration will already have substitutions resolved. * - * Libraries and frameworks should ship with a "reference.conf" in their - * jar. + * Libraries and frameworks should ship with a "reference.conf" in their jar. * * The reference config must be looked up in the class loader that contains * the libraries that you want to use with this config, so the * "reference.conf" for each library can be found. Use - * [[#defaultReference(loader:ClassLoader)* defaultReference(ClassLoader)]] if the context class loader is not - * suitable. + * [[#defaultReference(loader:ClassLoader)* defaultReference(ClassLoader)]] if + * the context class loader is not suitable. * * The [[#load()* load()]] methods merge this configuration for you * automatically. * - * Future versions may look for reference configuration in more places. It - * is not guaranteed that this method ''only'' looks at - * "reference.conf". + * Future versions may look for reference configuration in more places. It is + * not guaranteed that this method ''only'' looks at "reference.conf". * - * @return the default reference config for context class loader + * @return + * the default reference config for context class loader */ def defaultReference(): Config = defaultReference(checkedContextClassLoader("defaultReference")) /** - * Like [[#defaultReference()* defaultReference()]] but allows you to specify a class loader - * to use rather than the current context class loader. + * Like [[#defaultReference()* defaultReference()]] but allows you to specify + * a class loader to use rather than the current context class loader. * - * @param loader class loader to look for resources in - * @return the default reference config for this class loader + * @param loader + * class loader to look for resources in + * @return + * the default reference config for this class loader */ def defaultReference(loader: ClassLoader): Config = ConfigImpl.defaultReference(loader) @@ -379,59 +395,54 @@ object ConfigFactory { * The [[#load()* load()]] methods merge this configuration for you * automatically. * - * Future versions may get overrides in more places. It is not guaranteed - * that this method only uses system properties. + * Future versions may get overrides in more places. It is not guaranteed that + * this method only uses system properties. * - * @return the default override configuration + * @return + * the default override configuration */ def defaultOverrides(): Config = systemProperties() /** - * Like [[#defaultOverrides()* defaultOverrides()]] but allows you to specify a class loader - * to use rather than the current context class loader. + * Like [[#defaultOverrides()* defaultOverrides()]] but allows you to specify + * a class loader to use rather than the current context class loader. * - * @param loader class loader to look for resources in - * @return the default override configuration + * @param loader + * class loader to look for resources in + * @return + * the default override configuration */ def defaultOverrides(loader: ClassLoader): Config = systemProperties() /** - * Obtains the default application-specific configuration, - * which defaults to parsing `application.conf`, - * `application.json`, and - * `application.properties` on the classpath, but - * can also be rerouted using the `config.file`, - * `config.resource`, and `config.url` - * system properties. + * Obtains the default application-specific configuration, which defaults to + * parsing `application.conf`, `application.json`, and + * `application.properties` on the classpath, but can also be rerouted using + * the `config.file`, `config.resource`, and `config.url` system properties. * * The no-arguments [[#load()* load()]] method automatically stacks the * [[#defaultReference()* defaultReference()]], - * [[#defaultApplication()* defaultApplication()]], - * and [[#defaultOverrides()* defaultOverrides()]] - * configs. You would use `defaultApplication()` - * directly only if you're somehow customizing behavior by - * reimplementing `load()`. - * - * The configuration returned by - * `defaultApplication()` will not be resolved - * already, in contrast to `defaultReference()` and - * `defaultOverrides()`. This is because - * application.conf would normally be resolved ''after'' - * merging with the reference and override configs. - * - * If the system properties `config.resource`, - * `config.file`, or `config.url` are set, then the - * classpath resource, file, or URL specified in those properties will be - * used rather than the default - * `application.{conf,json,properties]]` classpath resources. - * These system properties should not be set in code (after all, you can - * just parse whatever you want manually and then use - * [[#load(config:org\.ekrich\.config\.Config)* load(Config)]] - * if you don't want to use `application.conf`). The properties - * are intended for use by the person or script launching the application. - * For example someone might have a `production.conf` that - * include `application.conf` but then change a couple of values. - * When launching the app they could specify + * [[#defaultApplication()* defaultApplication()]], and + * [[#defaultOverrides()* defaultOverrides()]] configs. You would use + * `defaultApplication()` directly only if you're somehow customizing behavior + * by reimplementing `load()`. + * + * The configuration returned by `defaultApplication()` will not be resolved + * already, in contrast to `defaultReference()` and `defaultOverrides()`. This + * is because application.conf would normally be resolved ''after'' merging + * with the reference and override configs. + * + * If the system properties `config.resource`, `config.file`, or `config.url` + * are set, then the classpath resource, file, or URL specified in those + * properties will be used rather than the default + * `application.{conf,json,properties]]` classpath resources. These system + * properties should not be set in code (after all, you can just parse + * whatever you want manually and then use + * [[#load(config:org\.ekrich\.config\.Config)* load(Config)]] if you don't + * want to use `application.conf`). The properties are intended for use by the + * person or script launching the application. For example someone might have + * a `production.conf` that include `application.conf` but then change a + * couple of values. When launching the app they could specify * `-Dconfig.resource=production.conf` to get production mode. * * If no system properties are set to change the location of the default @@ -439,28 +450,34 @@ object ConfigFactory { * `ConfigFactory.parseResources("application")`. * * @since 1.3.0 - * @return the default application.conf or system-property-configured configuration + * @return + * the default application.conf or system-property-configured configuration */ def defaultApplication(): Config = defaultApplication(ConfigParseOptions.defaults) /** - * Like [[#defaultApplication()* defaultApplication()]] but allows you to specify a class loader - * to use rather than the current context class loader. + * Like [[#defaultApplication()* defaultApplication()]] but allows you to + * specify a class loader to use rather than the current context class loader. * * @since 1.3.0 - * @param loader class loader to look for resources in - * @return the default application configuration + * @param loader + * class loader to look for resources in + * @return + * the default application configuration */ def defaultApplication(loader: ClassLoader): Config = defaultApplication(ConfigParseOptions.defaults.setClassLoader(loader)) /** - * Like [[#defaultApplication()* defaultApplication()]] but allows you to specify parse options. + * Like [[#defaultApplication()* defaultApplication()]] but allows you to + * specify parse options. * * @since 1.3.0 - * @param options the options - * @return the default application configuration + * @param options + * the options + * @return + * the default application configuration */ def defaultApplication(options: ConfigParseOptions): Config = getConfigLoadingStrategy.parseApplicationConfig( @@ -469,22 +486,22 @@ object ConfigFactory { /** * Reloads any cached configs, picking up changes to system properties for - * example. Because a [[Config]] is immutable, anyone with a reference - * to the old configs will still have the same outdated objects. However, - * new calls to [[#load()* load()]] or [[#defaultOverrides()* defaultOverrides()]] - * or [[#defaultReference()* defaultReference()]] may return a new object. + * example. Because a [[Config]] is immutable, anyone with a reference to the + * old configs will still have the same outdated objects. However, new calls + * to [[#load()* load()]] or [[#defaultOverrides()* defaultOverrides()]] or + * [[#defaultReference()* defaultReference()]] may return a new object. * - * This method is primarily intended for use in unit tests, for example, - * that may want to update a system property then confirm that it's used - * correctly. In many cases, use of this method may indicate there's a - * better way to set up your code. + * This method is primarily intended for use in unit tests, for example, that + * may want to update a system property then confirm that it's used correctly. + * In many cases, use of this method may indicate there's a better way to set + * up your code. * * Caches may be reloaded immediately or lazily; once you call this method, - * the reload can occur at any time, even during the invalidation process. - * So FIRST make the changes you'd like the caches to notice, then SECOND - * call this method to invalidate caches. Don't expect that invalidating, - * making changes, then calling [[#load()* load()]], will work. Make changes - * before you invalidate. + * the reload can occur at any time, even during the invalidation process. So + * FIRST make the changes you'd like the caches to notice, then SECOND call + * this method to invalidate caches. Don't expect that invalidating, making + * changes, then calling [[#load()* load()]], will work. Make changes before + * you invalidate. */ def invalidateCaches(): Unit = { // We rely on this having the side effect that it drops all caches @@ -494,25 +511,27 @@ object ConfigFactory { /** * Gets an empty configuration. See also - * [[#empty(originDescription:String)* empty(String)]] to create an - * empty configuration with a description, which may improve user-visible - * error messages. + * [[#empty(originDescription:String)* empty(String)]] to create an empty + * configuration with a description, which may improve user-visible error + * messages. * - * @return an empty configuration + * @return + * an empty configuration */ def empty(): Config = empty(null) /** * Gets an empty configuration with a description to be used to create a - * [[ConfigOrigin]] for this `Config`. The description should - * be very short and say what the configuration is, like "default settings" - * or "foo settings" or something. (Presumably you will merge some actual - * settings into this empty config using [[Config.withFallback]], making - * the description more useful.) + * [[ConfigOrigin]] for this `Config`. The description should be very short + * and say what the configuration is, like "default settings" or "foo + * settings" or something. (Presumably you will merge some actual settings + * into this empty config using [[Config.withFallback]], making the + * description more useful.) * * @param originDescription - * description of the config - * @return an empty configuration + * description of the config + * @return + * an empty configuration */ def empty(originDescription: String): Config = ConfigImpl.emptyConfig(originDescription) @@ -522,55 +541,59 @@ object ConfigFactory { * `java.lang.System.getProperties()`, parsed and converted as with * [[ConfigFactory$.parseProperties(properties:java\.util\.Properties)* parseProperties(Properties)]]. * - * This method can return a global immutable singleton, so it's preferred - * over parsing system properties yourself. + * This method can return a global immutable singleton, so it's preferred over + * parsing system properties yourself. * - * [[#load()* ConfigFactory.load()]] will include the system properties as overrides already, as - * will [[#defaultReference()* defaultReference()]] and [[#defaultOverrides()* defaultOverrides()]]. + * [[#load()* ConfigFactory.load()]] will include the system properties as + * overrides already, as will [[#defaultReference()* defaultReference()]] and + * [[#defaultOverrides()* defaultOverrides()]]. * * Because this returns a singleton, it will not notice changes to system * properties made after the first time this method is called. Use - * [[#invalidateCaches invalidateCaches()]] to force the singleton to reload if you - * modify system properties. + * [[#invalidateCaches invalidateCaches()]] to force the singleton to reload + * if you modify system properties. * - * @return system properties parsed into a [[Config]] + * @return + * system properties parsed into a [[Config]] */ def systemProperties(): Config = ConfigImpl.systemPropertiesAsConfig /** - * Gets a [[Config]] containing the system's environment variables. - * This method can return a global immutable singleton. + * Gets a [[Config]] containing the system's environment variables. This + * method can return a global immutable singleton. * * Environment variables are used as fallbacks when resolving substitutions - * whether or not this object is included in the config being resolved, so - * you probably don't need to use this method for most purposes. It can be a - * nicer API for accessing environment variables than raw - * `java.lang.System.getenv(String)` though, since you can use methods - * such as [[Config.getInt]]. - * - * @return system environment variables parsed into a `Config` + * whether or not this object is included in the config being resolved, so you + * probably don't need to use this method for most purposes. It can be a nicer + * API for accessing environment variables than raw + * `java.lang.System.getenv(String)` though, since you can use methods such as + * [[Config.getInt]]. + * + * @return + * system environment variables parsed into a `Config` */ def systemEnvironment(): Config = ConfigImpl.envVariablesAsConfig /** - * Converts a Java `java.util.Properties` object to a - * [[ConfigObject]] using the rules documented in the - * [[https://github.com/ekrich/sconfig/blob/master/HOCON.md HOCON spec]] - * The keys in the `Properties` object are split on the - * period character '.' and treated as paths. The values will all end up as - * string values. If you have both "a=foo" and "a.b=bar" in your properties - * file, so "a" is both the object containing "b" and the string "foo", then - * the string value is dropped. - * - * If you want to have `System.getProperties()` as a - * ConfigObject, it's better to use the [[#systemProperties]] method - * which returns a cached global singleton. + * Converts a Java `java.util.Properties` object to a [[ConfigObject]] using + * the rules documented in the + * [[https://github.com/ekrich/sconfig/blob/master/HOCON.md HOCON spec]] The + * keys in the `Properties` object are split on the period character '.' and + * treated as paths. The values will all end up as string values. If you have + * both "a=foo" and "a.b=bar" in your properties file, so "a" is both the + * object containing "b" and the string "foo", then the string value is + * dropped. + * + * If you want to have `System.getProperties()` as a ConfigObject, it's better + * to use the [[#systemProperties]] method which returns a cached global + * singleton. * * @param properties - * a Java Properties object + * a Java Properties object * @param options - * the parse options - * @return the parsed configuration + * the parse options + * @return + * the parsed configuration */ def parseProperties( properties: Properties, @@ -584,26 +607,28 @@ object ConfigFactory { * but uses default parse options. * * @param properties - * a Java Properties object - * @return the parsed configuration + * a Java Properties object + * @return + * the parsed configuration */ def parseProperties(properties: Properties): Config = parseProperties(properties, ConfigParseOptions.defaults) /** * Parses a Reader into a Config instance. Does not call - * [[Config!.resolve()* Config.resolve()]] or merge the parsed stream with - * any other configuration; this method parses a single stream and - * does nothing else. It does process "include" statements in - * the parsed stream, and may end up doing other IO due to those - * statements. + * [[Config!.resolve()* Config.resolve()]] or merge the parsed stream with any + * other configuration; this method parses a single stream and does nothing + * else. It does process "include" statements in the parsed stream, and may + * end up doing other IO due to those statements. * * @param reader - * the reader to parse + * the reader to parse * @param options - * parse options to control how the reader is interpreted - * @return the parsed configuration - * @throws ConfigException on IO or parse errors + * parse options to control how the reader is interpreted + * @return + * the parsed configuration + * @throws ConfigException + * on IO or parse errors */ def parseReader(reader: Reader, options: ConfigParseOptions): Config = Parseable.newReader(reader, options).parse().toConfig @@ -614,27 +639,30 @@ object ConfigFactory { * but always uses the default parse options. * * @param reader - * the reader to parse - * @return the parsed configuration - * @throws ConfigException on IO or parse errors + * the reader to parse + * @return + * the parsed configuration + * @throws ConfigException + * on IO or parse errors */ def parseReader(reader: Reader): Config = parseReader(reader, ConfigParseOptions.defaults) /** * Parses a URL into a Config instance. Does not call - * [[Config!.resolve()* Config.resolve()]] or merge the parsed stream with - * any other configuration; this method parses a single stream and - * does nothing else. It does process "include" statements in - * the parsed stream, and may end up doing other IO due to those - * statements. + * [[Config!.resolve()* Config.resolve()]] or merge the parsed stream with any + * other configuration; this method parses a single stream and does nothing + * else. It does process "include" statements in the parsed stream, and may + * end up doing other IO due to those statements. * * @param url - * the url to parse + * the url to parse * @param options - * parse options to control how the url is interpreted - * @return the parsed configuration - * @throws ConfigException on IO or parse errors + * parse options to control how the url is interpreted + * @return + * the parsed configuration + * @throws ConfigException + * on IO or parse errors */ def parseURL(url: URL, options: ConfigParseOptions): Config = Parseable.newURL(url, options).parse().toConfig @@ -645,26 +673,29 @@ object ConfigFactory { * but always uses the default parse options. * * @param url - * the url to parse - * @return the parsed configuration - * @throws ConfigException on IO or parse errors + * the url to parse + * @return + * the parsed configuration + * @throws ConfigException + * on IO or parse errors */ def parseURL(url: URL): Config = parseURL(url, ConfigParseOptions.defaults) /** * Parses a file into a Config instance. Does not call - * [[Config!.resolve()* Config.resolve()]] or merge the file with any - * other configuration; this method parses a single file and does - * nothing else. It does process "include" statements in the - * parsed file, and may end up doing other IO due to those - * statements. + * [[Config!.resolve()* Config.resolve()]] or merge the file with any other + * configuration; this method parses a single file and does nothing else. It + * does process "include" statements in the parsed file, and may end up doing + * other IO due to those statements. * * @param file - * the file to parse + * the file to parse * @param options - * parse options to control how the file is interpreted - * @return the parsed configuration - * @throws ConfigException on IO or parse errors + * parse options to control how the file is interpreted + * @return + * the parsed configuration + * @throws ConfigException + * on IO or parse errors */ def parseFile(file: File, options: ConfigParseOptions): Config = Parseable.newFile(file, options).parse().toConfig @@ -675,19 +706,21 @@ object ConfigFactory { * but always uses the default parse options. * * @param file - * the file to parse - * @return the parsed configuration - * @throws ConfigException on IO or parse errors + * the file to parse + * @return + * the parsed configuration + * @throws ConfigException + * on IO or parse errors */ def parseFile(file: File): Config = parseFile(file, ConfigParseOptions.defaults) /** - * Parses a file with a flexible extension. If the `fileBasename` - * already ends in a known extension, this method parses it according to - * that extension (the file's syntax must match its extension). If the - * `fileBasename` does not end in an extension, it parses files - * with all known extensions and merges whatever is found. + * Parses a file with a flexible extension. If the `fileBasename` already ends + * in a known extension, this method parses it according to that extension + * (the file's syntax must match its extension). If the `fileBasename` does + * not end in an extension, it parses files with all known extensions and + * merges whatever is found. * * In the current implementation, the extension ".conf" forces * [[ConfigSyntax.CONF]], ".json" forces [[ConfigSyntax.JSON]], and @@ -698,18 +731,18 @@ object ConfigFactory { * additional extensions. However, the ordering (fallback priority) of the * three current extensions will remain the same. * - * If `options` forces a specific syntax, this method only parses - * files with an extension matching that syntax. + * If `options` forces a specific syntax, this method only parses files with + * an extension matching that syntax. * - * If [[ConfigParseOptions#getAllowMissing]] - * is true, then no files have to exist; if false, then at least one file - * has to exist. + * If [[ConfigParseOptions#getAllowMissing]] is true, then no files have to + * exist; if false, then at least one file has to exist. * * @param fileBasename - * a filename with or without extension + * a filename with or without extension * @param options - * parse options - * @return the parsed configuration + * parse options + * @return + * the parsed configuration */ def parseFileAnySyntax( fileBasename: File, @@ -723,8 +756,9 @@ object ConfigFactory { * but always uses default parse options. * * @param fileBasename - * a filename with or without extension - * @return the parsed configuration + * a filename with or without extension + * @return + * the parsed configuration */ def parseFileAnySyntax(fileBasename: File): Config = parseFileAnySyntax(fileBasename, ConfigParseOptions.defaults) @@ -738,23 +772,23 @@ object ConfigFactory { * `java.lang.Class.getResource`. * * Duplicate resources with the same name are merged such that ones returned - * earlier from `ClassLoader.getResources` fall back to (have higher - * priority than) the ones returned later# This implies that resources - * earlier in the classpath override those later in the classpath when they - * configure the same setting# However, in practice real applications may - * not be consistent about classpath ordering, so be careful# It may be best - * to avoid assuming too much# + * earlier from `ClassLoader.getResources` fall back to (have higher priority + * than) the ones returned later# This implies that resources earlier in the + * classpath override those later in the classpath when they configure the + * same setting# However, in practice real applications may not be consistent + * about classpath ordering, so be careful# It may be best to avoid assuming + * too much# * * @param klass - * `klass.getClassLoader()` will be used to load - * resources, and non-absolute resource names will have this - * class's package added + * `klass.getClassLoader()` will be used to load resources, and non-absolute + * resource names will have this class's package added * @param resource - * resource to look up, relative to `klass`'s package - * or absolute starting with a "/" + * resource to look up, relative to `klass`'s package or absolute starting + * with a "/" * @param options - * parse options - * @return the parsed configuration + * parse options + * @return + * the parsed configuration */ def parseResources( klass: Class[_], @@ -769,13 +803,13 @@ object ConfigFactory { * but always uses default parse options. * * @param klass - * `klass.getClassLoader()` will be used to load - * resources, and non-absolute resource names will have this - * class's package added + * `klass.getClassLoader()` will be used to load resources, and non-absolute + * resource names will have this class's package added * @param resource - * resource to look up, relative to `klass`'s package - * or absolute starting with a "/" - * @return the parsed configuration + * resource to look up, relative to `klass`'s package or absolute starting + * with a "/" + * @return + * the parsed configuration */ def parseResources(klass: Class[_], resource: String): Config = parseResources(klass, resource, ConfigParseOptions.defaults) @@ -784,30 +818,31 @@ object ConfigFactory { * Parses classpath resources with a flexible extension. In general, this * method has the same behavior as * [[#parseFileAnySyntax(fileBasename:java\.io\.File,options:org\.ekrich\.config\.ConfigParseOptions)* parseFileAnySyntax(File,ConfigParseOptions)]] - * but for classpath resources instead, as in [[#parseResources(resource:String)* parseResources(String)]]. + * but for classpath resources instead, as in + * [[#parseResources(resource:String)* parseResources(String)]]. * * There is a thorny problem with this method, which is that - * `java.lang.ClassLoader.getResources` must be called separately for - * each possible extension. The implementation ends up with separate lists - * of resources called "basename.conf" and "basename.json" for example. As a + * `java.lang.ClassLoader.getResources` must be called separately for each + * possible extension. The implementation ends up with separate lists of + * resources called "basename.conf" and "basename.json" for example. As a * result, the ideal ordering between two files with different extensions is * unknown; there is no way to figure out how to merge the two lists in - * classpath order. To keep it simple, the lists are simply concatenated, - * with the same syntax priorities as + * classpath order. To keep it simple, the lists are simply concatenated, with + * the same syntax priorities as * [[#parseFileAnySyntax(fileBasename:java\.io\.File,options:org\.ekrich\.config\.ConfigParseOptions)* parseFileAnySyntax(File,ConfigParseOptions)]] - * - all ".conf" resources are ahead of all ".json" resources which are - * ahead of all ".properties" resources. + * - all ".conf" resources are ahead of all ".json" resources which are + * ahead of all ".properties" resources. * * @param klass - * class which determines the `ClassLoader` and the - * package for relative resource names + * class which determines the `ClassLoader` and the package for relative + * resource names * @param resourceBasename - * a resource name as in `java.lang.Class.getResource`, - * with or without extension + * a resource name as in `java.lang.Class.getResource`, with or without + * extension * @param options - * parse options (class loader is ignored in favor of the one - * from klass) - * @return the parsed configuration + * parse options (class loader is ignored in favor of the one from klass) + * @return + * the parsed configuration */ def parseResourcesAnySyntax( klass: Class[_], @@ -824,13 +859,13 @@ object ConfigFactory { * but always uses default parse options. * * @param klass - * `klass.getClassLoader()` will be used to load - * resources, and non-absolute resource names will have this - * class's package added + * `klass.getClassLoader()` will be used to load resources, and non-absolute + * resource names will have this class's package added * @param resourceBasename - * a resource name as in `java.lang.Class.getResource`, - * with or without extension - * @return the parsed configuration + * a resource name as in `java.lang.Class.getResource`, with or without + * extension + * @return + * the parsed configuration */ def parseResourcesAnySyntax( klass: Class[_], @@ -847,21 +882,21 @@ object ConfigFactory { * into a single `Config`. * * This works like `java.lang.ClassLoader.getResource`, not like - * `java.lang.Class.getResource`, so the name never begins with a - * slash. + * `java.lang.Class.getResource`, so the name never begins with a slash. * * See * [[#parseResources(klass:Class[_],resource:String,options:org\.ekrich\.config\.ConfigParseOptions)* parseResources(Class,String,ConfigParseOptions)]] * for full details. * * @param loader - * will be used to load resources by setting this loader on the - * provided options + * will be used to load resources by setting this loader on the provided + * options * @param resource - * resource to look up + * resource to look up * @param options - * parse options (class loader is ignored) - * @return the parsed configuration + * parse options (class loader is ignored) + * @return + * the parsed configuration */ def parseResources( loader: ClassLoader, @@ -876,10 +911,11 @@ object ConfigFactory { * but always uses default parse options. * * @param loader - * will be used to load resources + * will be used to load resources * @param resource - * resource to look up in the loader - * @return the parsed configuration + * resource to look up in the loader + * @return + * the parsed configuration */ def parseResources(loader: ClassLoader, resource: String): Config = parseResources(loader, resource, ConfigParseOptions.defaults) @@ -896,14 +932,14 @@ object ConfigFactory { * some details and caveats on this method. * * @param loader - * class loader to look up resources in, will be set on options + * class loader to look up resources in, will be set on options * @param resourceBasename - * a resource name as in - * `java.lang.ClassLoader.getResource`, with or without - * extension + * a resource name as in `java.lang.ClassLoader.getResource`, with or + * without extension * @param options - * parse options (class loader ignored) - * @return the parsed configuration + * parse options (class loader ignored) + * @return + * the parsed configuration */ def parseResourcesAnySyntax( loader: ClassLoader, @@ -920,12 +956,12 @@ object ConfigFactory { * but always uses default parse options. * * @param loader - * will be used to load resources + * will be used to load resources * @param resourceBasename - * a resource name as in - * `java.lang.ClassLoader.getResource`, with or without - * extension - * @return the parsed configuration + * a resource name as in `java.lang.ClassLoader.getResource`, with or + * without extension + * @return + * the parsed configuration */ def parseResourcesAnySyntax( loader: ClassLoader, @@ -943,9 +979,12 @@ object ConfigFactory { * but uses thread's current context class loader if none is set in the * ConfigParseOptions. * - * @param resource the resource name - * @param options parse options - * @return the parsed configuration + * @param resource + * the resource name + * @param options + * parse options + * @return + * the parsed configuration */ def parseResources(resource: String, options: ConfigParseOptions): Config = { val withLoader = @@ -958,8 +997,10 @@ object ConfigFactory { * [[#parseResources(loader:ClassLoader,resource:String)* parseResources(ClassLoader,String)]] * but uses thread's current context class loader. * - * @param resource the resource name - * @return the parsed configuration + * @param resource + * the resource name + * @return + * the parsed configuration */ def parseResources(resource: String): Config = parseResources(resource, ConfigParseOptions.defaults) @@ -969,9 +1010,12 @@ object ConfigFactory { * [[#parseResourcesAnySyntax(loader:ClassLoader,resourceBasename:String,options:org\.ekrich\.config\.ConfigParseOptions)* parseResourcesAnySyntax(ClassLoader,String,ConfigParseOptions)]] * but uses thread's current context class loader. * - * @param resourceBasename the resource basename (no file type suffix) - * @param options parse options - * @return the parsed configuration + * @param resourceBasename + * the resource basename (no file type suffix) + * @param options + * parse options + * @return + * the parsed configuration */ def parseResourcesAnySyntax( resourceBasename: String, @@ -986,19 +1030,24 @@ object ConfigFactory { * [[#parseResourcesAnySyntax(loader:ClassLoader,resourceBasename:String)* parseResourcesAnySyntax(ClassLoader,String)]] * but uses thread's current context class loader. * - * @param resourceBasename the resource basename (no file type suffix) - * @return the parsed configuration + * @param resourceBasename + * the resource basename (no file type suffix) + * @return + * the parsed configuration */ def parseResourcesAnySyntax(resourceBasename: String): Config = parseResourcesAnySyntax(resourceBasename, ConfigParseOptions.defaults) /** - * Parses a string (which should be valid HOCON or JSON by default, or - * the syntax specified in the options otherwise). + * Parses a string (which should be valid HOCON or JSON by default, or the + * syntax specified in the options otherwise). * - * @param s string to parse - * @param options parse options - * @return the parsed configuration + * @param s + * string to parse + * @param options + * parse options + * @return + * the parsed configuration */ def parseString(s: String, options: ConfigParseOptions): Config = Parseable.newString(s, options).parse().toConfig @@ -1006,34 +1055,36 @@ object ConfigFactory { /** * Parses a string (which should be valid HOCON or JSON). * - * @param s string to parse - * @return the parsed configuration + * @param s + * string to parse + * @return + * the parsed configuration */ def parseString(s: String): Config = parseString(s, ConfigParseOptions.defaults) /** - * Creates a [[Config]] based on a `java.util.Map` from paths to - * plain Java values. Similar to + * Creates a [[Config]] based on a `java.util.Map` from paths to plain Java + * values. Similar to * [[ConfigValueFactory$.fromMap(values:java\.util\.Map[String,_],originDescription:String)* ConfigValueFactory.fromMap(Map,String)]], * except the keys in the map are path expressions, rather than keys; and - * correspondingly it returns a [[Config]] instead of a [[ConfigObject]]. - * This is more convenient if you are writing literal maps in code, and less + * correspondingly it returns a [[Config]] instead of a [[ConfigObject]]. This + * is more convenient if you are writing literal maps in code, and less * convenient if you are getting your maps from some data source such as a * parser. * * An exception will be thrown (and it is a bug in the caller of the method) * if a path is both an object and a value, for example if you had both * "a=foo" and "a.b=bar", then "a" is both the string "foo" and the parent - * object of "b". The caller of this method should ensure that doesn't - * happen. + * object of "b". The caller of this method should ensure that doesn't happen. * - * @param values map from paths to plain Java objects + * @param values + * map from paths to plain Java objects * @param originDescription - * description of what this map represents, like a filename, or - * "default settings" (origin description is used in error - * messages) - * @return the map converted to a [[Config]] + * description of what this map represents, like a filename, or "default + * settings" (origin description is used in error messages) + * @return + * the map converted to a [[Config]] */ def parseMap(values: ju.Map[String, _], originDescription: String): Config = ConfigImpl.fromPathMap(values, originDescription).toConfig @@ -1043,8 +1094,10 @@ object ConfigFactory { * [[ConfigFactory$.parseMap(values:java\.util\.Map[String,_],originDescription:String)* ConfigFactory.parseMap(Map,String)]] * for details, this one just uses a default origin description. * - * @param values map from paths to plain Java values - * @return the map converted to a [[Config]] + * @param values + * map from paths to plain Java values + * @return + * the map converted to a [[Config]] */ def parseMap(values: ju.Map[String, _]): Config = parseMap(values, null) diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigIncludeContext.scala b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigIncludeContext.scala index 53dcd218..44a5bd87 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigIncludeContext.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigIncludeContext.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config @@ -8,9 +8,8 @@ package org.ekrich.config * inside a {@code ConfigIncluder} implementation, and is not intended for apps * to implement. * - *

- * Do not implement this interface; it should only be implemented by - * the config library. Arbitrary implementations will not work because the + *

Do not implement this interface; it should only be implemented + * by the config library. Arbitrary implementations will not work because the * library internals assume a specific concrete implementation. Also, this * interface is likely to grow new methods over time, so third-party * implementations will break. @@ -19,36 +18,39 @@ trait ConfigIncludeContext { /** * Tries to find a name relative to whatever is doing the including, for - * example in the same directory as the file doing the including. Returns - * null if it can't meaningfully create a relative name. The returned - * parseable may not exist; this function is not required to do any IO, just - * compute what the name would be. + * example in the same directory as the file doing the including. Returns null + * if it can't meaningfully create a relative name. The returned parseable may + * not exist; this function is not required to do any IO, just compute what + * the name would be. * - * The passed-in filename has to be a complete name (with extension), not - * just a basename. (Include statements in config files are allowed to give - * just a basename.) + * The passed-in filename has to be a complete name (with extension), not just + * a basename. (Include statements in config files are allowed to give just a + * basename.) * * @param filename - * the name to make relative to the resource doing the including - * @return parseable item relative to the resource doing the including, or - * null + * the name to make relative to the resource doing the including + * @return + * parseable item relative to the resource doing the including, or null */ def relativeTo(filename: String): ConfigParseable /** - * Parse options to use (if you use another method to get a - * {@link ConfigParseable} then use {@link ConfigParseable#options} - * instead though). + * Parse options to use (if you use another method to get a {@link + * ConfigParseable} then use {@link ConfigParseable#options} instead though). * - * @return the parse options + * @return + * the parse options */ def parseOptions: ConfigParseOptions /** - * Copy this {@link ConfigIncludeContext} giving it a new value for its parseOptions. + * Copy this {@link ConfigIncludeContext} giving it a new value for its + * parseOptions. * - * @param options new parse options to use - * @return the updated copy of this context + * @param options + * new parse options to use + * @return + * the updated copy of this context */ def setParseOptions(options: ConfigParseOptions): ConfigIncludeContext } diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigIncluder.scala b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigIncluder.scala index 1a51a553..d76d22ab 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigIncluder.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigIncluder.scala @@ -1,14 +1,14 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config /** - * Implement this interface and provide an instance to - * {@link ConfigParseOptions#setIncluder ConfigParseOptions.setIncluder()} to - * customize handling of {@code include} statements in config files. You may - * also want to implement {@link ConfigIncluderClasspath}, - * {@link ConfigIncluderFile}, and {@link ConfigIncluderURL}, or not. + * Implement this interface and provide an instance to {@link + * ConfigParseOptions#setIncluder ConfigParseOptions.setIncluder()} to customize + * handling of {@code include} statements in config files. You may also want to + * implement {@link ConfigIncluderClasspath}, {@link ConfigIncluderFile}, and + * {@link ConfigIncluderURL}, or not. */ trait ConfigIncluder { @@ -19,33 +19,35 @@ trait ConfigIncluder { * merge any files found by the fallback includer with any objects you load * yourself. * - * It's important to handle the case where you already have the fallback - * with a "return this", i.e. this method should not create a new object if - * the fallback is the same one you already have. The same fallback may be - * added repeatedly. + * It's important to handle the case where you already have the fallback with + * a "return this", i.e. this method should not create a new object if the + * fallback is the same one you already have. The same fallback may be added + * repeatedly. * - * @param fallback the previous includer for chaining - * @return a new includer + * @param fallback + * the previous includer for chaining + * @return + * a new includer */ def withFallback(fallback: ConfigIncluder): ConfigIncluder /** - * Parses another item to be included. The returned object typically would - * not have substitutions resolved. You can throw a ConfigException here to - * abort parsing, or return an empty object, but may not return null. + * Parses another item to be included. The returned object typically would not + * have substitutions resolved. You can throw a ConfigException here to abort + * parsing, or return an empty object, but may not return null. * * This method is used for a "heuristic" include statement that does not * specify file, URL, or classpath resource. If the include statement does - * specify, then the same class implementing {@link ConfigIncluder} must - * also implement {@link ConfigIncluderClasspath}, - * {@link ConfigIncluderFile}, or {@link ConfigIncluderURL} as needed, or a - * default includer will be used. + * specify, then the same class implementing {@link ConfigIncluder} must also + * implement {@link ConfigIncluderClasspath}, {@link ConfigIncluderFile}, or + * {@link ConfigIncluderURL} as needed, or a default includer will be used. * * @param context - * some info about the include context + * some info about the include context * @param what - * the include statement's argument - * @return a non-null ConfigObject + * the include statement's argument + * @return + * a non-null ConfigObject */ def include(context: ConfigIncludeContext, what: String): ConfigObject } diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigIncluderClasspath.scala b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigIncluderClasspath.scala index f10b3e64..9515a4b3 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigIncluderClasspath.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigIncluderClasspath.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config @@ -12,15 +12,16 @@ package org.ekrich.config trait ConfigIncluderClasspath { /** - * Parses another item to be included. The returned object typically would - * not have substitutions resolved. You can throw a ConfigException here to - * abort parsing, or return an empty object, but may not return null. + * Parses another item to be included. The returned object typically would not + * have substitutions resolved. You can throw a ConfigException here to abort + * parsing, or return an empty object, but may not return null. * * @param context - * some info about the include context + * some info about the include context * @param what - * the include statement's argument - * @return a non-null ConfigObject + * the include statement's argument + * @return + * a non-null ConfigObject */ def includeResources( context: ConfigIncludeContext, diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigIncluderFile.scala b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigIncluderFile.scala index 9636eb7c..497482f5 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigIncluderFile.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigIncluderFile.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config @@ -14,15 +14,16 @@ import java.io.File trait ConfigIncluderFile { /** - * Parses another item to be included. The returned object typically would - * not have substitutions resolved. You can throw a ConfigException here to - * abort parsing, or return an empty object, but may not return null. + * Parses another item to be included. The returned object typically would not + * have substitutions resolved. You can throw a ConfigException here to abort + * parsing, or return an empty object, but may not return null. * * @param context - * some info about the include context + * some info about the include context * @param what - * the include statement's argument - * @return a non-null ConfigObject + * the include statement's argument + * @return + * a non-null ConfigObject */ def includeFile(context: ConfigIncludeContext, what: File): ConfigObject } diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigIncluderURL.scala b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigIncluderURL.scala index da659635..5e69a490 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigIncluderURL.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigIncluderURL.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config @@ -14,15 +14,16 @@ import java.net.URL trait ConfigIncluderURL { /** - * Parses another item to be included. The returned object typically would - * not have substitutions resolved. You can throw a ConfigException here to - * abort parsing, or return an empty object, but may not return null. + * Parses another item to be included. The returned object typically would not + * have substitutions resolved. You can throw a ConfigException here to abort + * parsing, or return an empty object, but may not return null. * * @param context - * some info about the include context + * some info about the include context * @param what - * the include statement's argument - * @return a non-null ConfigObject + * the include statement's argument + * @return + * a non-null ConfigObject */ def includeURL(context: ConfigIncludeContext, what: URL): ConfigObject } diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigList.scala b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigList.scala index 82b2e1b0..202aed36 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigList.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigList.scala @@ -1,44 +1,40 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config import java.{util => ju} /** - * Subtype of {@link ConfigValue} representing a list value, as in JSON's - * {@code [1,2,3]} syntax. + * Subtype of {@link ConfigValue} representing a list value, as in JSON's {@code + * [1,2,3]} syntax. * - *

- * {@code ConfigList} implements {@code java.util.List} so you can - * use it like a regular Java list. Or call {@link #unwrapped} to unwrap the + *

{@code ConfigList} implements {@code java.util.List} so you + * can use it like a regular Java list. Or call {@link #unwrapped} to unwrap the * list elements into plain Java values. * - *

- * Like all {@link ConfigValue} subtypes, {@code ConfigList} is immutable. This - * makes it threadsafe and you never have to create "defensive copies." The + *

Like all {@link ConfigValue} subtypes, {@code ConfigList} is immutable. + * This makes it threadsafe and you never have to create "defensive copies." The * mutator methods from `java.util.List` all throw * `java.lang.UnsupportedOperationException`. * - *

- * The {@link ConfigValue#valueType} method on a list returns - * {@link ConfigValueType#LIST}. + *

The {@link ConfigValue#valueType} method on a list returns {@link + * ConfigValueType#LIST}. * - *

- * Do not implement {@code ConfigList}; it should only be implemented - * by the config library. Arbitrary implementations will not work because the - * library internals assume a specific concrete implementation. Also, this - * interface is likely to grow new methods over time, so third-party + *

Do not implement {@code ConfigList}; it should only be + * implemented by the config library. Arbitrary implementations will not work + * because the library internals assume a specific concrete implementation. + * Also, this interface is likely to grow new methods over time, so third-party * implementations will break. - * */ trait ConfigList extends ju.List[ConfigValue] with ConfigValue { /** - * Recursively unwraps the list, returning a list of plain Java values such - * as Integer or String or whatever is in the list. + * Recursively unwraps the list, returning a list of plain Java values such as + * Integer or String or whatever is in the list. * - * @return a `java.util.List` containing plain Java objects + * @return + * a `java.util.List` containing plain Java objects */ override def unwrapped: ju.List[AnyRef] override def withOrigin(origin: ConfigOrigin): ConfigList diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigLoadingStrategy.scala b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigLoadingStrategy.scala index 625c9eca..be00a643 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigLoadingStrategy.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigLoadingStrategy.scala @@ -1,22 +1,26 @@ package org.ekrich.config /** - * This method allows you to alter default config loading strategy for all the code which - * calls one of the methods, e.g. + * This method allows you to alter default config loading strategy for all the + * code which calls one of the methods, e.g. * [[ConfigFactory$.load(resourceBasename:String)* ConfigFactory.load(String)]] * * Usually you don't have to implement this interface but it may be required - * when you fixing a improperly implemented library with unavailable source code. + * when you fixing a improperly implemented library with unavailable source + * code. * - * You have to define VM property `config.strategy` to replace default strategy with your own. + * You have to define VM property `config.strategy` to replace default strategy + * with your own. */ trait ConfigLoadingStrategy { /** * This method must load and parse application config. * - * @param parseOptions [[ConfigParseOptions]] to use - * @return loaded config + * @param parseOptions + * [[ConfigParseOptions]] to use + * @return + * loaded config */ def parseApplicationConfig(parseOptions: ConfigParseOptions): Config } diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigMemorySize.scala b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigMemorySize.scala index 9fb5f45e..710e8e4b 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigMemorySize.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigMemorySize.scala @@ -1,24 +1,24 @@ /** - * Copyright (C) 2015 Typesafe Inc. + * Copyright (C) 2015 Typesafe Inc. */ package org.ekrich.config /** - * An immutable class representing an amount of memory. Use - * static factory methods such as - * {@link ConfigMemorySize#ofBytes} to create instances. + * An immutable class representing an amount of memory. Use static factory + * methods such as {@link ConfigMemorySize#ofBytes} to create instances. * * @since 1.3.0 */ object ConfigMemorySize { /** - * Constructs a ConfigMemorySize representing the given - * number of bytes. + * Constructs a ConfigMemorySize representing the given number of bytes. * * @since 1.3.0 - * @param bytes a number of bytes - * @return an instance representing the number of bytes + * @param bytes + * a number of bytes + * @return + * an instance representing the number of bytes */ def ofBytes(bytes: Long) = new ConfigMemorySize(bytes) } @@ -33,7 +33,8 @@ final class ConfigMemorySize private (val bytes: Long) { * Gets the size in bytes. * * @since 1.3.0 - * @return how many bytes + * @return + * how many bytes */ def toBytes: Long = bytes @@ -46,6 +47,6 @@ final class ConfigMemorySize private (val bytes: Long) { override def hashCode: Int = // in Java 8 this can become Long.hashCode(bytes) - //Long.valueOf(bytes).hashCode + // Long.valueOf(bytes).hashCode bytes.hashCode() } diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigMergeable.scala b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigMergeable.scala index 94ae0a13..5897ecb3 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigMergeable.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigMergeable.scala @@ -1,34 +1,33 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config /** * Marker for types whose instances can be merged, that is [[Config]] and - * [[ConfigValue]]. Instances of `Config` and `ConfigValue` can - * be combined into a single new instance using the + * [[ConfigValue]]. Instances of `Config` and `ConfigValue` can be combined into + * a single new instance using the * [[ConfigMergeable#withFallback withFallback()]] method. * - * ''Do not implement this interface''; it should only be implemented by - * the config library. Arbitrary implementations will not work because the - * library internals assume a specific concrete implementation. Also, this - * interface is likely to grow new methods over time, so third-party - * implementations will break. + * ''Do not implement this interface''; it should only be implemented by the + * config library. Arbitrary implementations will not work because the library + * internals assume a specific concrete implementation. Also, this interface is + * likely to grow new methods over time, so third-party implementations will + * break. */ trait ConfigMergeable { /** - * Returns a new value computed by merging this value with another, with - * keys in this value "winning" over the other one. + * Returns a new value computed by merging this value with another, with keys + * in this value "winning" over the other one. * * This associative operation may be used to combine configurations from * multiple sources (such as multiple configuration files). * * The semantics of merging are described in the * [[https://github.com/ekrich/sconfig/blob/master/HOCON.md spec for HOCON]]. - * Merging typically occurs when either the same object is - * created twice in the same file, or two config files are both loaded. For - * example: + * Merging typically occurs when either the same object is created twice in + * the same file, or two config files are both loaded. For example: * * {{{ * foo = { a: 42 } @@ -41,29 +40,28 @@ trait ConfigMergeable { * foo = { a: 42, b: 43 } * }}} * - * Only {@link ConfigObject} and {@link Config} instances do anything in - * this method (they need to merge the fallback keys into themselves). All - * other values just return the original value, since they automatically - * override any fallback. This means that objects do not merge "across" - * non-objects; if you write - * `object.withFallback(nonObject).withFallback(otherObject)`, - * then `otherObject`will simply be ignored. This is an - * intentional part of how merging works, because non-objects such as - * strings and integers replace (rather than merging with) any prior value: + * Only {@link ConfigObject} and {@link Config} instances do anything in this + * method (they need to merge the fallback keys into themselves). All other + * values just return the original value, since they automatically override + * any fallback. This means that objects do not merge "across" non-objects; if + * you write `object.withFallback(nonObject).withFallback(otherObject)`, then + * `otherObject`will simply be ignored. This is an intentional part of how + * merging works, because non-objects such as strings and integers replace + * (rather than merging with) any prior value: * * {{{ * foo = { a: 42 } * foo = 10 * }}} * - * Here, the number 10 "wins" and the value of `foo` would be - * simply 10. Again, for details see the spec. + * Here, the number 10 "wins" and the value of `foo` would be simply 10. + * Again, for details see the spec. * * @param other - * an object whose keys should be used as fallbacks, if the keys - * are not present in this one - * @return a new object (or the original one, if the fallback doesn't get - * used) + * an object whose keys should be used as fallbacks, if the keys are not + * present in this one + * @return + * a new object (or the original one, if the fallback doesn't get used) */ def withFallback(other: ConfigMergeable): ConfigMergeable } diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigObject.scala b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigObject.scala index 0ba27c29..5f6f0266 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigObject.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigObject.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config @@ -9,54 +9,45 @@ import java.{util => ju} * Subtype of {@link ConfigValue} representing an object (AKA dictionary or map) * value, as in JSON's curly brace { "a" : 42 } syntax. * - *

- * An object may also be viewed as a {@link Config} by calling - * {@link ConfigObject#toConfig}. + *

An object may also be viewed as a {@link Config} by calling {@link + * ConfigObject#toConfig}. * - *

- * {@code ConfigObject} implements {@code java.util.Map} so - * you can use it like a regular Java map. Or call {@link #unwrapped} to - * unwrap the map to a map with plain Java values rather than + *

{@code ConfigObject} implements {@code java.util.Map} so you can use it like a regular Java map. Or call {@link + * #unwrapped} to unwrap the map to a map with plain Java values rather than * {@code ConfigValue}. * - *

- * Like all {@link ConfigValue} subtypes, {@code ConfigObject} is immutable. + *

Like all {@link ConfigValue} subtypes, {@code ConfigObject} is immutable. * This makes it threadsafe and you never have to create "defensive copies." The * mutator methods from `java.util.Map` all throw * `java.lang.UnsupportedOperationException`. * - *

- * The {@link ConfigValue#valueType} method on an object returns - * {@link ConfigValueType#OBJECT}. + *

The {@link ConfigValue#valueType} method on an object returns {@link + * ConfigValueType#OBJECT}. * - *

- * In most cases you want to use the {@link Config} interface rather than this - * one. Call {@link #toConfig} to convert a {@code ConfigObject} to a + *

In most cases you want to use the {@link Config} interface rather than + * this one. Call {@link #toConfig} to convert a {@code ConfigObject} to a * {@code Config}. * - *

- * The API for a {@code ConfigObject} is in terms of keys, while the API for a - * {@link Config} is in terms of path expressions. Conceptually, - * {@code ConfigObject} is a tree of maps from keys to values, while a - * {@code Config} is a one-level map from paths to values. + *

The API for a {@code ConfigObject} is in terms of keys, while the API for + * a {@link Config} is in terms of path expressions. Conceptually, {@code + * ConfigObject} is a tree of maps from keys to values, while a {@code Config} + * is a one-level map from paths to values. * - *

- * Use [[ConfigUtil$.joinPath(elements:String*)* ConfigUtil.joinPath(String*)]] - * and [[ConfigUtil$.splitPath ConfigUtil.splitPath(String)]] to convert - * between path expressions and individual path elements (keys). + *

Use + * [[ConfigUtil$.joinPath(elements:String*)* ConfigUtil.joinPath(String*)]] and + * [[ConfigUtil$.splitPath ConfigUtil.splitPath(String)]] to convert between + * path expressions and individual path elements (keys). * - *

- * A {@code ConfigObject} may contain null values, which will have - * {@link ConfigValue#valueType} equal to {@link ConfigValueType#NULL}. If - * {@link ConfigObject#get} returns Java's null then the key was not - * present in the parsed file (or wherever this value tree came from). If - * {@code get("key")} returns a {@link ConfigValue} with type - * {@code ConfigValueType#NULL} then the key was set to null explicitly in the - * config file. + *

A {@code ConfigObject} may contain null values, which will have {@link + * ConfigValue#valueType} equal to {@link ConfigValueType#NULL}. If {@link + * ConfigObject#get} returns Java's null then the key was not present in the + * parsed file (or wherever this value tree came from). If {@code get("key")} + * returns a {@link ConfigValue} with type {@code ConfigValueType#NULL} then the + * key was set to null explicitly in the config file. * - *

- * Do not implement interface {@code ConfigObject}; it should only be - * implemented by the config library. Arbitrary implementations will not work + *

Do not implement interface {@code ConfigObject}; it should only + * be implemented by the config library. Arbitrary implementations will not work * because the library internals assume a specific concrete implementation. * Also, this interface is likely to grow new methods over time, so third-party * implementations will break. @@ -64,11 +55,12 @@ import java.{util => ju} trait ConfigObject extends ConfigValue with ju.Map[String, ConfigValue] { /** - * Converts this object to a {@link Config} instance, enabling you to use - * path expressions to find values in the object. This is a constant-time - * operation (it is not proportional to the size of the object). + * Converts this object to a {@link Config} instance, enabling you to use path + * expressions to find values in the object. This is a constant-time operation + * (it is not proportional to the size of the object). * - * @return a {@link Config} with this object as its root + * @return + * a {@link Config} with this object as its root */ def toConfig: Config @@ -76,21 +68,23 @@ trait ConfigObject extends ConfigValue with ju.Map[String, ConfigValue] { * Recursively unwraps the object, returning a map from String to whatever * plain Java values are unwrapped from the object's values. * - * @return a `java.util.Map` containing plain Java objects + * @return + * a `java.util.Map` containing plain Java objects */ override def unwrapped: ju.Map[String, AnyRef] override def withFallback(other: ConfigMergeable): ConfigObject /** - * Gets a {@link ConfigValue} at the given key, or returns null if there is - * no value. The returned {@link ConfigValue} may have - * {@link ConfigValueType#NULL} or any other type, and the passed-in key - * must be a key in this object (rather than a path expression). + * Gets a {@link ConfigValue} at the given key, or returns null if there is no + * value. The returned {@link ConfigValue} may have {@link + * ConfigValueType#NULL} or any other type, and the passed-in key must be a + * key in this object (rather than a path expression). * * @param key - * key to look up - * @return the value at the key or null if none + * key to look up + * @return + * the value at the key or null if none */ // will not compile with override which is allowed in Java override def get(key: Any): ConfigValue @@ -100,8 +94,9 @@ trait ConfigObject extends ConfigValue with ju.Map[String, ConfigValue] { * sibling keys are removed. * * @param key - * key to keep - * @return a copy of the object minus all keys except the one specified + * key to keep + * @return + * a copy of the object minus all keys except the one specified */ def withOnlyKey(key: String): ConfigObject @@ -109,8 +104,9 @@ trait ConfigObject extends ConfigValue with ju.Map[String, ConfigValue] { * Clone the object with the given key removed. * * @param key - * key to remove - * @return a copy of the object minus the specified key + * key to remove + * @return + * a copy of the object minus the specified key */ def withoutKey(key: String): ConfigObject @@ -121,10 +117,11 @@ trait ConfigObject extends ConfigValue with ju.Map[String, ConfigValue] { * remove a value, use {@link ConfigObject#withoutKey}. * * @param key - * key to add + * key to add * @param value - * value at the new key - * @return the new instance with the new map entry + * value at the new key + * @return + * the new instance with the new map entry */ def withValue(key: String, value: ConfigValue): ConfigObject diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigOrigin.scala b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigOrigin.scala index 6095fbad..c2a0d830 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigOrigin.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigOrigin.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config @@ -7,21 +7,19 @@ import java.net.URL import java.util.List /** - * Represents the origin (such as filename and line number) of a - * {@link ConfigValue} for use in error messages. Obtain the origin of a value - * with {@link ConfigValue#origin}. Exceptions may have an origin, see - * {@link ConfigException#origin}, but be careful because + * Represents the origin (such as filename and line number) of a {@link + * ConfigValue} for use in error messages. Obtain the origin of a value with + * {@link ConfigValue#origin}. Exceptions may have an origin, see {@link + * ConfigException#origin}, but be careful because * ConfigException.origin() may return null. * - *

- * It's best to use this interface only for debugging; its accuracy is - * "best effort" rather than guaranteed, and a potentially-noticeable amount of - * memory could probably be saved if origins were not kept around, so in the - * future there might be some option to discard origins. + *

It's best to use this interface only for debugging; its accuracy is "best + * effort" rather than guaranteed, and a potentially-noticeable amount of memory + * could probably be saved if origins were not kept around, so in the future + * there might be some option to discard origins. * - *

- * Do not implement this interface; it should only be implemented by - * the config library. Arbitrary implementations will not work because the + *

Do not implement this interface; it should only be implemented + * by the config library. Arbitrary implementations will not work because the * library internals assume a specific concrete implementation. Also, this * interface is likely to grow new methods over time, so third-party * implementations will break. @@ -32,7 +30,8 @@ trait ConfigOrigin { * Returns a string describing the origin of a value or exception. This will * never return null. * - * @return string describing the origin + * @return + * string describing the origin */ def description: String @@ -40,7 +39,8 @@ trait ConfigOrigin { * Returns a filename describing the origin. This will return null if the * origin was not a file. * - * @return filename of the origin or null + * @return + * filename of the origin or null */ def filename: String @@ -48,7 +48,8 @@ trait ConfigOrigin { * Returns a URL describing the origin. This will return null if the origin * has no meaningful URL. * - * @return url of the origin or null + * @return + * url of the origin or null */ def url: URL @@ -56,7 +57,8 @@ trait ConfigOrigin { * Returns a classpath resource name describing the origin. This will return * null if the origin was not a classpath resource. * - * @return resource name of the origin or null + * @return + * resource name of the origin or null */ def resource: String @@ -64,7 +66,8 @@ trait ConfigOrigin { * Returns a line number where the value or exception originated. This will * return -1 if there's no meaningful line number. * - * @return line number or -1 if none is available + * @return + * line number or -1 if none is available */ def lineNumber: Int @@ -75,42 +78,45 @@ trait ConfigOrigin { * element or object field, with no blank line after the comment, "go with" * that element or field. * - * @return any comments that seemed to "go with" this origin, empty list if - * none + * @return + * any comments that seemed to "go with" this origin, empty list if none */ def comments: List[String] /** * Returns a {@code ConfigOrigin} based on this one, but with the given * comments. Does not modify this instance or any {@code ConfigValue}s with - * this origin (since they are immutable). To set the returned origin to a + * this origin (since they are immutable). To set the returned origin to a * {@code ConfigValue}, use {@link ConfigValue#withOrigin}. * - *

- * Note that when the given comments are equal to the comments on this object, - * a new instance may not be created and {@code this} is returned directly. + *

Note that when the given comments are equal to the comments on this + * object, a new instance may not be created and {@code this} is returned + * directly. * * @since 1.3.0 - * @param comments the comments used on the returned origin - * @return the ConfigOrigin with the given comments + * @param comments + * the comments used on the returned origin + * @return + * the ConfigOrigin with the given comments */ def withComments(comments: List[String]): ConfigOrigin /** - * Returns a {@code ConfigOrigin} based on this one, but with the given - * line number. This origin must be a FILE, URL or RESOURCE. Does not modify - * this instance or any {@code ConfigValue}s with this origin (since they are - * immutable). To set the returned origin to a {@code ConfigValue}, use - * {@link ConfigValue#withOrigin}. + * Returns a {@code ConfigOrigin} based on this one, but with the given line + * number. This origin must be a FILE, URL or RESOURCE. Does not modify this + * instance or any {@code ConfigValue}s with this origin (since they are + * immutable). To set the returned origin to a {@code ConfigValue}, use {@link + * ConfigValue#withOrigin}. * - *

- * Note that when the given lineNumber are equal to the lineNumber on this + *

Note that when the given lineNumber are equal to the lineNumber on this * object, a new instance may not be created and {@code this} is returned * directly. * * @since 1.3.0 - * @param lineNumber the new line number - * @return the created ConfigOrigin + * @param lineNumber + * the new line number + * @return + * the created ConfigOrigin */ def withLineNumber(lineNumber: Int): ConfigOrigin } diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigOriginFactory.scala b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigOriginFactory.scala index 28d6bdce..b9a390fb 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigOriginFactory.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigOriginFactory.scala @@ -4,10 +4,10 @@ import java.net.URL import org.ekrich.config.impl.ConfigImpl /** - * This class contains some static factory methods for building a [[ConfigOrigin]]. - * [[ConfigOrigin]]s are automatically created when you - * call other API methods to get a [[ConfigValue]] or [[Config]]. - * But you can also set the origin of an existing [[ConfigValue]], using + * This class contains some static factory methods for building a + * [[ConfigOrigin]]. [[ConfigOrigin]]s are automatically created when you call + * other API methods to get a [[ConfigValue]] or [[Config]]. But you can also + * set the origin of an existing [[ConfigValue]], using * [[ConfigValue#withOrigin ConfigValue.withOrigin(ConfigOrigin)]]. * * @since 1.3.0 @@ -20,7 +20,8 @@ object ConfigOriginFactory { * [[ConfigValueFactory$.fromAnyRef(obj:Object)* ConfigValueFactory.fromAnyRef(Object)]]. * * @since 1.3.0 - * @return the default origin + * @return + * the default origin */ def newSimple(): ConfigOrigin = newSimple(null) @@ -28,8 +29,10 @@ object ConfigOriginFactory { * Returns an origin with the given description. * * @since 1.3.0 - * @param description brief description of what the origin is - * @return a new origin + * @param description + * brief description of what the origin is + * @return + * a new origin */ def newSimple(description: String): ConfigOrigin = ConfigImpl.newSimpleOrigin(description) @@ -38,8 +41,10 @@ object ConfigOriginFactory { * Creates a file origin with the given filename. * * @since 1.3.0 - * @param filename the filename of this origin - * @return a new origin + * @param filename + * the filename of this origin + * @return + * a new origin */ def newFile(filename: String): ConfigOrigin = ConfigImpl.newFileOrigin(filename) @@ -48,8 +53,10 @@ object ConfigOriginFactory { * Creates a url origin with the given URL object. * * @since 1.3.0 - * @param url the url of this origin - * @return a new origin + * @param url + * the url of this origin + * @return + * a new origin */ def newURL(url: URL): ConfigOrigin = ConfigImpl.newURLOrigin(url) } diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigParseOptions.scala b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigParseOptions.scala index 751f0f5d..e70e2cd7 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigParseOptions.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigParseOptions.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config @@ -9,27 +9,21 @@ import org.ekrich.config.impl.PlatformThread /** * A set of options related to parsing. * - *

- * This object is immutable, so the "setters" return a new object. + *

This object is immutable, so the "setters" return a new object. * - *

- * Here is an example of creating a custom {@code ConfigParseOptions}: - * - *

- *     ConfigParseOptions options = ConfigParseOptions.defaults()
- *         .setSyntax(ConfigSyntax.JSON)
- *         .setAllowMissing(false)
- * 
+ *

Here is an example of creating a custom {@code ConfigParseOptions}: * + *

 ConfigParseOptions options = ConfigParseOptions.defaults()
+ * .setSyntax(ConfigSyntax.JSON) .setAllowMissing(false) 
*/ object ConfigParseOptions { /** - * Gets an instance of ConfigParseOptions with all fields - * set to the default values. Start with this instance and make any - * changes you need. + * Gets an instance of ConfigParseOptions with all fields set to + * the default values. Start with this instance and make any changes you need. * - * @return the default parse options + * @return + * the default parse options */ def defaults = new ConfigParseOptions(null, null, true, null, null) } @@ -47,8 +41,9 @@ final class ConfigParseOptions private ( * filename extension; if guessing fails, assume {@link ConfigSyntax#CONF}. * * @param syntax - * a syntax or {@code null} for best guess - * @return options with the syntax set + * a syntax or {@code null} for best guess + * @return + * options with the syntax set */ def setSyntax(syntax: ConfigSyntax): ConfigParseOptions = if (this.syntax == syntax) this @@ -65,8 +60,9 @@ final class ConfigParseOptions private ( * Set the file format. If set to null, assume {@link ConfigSyntax#CONF}. * * @param filename - * a configuration file name - * @return options with the syntax set + * a configuration file name + * @return + * options with the syntax set */ def setSyntaxFromFilename(filename: String): ConfigParseOptions = { val syntax = ConfigImplUtil.syntaxFromExtension(filename) @@ -76,7 +72,8 @@ final class ConfigParseOptions private ( /** * Gets the current syntax option, which may be null for "any". * - * @return the current syntax or null + * @return + * the current syntax or null */ def getSyntax: ConfigSyntax = syntax @@ -87,8 +84,10 @@ final class ConfigParseOptions private ( * library to come up with something automatically. This description is the * basis for the {@link ConfigOrigin} of the parsed values. * - * @param originDescription description to put in the {@link ConfigOrigin} - * @return options with the origin description set + * @param originDescription + * description to put in the {@link ConfigOrigin} + * @return + * options with the origin description set */ def setOriginDescription(originDescription: String): ConfigParseOptions = { // findbugs complains about == here but is wrong, do not "fix" if (this.originDescription == originDescription) @@ -108,7 +107,8 @@ final class ConfigParseOptions private ( /** * Gets the current origin description, which may be null for "automatic". * - * @return the current origin description or null + * @return + * the current origin description or null */ def getOriginDescription: String = originDescription @@ -120,13 +120,15 @@ final class ConfigParseOptions private ( this /** - * Set to false to throw an exception if the item being parsed (for example - * a file) is missing. Set to true to just return an empty document in that + * Set to false to throw an exception if the item being parsed (for example a + * file) is missing. Set to true to just return an empty document in that * case. Note that this setting applies on only to fetching the root document, * it has no effect on any nested includes. * - * @param allowMissing true to silently ignore missing item - * @return options with the "allow missing" flag set + * @param allowMissing + * true to silently ignore missing item + * @return + * options with the "allow missing" flag set */ def setAllowMissing(allowMissing: Boolean): ConfigParseOptions = if (this.allowMissing == allowMissing) @@ -143,7 +145,8 @@ final class ConfigParseOptions private ( /** * Gets the current "allow missing" flag. * - * @return whether we allow missing files + * @return + * whether we allow missing files */ def getAllowMissing: Boolean = allowMissing @@ -151,8 +154,10 @@ final class ConfigParseOptions private ( * Set a {@link ConfigIncluder} which customizes how includes are handled. * null means to use the default includer. * - * @param includer the includer to use or null for default - * @return new version of the parse options with different includer + * @param includer + * the includer to use or null for default + * @return + * new version of the parse options with different includer */ def setIncluder(includer: ConfigIncluder): ConfigParseOptions = if (this.includer == includer) @@ -167,13 +172,15 @@ final class ConfigParseOptions private ( ) /** - * Prepends a {@link ConfigIncluder} which customizes how - * includes are handled. To prepend your includer, the - * library calls {@link ConfigIncluder#withFallback} on your - * includer to append the existing includer to it. + * Prepends a {@link ConfigIncluder} which customizes how includes are + * handled. To prepend your includer, the library calls {@link + * ConfigIncluder#withFallback} on your includer to append the existing + * includer to it. * - * @param includer the includer to prepend (may not be null) - * @return new version of the parse options with different includer + * @param includer + * the includer to prepend (may not be null) + * @return + * new version of the parse options with different includer */ def prependIncluder(includer: ConfigIncluder): ConfigParseOptions = { if (includer == null) @@ -187,12 +194,14 @@ final class ConfigParseOptions private ( } /** - * Appends a {@link ConfigIncluder} which customizes how - * includes are handled. To append, the library calls - * {@link ConfigIncluder#withFallback} on the existing includer. + * Appends a {@link ConfigIncluder} which customizes how includes are handled. + * To append, the library calls {@link ConfigIncluder#withFallback} on the + * existing includer. * - * @param includer the includer to append (may not be null) - * @return new version of the parse options with different includer + * @param includer + * the includer to append (may not be null) + * @return + * new version of the parse options with different includer */ def appendIncluder(includer: ConfigIncluder): ConfigParseOptions = { if (includer == null) @@ -208,7 +217,8 @@ final class ConfigParseOptions private ( /** * Gets the current includer (will be null for the default includer). * - * @return current includer or null + * @return + * current includer or null */ def getIncluder: ConfigIncluder = includer @@ -217,9 +227,9 @@ final class ConfigParseOptions private ( * Thread.currentThread().getContextClassLoader() will be used. * * @param loader - * a class loader or {@code null} to use thread context class - * loader - * @return options with the class loader set + * a class loader or {@code null} to use thread context class loader + * @return + * options with the class loader set */ def setClassLoader(loader: ClassLoader): ConfigParseOptions = if (this.classLoader == loader) @@ -235,10 +245,10 @@ final class ConfigParseOptions private ( /** * Get the class loader; never returns {@code null}, if the class loader was - * unset, returns - * Thread.currentThread().getContextClassLoader(). + * unset, returns Thread.currentThread().getContextClassLoader(). * - * @return class loader to use + * @return + * class loader to use */ def getClassLoader: ClassLoader = if (this.classLoader == null) { diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigParseable.scala b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigParseable.scala index 37bf2a65..be1f6820 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigParseable.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigParseable.scala @@ -1,15 +1,14 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config /** - * An opaque handle to something that can be parsed, obtained from - * {@link ConfigIncludeContext}. + * An opaque handle to something that can be parsed, obtained from {@link + * ConfigIncludeContext}. * - *

- * Do not implement this interface; it should only be implemented by - * the config library. Arbitrary implementations will not work because the + *

Do not implement this interface; it should only be implemented + * by the config library. Arbitrary implementations will not work because the * library internals assume a specific concrete implementation. Also, this * interface is likely to grow new methods over time, so third-party * implementations will break. @@ -17,22 +16,22 @@ package org.ekrich.config trait ConfigParseable { /** - * Parse whatever it is. The options should come from - * {@link ConfigParseable#options options()} but you could tweak them if you - * like. + * Parse whatever it is. The options should come from {@link + * ConfigParseable#options options()} but you could tweak them if you like. * * @param options - * parse options, should be based on the ones from - * {@link ConfigParseable#options options()} - * @return the parsed object + * parse options, should be based on the ones from {@link + * ConfigParseable#options options()} + * @return + * the parsed object */ def parse(options: ConfigParseOptions): ConfigObject /** - * Returns a {@link ConfigOrigin} describing the origin of the parseable - * item. + * Returns a {@link ConfigOrigin} describing the origin of the parseable item. * - * @return the origin of the parseable item + * @return + * the origin of the parseable item */ def origin(): ConfigOrigin @@ -41,7 +40,8 @@ trait ConfigParseable { * These options will have the right description, includer, and other * parameters already set up. * - * @return the initial options + * @return + * the initial options */ def options(): ConfigParseOptions } diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigRenderOptions.scala b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigRenderOptions.scala index 055d3e6c..d20f40c0 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigRenderOptions.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigRenderOptions.scala @@ -1,20 +1,16 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config /** - *

- * A set of options related to rendering a {@link ConfigValue}. Passed to + *

A set of options related to rendering a {@link ConfigValue}. Passed to * [[ConfigValue!.render(options:org\.ekrich\.config\.ConfigRenderOptions)* ConfigValue.render(ConfigRenderOptions)]]. * - *

- * Here is an example of creating a {@code ConfigRenderOptions}: + *

Here is an example of creating a {@code ConfigRenderOptions}: * - *

- *     ConfigRenderOptions options =
- *         ConfigRenderOptions.defaults().setComments(false)
- * 
+ *
 ConfigRenderOptions options =
+ * ConfigRenderOptions.defaults().setComments(false) 
*/ object ConfigRenderOptions { @@ -23,15 +19,17 @@ object ConfigRenderOptions { * formatted). See {@link ConfigRenderOptions#concise} for stripped-down * options. This rendering will not be valid JSON since it has comments. * - * @return the default render options + * @return + * the default render options */ def defaults = new ConfigRenderOptions(true, true, true, true) /** - * Returns concise render options (no whitespace or comments). For a - * resolved {@link Config}, the concise rendering will be valid JSON. + * Returns concise render options (no whitespace or comments). For a resolved + * {@link Config}, the concise rendering will be valid JSON. * - * @return the concise render options + * @return + * the concise render options */ def concise = new ConfigRenderOptions(false, false, false, true) } @@ -44,41 +42,42 @@ final class ConfigRenderOptions private ( ) { /** - * Returns options with comments toggled. This controls human-written - * comments but not the autogenerated "origin of this setting" comments, - * which are controlled by {@link ConfigRenderOptions#setOriginComments}. + * Returns options with comments toggled. This controls human-written comments + * but not the autogenerated "origin of this setting" comments, which are + * controlled by {@link ConfigRenderOptions#setOriginComments}. * * @param value - * true to include comments in the render - * @return options with requested setting for comments + * true to include comments in the render + * @return + * options with requested setting for comments */ def setComments(value: Boolean): ConfigRenderOptions = if (value == comments) this else new ConfigRenderOptions(originComments, value, formatted, json) /** - * Returns whether the options enable comments. This method is mostly used - * by the config lib internally, not by applications. + * Returns whether the options enable comments. This method is mostly used by + * the config lib internally, not by applications. * - * @return true if comments should be rendered + * @return + * true if comments should be rendered */ def getComments: Boolean = comments /** * Returns options with origin comments toggled. If this is enabled, the - * library generates comments for each setting based on the - * {@link ConfigValue#origin} of that setting's value. For example these - * comments might tell you which file a setting comes from. + * library generates comments for each setting based on the {@link + * ConfigValue#origin} of that setting's value. For example these comments + * might tell you which file a setting comes from. * - *

- * {@code setOriginComments(Boolean)} controls only these autogenerated - * "origin of this setting" comments, to toggle regular comments use - * {@link ConfigRenderOptions#setComments}. + *

{@code setOriginComments(Boolean)} controls only these autogenerated + * "origin of this setting" comments, to toggle regular comments use {@link + * ConfigRenderOptions#setComments}. * * @param value - * true to include autogenerated setting-origin comments in the - * render - * @return options with origin comments toggled + * true to include autogenerated setting-origin comments in the render + * @return + * options with origin comments toggled */ def setOriginComments(value: Boolean): ConfigRenderOptions = if (value == originComments) this @@ -88,7 +87,8 @@ final class ConfigRenderOptions private ( * Returns whether the options enable automated origin comments. This method * is mostly used by the config lib internally, not by applications. * - * @return true if origin comments should be rendered + * @return + * true if origin comments should be rendered */ def getOriginComments: Boolean = originComments @@ -97,8 +97,9 @@ final class ConfigRenderOptions private ( * whitespace, enabling formatting makes things prettier but larger. * * @param value - * true to enable formatting - * @return options with requested setting for formatting + * true to enable formatting + * @return + * options with requested setting for formatting */ def setFormatted(value: Boolean): ConfigRenderOptions = if (value == formatted) this @@ -108,30 +109,33 @@ final class ConfigRenderOptions private ( * Returns whether the options enable formatting. This method is mostly used * by the config lib internally, not by applications. * - * @return true if the options enable formatting + * @return + * true if the options enable formatting */ def getFormatted: Boolean = formatted /** * Returns options with JSON toggled. JSON means that HOCON extensions * (omitting commas, quotes for example) won't be used. However, whether to - * use comments is controlled by the separate {@link #setComments} - * and {@link #setOriginComments} options. So if you enable - * comments you will get invalid JSON despite setting this to true. + * use comments is controlled by the separate {@link #setComments} and {@link + * #setOriginComments} options. So if you enable comments you will get invalid + * JSON despite setting this to true. * * @param value - * true to include non-JSON extensions in the render - * @return options with requested setting for JSON + * true to include non-JSON extensions in the render + * @return + * options with requested setting for JSON */ def setJson(value: Boolean): ConfigRenderOptions = if (value == json) this else new ConfigRenderOptions(originComments, comments, formatted, value) /** - * Returns whether the options enable JSON. This method is mostly used by - * the config lib internally, not by applications. + * Returns whether the options enable JSON. This method is mostly used by the + * config lib internally, not by applications. * - * @return true if only JSON should be rendered + * @return + * true if only JSON should be rendered */ def getJson: Boolean = json diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigResolveOptions.scala b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigResolveOptions.scala index 4f5db7cf..d1da53ab 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigResolveOptions.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigResolveOptions.scala @@ -1,37 +1,32 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config /** * A set of options related to resolving substitutions. Substitutions use the * `\${foo.bar` syntax and are documented in the - * [[https://github.com/ekrich/sconfig/blob/master/HOCON.md">HOCON spec]]. - *

+ * [[https://github.com/ekrich/sconfig/blob/master/HOCON.md">HOCON spec]].

* Typically this class would be used with the method * [[Config!.resolve(options:org\.ekrich\.config\.ConfigResolveOptions)* Config.resolve(ConfigResolveOptions)]]. - *

- * This object is immutable, so the "setters" return a new object. - *

- * Here is an example of creating a custom {@code ConfigResolveOptions}: + *

This object is immutable, so the "setters" return a new object.

Here + * is an example of creating a custom {@code ConfigResolveOptions}: * - *

- *     ConfigResolveOptions options = ConfigResolveOptions.defaults()
- *         .setUseSystemEnvironment(false)
- * 
- *

- * In addition to {@link ConfigResolveOptions#defaults}, there's a prebuilt - * {@link ConfigResolveOptions#noSystem} which avoids looking at any system - * environment variables or other external system information. (Right now, - * environment variables are the only example.) + *

 ConfigResolveOptions options = ConfigResolveOptions.defaults()
+ * .setUseSystemEnvironment(false) 

In addition to {@link + * ConfigResolveOptions#defaults}, there's a prebuilt {@link + * ConfigResolveOptions#noSystem} which avoids looking at any system environment + * variables or other external system information. (Right now, environment + * variables are the only example.) */ object ConfigResolveOptions { /** - * Returns the default resolve options. By default the system environment - * will be used and unresolved substitutions are not allowed. + * Returns the default resolve options. By default the system environment will + * be used and unresolved substitutions are not allowed. * - * @return the default resolve options + * @return + * the default resolve options */ def defaults = new ConfigResolveOptions(true, false, NULL_RESOLVER) @@ -39,7 +34,8 @@ object ConfigResolveOptions { * Returns resolve options that disable any reference to "system" data * (currently, this means environment variables). * - * @return the resolve options with env variables disabled + * @return + * the resolve options with env variables disabled */ def noSystem: ConfigResolveOptions = defaults.setUseSystemEnvironment(false) @@ -63,9 +59,9 @@ final class ConfigResolveOptions private ( * Returns options with use of environment variables set to the given value. * * @param value - * true to resolve substitutions falling back to environment - * variables. - * @return options with requested setting for use of environment variables + * true to resolve substitutions falling back to environment variables. + * @return + * options with requested setting for use of environment variables */ def setUseSystemEnvironment(value: Boolean) = new ConfigResolveOptions(value, allowUnresolved, resolver) @@ -75,49 +71,48 @@ final class ConfigResolveOptions private ( * This method is mostly used by the config lib internally, not by * applications. * - * @return true if environment variables should be used + * @return + * true if environment variables should be used */ def getUseSystemEnvironment: Boolean = useSystemEnvironment /** - * Returns options with "allow unresolved" set to the given value. By - * default, unresolved substitutions are an error. If unresolved - * substitutions are allowed, then a future attempt to use the unresolved - * value may fail, but + * Returns options with "allow unresolved" set to the given value. By default, + * unresolved substitutions are an error. If unresolved substitutions are + * allowed, then a future attempt to use the unresolved value may fail, but * [[Config!.resolve(options:org\.ekrich\.config\.ConfigResolveOptions)* Config.resolve(ConfigResolveOptions)]] * itself will not throw. * * @param value - * true to silently ignore unresolved substitutions. - * @return options with requested setting for whether to allow substitutions + * true to silently ignore unresolved substitutions. + * @return + * options with requested setting for whether to allow substitutions * @since 1.2.0 */ def setAllowUnresolved(value: Boolean) = new ConfigResolveOptions(useSystemEnvironment, value, resolver) /** - * Returns options where the given resolver used as a fallback if a - * reference cannot be otherwise resolved. This resolver will only be called - * after resolution has failed to substitute with a value from within the - * config itself and with any other resolvers that have been appended before - * this one. Multiple resolvers can be added using, + * Returns options where the given resolver used as a fallback if a reference + * cannot be otherwise resolved. This resolver will only be called after + * resolution has failed to substitute with a value from within the config + * itself and with any other resolvers that have been appended before this + * one. Multiple resolvers can be added using, * - *

-   *     ConfigResolveOptions options = ConfigResolveOptions.defaults()
-   *         .appendResolver(primary)
-   *         .appendResolver(secondary)
-   *         .appendResolver(tertiary);
-   * 
+ *
 ConfigResolveOptions options = ConfigResolveOptions.defaults()
+   * .appendResolver(primary) .appendResolver(secondary)
+   * .appendResolver(tertiary); 
* * With this config unresolved references will first be resolved with the * primary resolver, if that fails then the secondary, and finally if that * also fails the tertiary. * * If all fallbacks fail to return a substitution "allow unresolved" - * determines whether resolution fails or continues. - * ` - * @param value the resolver to fall back to - * @return options that use the given resolver as a fallback + * determines whether resolution fails or continues. ` + * @param value + * the resolver to fall back to + * @return + * options that use the given resolver as a fallback * @since 1.3.2 */ def appendResolver(value: ConfigResolver): ConfigResolveOptions = @@ -140,16 +135,18 @@ final class ConfigResolveOptions private ( * otherwise resolved. Never returns null. This method is mostly used by the * config lib internally, not by applications. * - * @return the non-null fallback resolver + * @return + * the non-null fallback resolver * @since 1.3.2 */ def getResolver: ConfigResolver = this.resolver /** - * Returns whether the options allow unresolved substitutions. This method - * is mostly used by the config lib internally, not by applications. + * Returns whether the options allow unresolved substitutions. This method is + * mostly used by the config lib internally, not by applications. * - * @return true if unresolved substitutions are allowed + * @return + * true if unresolved substitutions are allowed * @since 1.2.0 */ def getAllowUnresolved: Boolean = allowUnresolved diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigResolver.scala b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigResolver.scala index 29be1ac2..4ac42c88 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigResolver.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigResolver.scala @@ -1,10 +1,10 @@ package org.ekrich.config /** - * Implement this interface and provide an instance to - * {@link ConfigResolveOptions#appendResolver ConfigResolveOptions.appendResolver()} - * to provide custom behavior when unresolved substitutions are encountered - * during resolution. + * Implement this interface and provide an instance to {@link + * ConfigResolveOptions#appendResolver ConfigResolveOptions.appendResolver()} to + * provide custom behavior when unresolved substitutions are encountered during + * resolution. * * @since 1.3.2 */ @@ -13,27 +13,30 @@ trait ConfigResolver { /** * Returns the value to substitute for the given unresolved path. To get the * components of the path use - * [[ConfigUtil$.splitPath ConfigUtil.splitPath(String)]]. - * If a non-null value is returned that value will be substituted, otherwise - * resolution will continue to consider the substitution as still - * unresolved. + * [[ConfigUtil$.splitPath ConfigUtil.splitPath(String)]]. If a non-null value + * is returned that value will be substituted, otherwise resolution will + * continue to consider the substitution as still unresolved. * - * @param path the unresolved path - * @return the value to use as a substitution or null + * @param path + * the unresolved path + * @return + * the value to use as a substitution or null */ def lookup(path: String): ConfigValue /** - * Returns a new resolver that falls back to the given resolver if this - * one doesn't provide a substitution itself. + * Returns a new resolver that falls back to the given resolver if this one + * doesn't provide a substitution itself. * - * It's important to handle the case where you already have the fallback - * with a "return this", i.e. this method should not create a new object if - * the fallback is the same one you already have. The same fallback may be - * added repeatedly. + * It's important to handle the case where you already have the fallback with + * a "return this", i.e. this method should not create a new object if the + * fallback is the same one you already have. The same fallback may be added + * repeatedly. * - * @param fallback the previous includer for chaining - * @return a new resolver + * @param fallback + * the previous includer for chaining + * @return + * a new resolver */ def withFallback(fallback: ConfigResolver): ConfigResolver } diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigUtil.scala b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigUtil.scala index b8fe2276..b3dea046 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigUtil.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigUtil.scala @@ -8,7 +8,6 @@ import scala.annotation.varargs /** * Contains static utility methods. - * */ object ConfigUtil { @@ -16,25 +15,25 @@ object ConfigUtil { * Quotes and escapes a string, as in the JSON specification. * * @param s - * a string - * @return the string quoted and escaped + * a string + * @return + * the string quoted and escaped */ def quoteString(s: String): String = ConfigImplUtil.renderJsonString(s) /** - * Converts a list of keys to a path expression, by quoting the path - * elements as needed and then joining them separated by a period. A path - * expression is usable with a {@link Config}, while individual path - * elements are usable with a {@link ConfigObject}. - *

- * See the overview documentation for {@link Config} for more detail on path - * expressions vs. keys. + * Converts a list of keys to a path expression, by quoting the path elements + * as needed and then joining them separated by a period. A path expression is + * usable with a {@link Config}, while individual path elements are usable + * with a {@link ConfigObject}.

See the overview documentation for {@link + * Config} for more detail on path expressions vs. keys. * * @param elements - * the keys in the path - * @return a path expression + * the keys in the path + * @return + * a path expression * @throws ConfigException - * if there are no elements + * if there are no elements */ @varargs def joinPath(elements: String*): String = ConfigImplUtil.joinPath(elements: _*) @@ -42,35 +41,33 @@ object ConfigUtil { /** * Converts a list of strings to a path expression, by quoting the path * elements as needed and then joining them separated by a period. A path - * expression is usable with a {@link Config}, while individual path - * elements are usable with a {@link ConfigObject}. - *

- * See the overview documentation for {@link Config} for more detail on path - * expressions vs. keys. + * expression is usable with a {@link Config}, while individual path elements + * are usable with a {@link ConfigObject}.

See the overview documentation + * for {@link Config} for more detail on path expressions vs. keys. * * @param elements - * the keys in the path - * @return a path expression + * the keys in the path + * @return + * a path expression * @throws ConfigException - * if the list is empty + * if the list is empty */ def joinPath(elements: ju.List[String]): String = ConfigImplUtil.joinPath(elements) /** - * Converts a path expression into a list of keys, by splitting on period - * and unquoting the individual path elements. A path expression is usable - * with a {@link Config}, while individual path elements are usable with a - * {@link ConfigObject}. - *

- * See the overview documentation for {@link Config} for more detail on path - * expressions vs. keys. + * Converts a path expression into a list of keys, by splitting on period and + * unquoting the individual path elements. A path expression is usable with a + * {@link Config}, while individual path elements are usable with a {@link + * ConfigObject}.

See the overview documentation for {@link Config} for + * more detail on path expressions vs. keys. * * @param path - * a path expression - * @return the individual keys in the path + * a path expression + * @return + * the individual keys in the path * @throws ConfigException - * if the path expression is invalid + * if the path expression is invalid */ def splitPath(path: String): ju.List[String] = ConfigImplUtil.splitPath(path) } diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigValue.scala b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigValue.scala index 3eb44fc3..4f9bf4d6 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigValue.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigValue.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config @@ -7,13 +7,11 @@ package org.ekrich.config * An immutable value, following the JSON type * schema. * - *

- * Because this object is immutable, it is safe to use from multiple threads and - * there's no need for "defensive copies." + *

Because this object is immutable, it is safe to use from multiple threads + * and there's no need for "defensive copies." * - *

- * Do not implement interface {@code ConfigValue}; it should only be - * implemented by the config library. Arbitrary implementations will not work + *

Do not implement interface {@code ConfigValue}; it should only + * be implemented by the config library. Arbitrary implementations will not work * because the library internals assume a specific concrete implementation. * Also, this interface is likely to grow new methods over time, so third-party * implementations will break. @@ -21,104 +19,107 @@ package org.ekrich.config trait ConfigValue extends ConfigMergeable { /** - * The origin of the value (file, line number, etc.), for debugging and - * error messages. + * The origin of the value (file, line number, etc.), for debugging and error + * messages. * - * @return where the value came from + * @return + * where the value came from */ def origin: ConfigOrigin /** * The {@link ConfigValueType} of the value; matches the JSON type schema. * - * @return value's type + * @return + * value's type */ def valueType: ConfigValueType /** * Returns the value as a plain Java boxed value, that is, a {@code String}, - * {@code Number}, {@code Boolean}, {@code Map}, - * {@code List}, or {@code null}, matching the {@link #valueType} - * of this {@code ConfigValue}. If the value is a {@link ConfigObject} or - * {@link ConfigList}, it is recursively unwrapped. + * {@code Number}, {@code Boolean}, {@code Map}, {@code + * List}, or {@code null}, matching the {@link #valueType} of this + * {@code ConfigValue}. If the value is a {@link ConfigObject} or {@link + * ConfigList}, it is recursively unwrapped. * - * @return a plain Java value corresponding to this ConfigValue + * @return + * a plain Java value corresponding to this ConfigValue */ def unwrapped: AnyRef /** * Renders the config value as a HOCON string. This method is primarily - * intended for debugging, so it tries to add helpful comments and - * whitespace. + * intended for debugging, so it tries to add helpful comments and whitespace. * - *

- * If the config value has not been resolved - * (see [[Config!.resolve()* Config.resolve()]]), - * it's possible that it can't be rendered as valid HOCON. In that case the - * rendering should still be useful for debugging but you might not be able - * to parse it. If the value has been resolved, it will always be parseable. + *

If the config value has not been resolved (see + * [[Config!.resolve()* Config.resolve()]]), it's possible that it can't be + * rendered as valid HOCON. In that case the rendering should still be useful + * for debugging but you might not be able to parse it. If the value has been + * resolved, it will always be parseable. * - *

- * This method is equivalent to - * {@code render(ConfigRenderOptions.defaults())}. + *

This method is equivalent to {@code + * render(ConfigRenderOptions.defaults())}. * - * @return the rendered value + * @return + * the rendered value */ def render: String /** * Renders the config value to a string, using the provided options. * - *

- * If the config value has not been resolved - * (see [[[Config!.resolve()* Config.resolve()]]), - * it's possible that it can't be rendered as valid HOCON. In that case the - * rendering should still be useful for debugging but you might not be able - * to parse it. If the value has been resolved, it will always be parseable. + *

If the config value has not been resolved (see + * [[[Config!.resolve()* Config.resolve()]]), it's possible that it can't be + * rendered as valid HOCON. In that case the rendering should still be useful + * for debugging but you might not be able to parse it. If the value has been + * resolved, it will always be parseable. * - *

- * If the config value has been resolved and the options disable all + *

If the config value has been resolved and the options disable all * HOCON-specific features (such as comments), the rendering will be valid * JSON. If you enable HOCON-only features such as comments, the rendering * will not be valid JSON. * * @param options - * the rendering options - * @return the rendered value + * the rendering options + * @return + * the rendered value */ def render(options: ConfigRenderOptions): String override def withFallback(other: ConfigMergeable): ConfigValue /** - * Places the value inside a {@link Config} at the given path. See also - * {@link ConfigValue#atKey}. + * Places the value inside a {@link Config} at the given path. See also {@link + * ConfigValue#atKey}. * * @param path - * path to store this value at. - * @return a {@code Config} instance containing this value at the given - * path. + * path to store this value at. + * @return + * a {@code Config} instance containing this value at the given path. */ def atPath(path: String): Config /** - * Places the value inside a {@link Config} at the given key. See also - * {@link ConfigValue#atPath}. + * Places the value inside a {@link Config} at the given key. See also {@link + * ConfigValue#atPath}. * * @param key - * key to store this value at. - * @return a {@code Config} instance containing this value at the given key. + * key to store this value at. + * @return + * a {@code Config} instance containing this value at the given key. */ def atKey(key: String): Config /** - * Returns a {@code ConfigValue} based on this one, but with the given - * origin. This is useful when you are parsing a new format of file or setting + * Returns a {@code ConfigValue} based on this one, but with the given origin. + * This is useful when you are parsing a new format of file or setting * comments for a single ConfigValue. * * @since 1.3.0 - * @param origin the origin set on the returned value - * @return the new ConfigValue with the given origin + * @param origin + * the origin set on the returned value + * @return + * the new ConfigValue with the given origin */ def withOrigin(origin: ConfigOrigin): ConfigValue } diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigValueFactory.scala b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigValueFactory.scala index 25e68d9f..27b091e8 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigValueFactory.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigValueFactory.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config @@ -15,56 +15,50 @@ import org.ekrich.config.impl.ConfigImpl object ConfigValueFactory { /** - * Creates a {@link ConfigValue} from a plain Java boxed value, which may be - * a Boolean, Number, String, + * Creates a {@link ConfigValue} from a plain Java boxed value, which may be a + * Boolean, Number, String, * Map, Iterable, or null. A - * Map must be a Map from String to more values - * that can be supplied to fromAnyRef(). An - * Iterable must iterate over more values that can be supplied - * to fromAnyRef(). A Map will become a - * {@link ConfigObject} and an Iterable will become a - * {@link ConfigList}. If the Iterable is not an ordered - * collection, results could be strange, since ConfigList is - * ordered. + * Map must be a Map from String to more values that + * can be supplied to fromAnyRef(). An Iterable must + * iterate over more values that can be supplied to fromAnyRef(). + * A Map will become a {@link ConfigObject} and an + * Iterable will become a {@link ConfigList}. If the + * Iterable is not an ordered collection, results could be + * strange, since ConfigList is ordered. * - *

- * In a Map passed to fromAnyRef(), the map's keys - * are plain keys, not path expressions. So if your Map has a - * key "foo.bar" then you will get one object with a key called "foo.bar", - * rather than an object with a key "foo" containing another object with a - * key "bar". + *

In a Map passed to fromAnyRef(), the map's + * keys are plain keys, not path expressions. So if your Map has + * a key "foo.bar" then you will get one object with a key called "foo.bar", + * rather than an object with a key "foo" containing another object with a key + * "bar". * - *

- * The originDescription will be used to set the `origin()` field on the + *

The originDescription will be used to set the `origin()` field on the * `ConfigValue`. It should normally be the name of the file the values came * from, or something short describing the value such as "default settings". - * The originDescription is prefixed to error messages so users can tell - * where problematic values are coming from. + * The originDescription is prefixed to error messages so users can tell where + * problematic values are coming from. * - *

- * Supplying the result of `ConfigValue.unwrapped()` to this function is + *

Supplying the result of `ConfigValue.unwrapped()` to this function is * guaranteed to work and should give you back a `ConfigValue` that matches * the one you unwrapped. The re-wrapped `ConfigValue` will lose some * information that was present in the original such as its origin, but it * will have matching values. * - *

- * If you pass in a ConfigValue to this - * function, it will be returned unmodified. (The - * originDescription will be ignored in this - * case.) + *

If you pass in a ConfigValue to this function, it will be + * returned unmodified. (The originDescription will be ignored in + * this case.) * - *

- * This function throws if you supply a value that cannot be converted to a - * ConfigValue, but supplying such a value is a bug in your program, so you + *

This function throws if you supply a value that cannot be converted to + * a ConfigValue, but supplying such a value is a bug in your program, so you * should never handle the exception. Just fix your program (or report a bug * against this library). * * @param object - * object to convert to ConfigValue + * object to convert to ConfigValue * @param originDescription - * name of origin file or brief description of what the value is - * @return a new value + * name of origin file or brief description of what the value is + * @return + * a new value */ def fromAnyRef(obj: Object, originDescription: String): ConfigValue = ConfigImpl.fromAnyRef(obj, originDescription) @@ -73,27 +67,27 @@ object ConfigValueFactory { * See the * [[#fromAnyRef(obj:Object,originDescription:String)* fromAnyRef(Object,String)]] * documentation for details. This is a typesafe wrapper that only works on - * `java.util.Map` and returns {@link ConfigObject} rather than - * {@link ConfigValue}. + * `java.util.Map` and returns {@link ConfigObject} rather than {@link + * ConfigValue}. * - *

- * If your Map has a key "foo.bar" then you will get one object - * with a key called "foo.bar", rather than an object with a key "foo" + *

If your Map has a key "foo.bar" then you will get one + * object with a key called "foo.bar", rather than an object with a key "foo" * containing another object with a key "bar". The keys in the map are keys; - * not path expressions. That is, the Map corresponds exactly - * to a single {@code ConfigObject}. The keys will not be parsed or - * modified, and the values are wrapped in ConfigValue. To get nested - * {@code ConfigObject}, some of the values in the map would have to be more - * maps. + * not path expressions. That is, the Map corresponds exactly to + * a single {@code ConfigObject}. The keys will not be parsed or modified, and + * the values are wrapped in ConfigValue. To get nested {@code ConfigObject}, + * some of the values in the map would have to be more maps. * - *

- * See also + *

See also * [[ConfigFactory$.parseMap(values:java\.util\.Map[String,_],originDescription:String)* ConfigFactory.parseMap(Map,String)]] * which interprets the keys in the map as path expressions. * - * @param values map from keys to plain Java values - * @param originDescription description to use in {@link ConfigOrigin} of created values - * @return a new {@link ConfigObject} value + * @param values + * map from keys to plain Java values + * @param originDescription + * description to use in {@link ConfigOrigin} of created values + * @return + * a new {@link ConfigObject} value */ def fromMap( values: ju.Map[String, _], @@ -105,12 +99,15 @@ object ConfigValueFactory { * See the * [[#fromAnyRef(obj:Object,originDescription:String)* fromAnyRef(Object,String)]] * documentation for details. This is a typesafe wrapper that only works on - * `java.lang.Iterable` and returns {@link ConfigList} rather than - * {@link ConfigValue}. + * `java.lang.Iterable` and returns {@link ConfigList} rather than {@link + * ConfigValue}. * - * @param values list of plain Java values - * @param originDescription description to use in {@link ConfigOrigin} of created values - * @return a new {@link ConfigList} value + * @param values + * list of plain Java values + * @param originDescription + * description to use in {@link ConfigOrigin} of created values + * @return + * a new {@link ConfigList} value */ def fromIterable( values: jl.Iterable[_], @@ -119,11 +116,14 @@ object ConfigValueFactory { fromAnyRef(values, originDescription).asInstanceOf[ConfigList] /** - * See the other overload [[#fromAnyRef(obj:Object,originDescription:String)* fromAnyRef(Object,String)]] + * See the other overload + * [[#fromAnyRef(obj:Object,originDescription:String)* fromAnyRef(Object,String)]] * for details, this one just uses a default origin description. * - * @param object a plain Java value - * @return a new {@link ConfigValue} + * @param object + * a plain Java value + * @return + * a new {@link ConfigValue} */ def fromAnyRef(obj: Object): ConfigValue = fromAnyRef(obj, null) @@ -132,12 +132,14 @@ object ConfigValueFactory { * [[#fromMap(values:java\.util\.Map[String,_],originDescription:String)* fromMap(Map,String)]] * for details, this one just uses a default origin description. * - *

- * See also [[ConfigFactory$.parseMap(values:java\.util\.Map[String,_])* ConfigFactory.parseMap(ju.Map)]] + *

See also + * [[ConfigFactory$.parseMap(values:java\.util\.Map[String,_])* ConfigFactory.parseMap(ju.Map)]] * which interprets the keys in the map as path expressions. * - * @param values map from keys to plain Java values - * @return a new {@link ConfigObject} + * @param values + * map from keys to plain Java values + * @return + * a new {@link ConfigObject} */ def fromMap(values: ju.Map[String, _]): ConfigObject = fromMap(values, null) @@ -146,8 +148,10 @@ object ConfigValueFactory { * [[#fromIterable(values:Iterable[_],originDescription:String)* fromIterable(jl.Iterable, String)]] * for details, this one just uses a default origin description. * - * @param values list of plain Java values - * @return a new {@link ConfigList} + * @param values + * list of plain Java values + * @return + * a new {@link ConfigList} */ def fromIterable(values: jl.Iterable[_]): ConfigList = fromIterable(values, null) diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/DefaultConfigLoadingStrategy.scala b/sconfig/shared/src/main/scala/org/ekrich/config/DefaultConfigLoadingStrategy.scala index c2b739d4..5804537f 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/DefaultConfigLoadingStrategy.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/DefaultConfigLoadingStrategy.scala @@ -5,9 +5,9 @@ import java.net.MalformedURLException import java.net.URL /** - * Default config loading strategy. Able to load resource, file or URL. - * Behavior may be altered by defining one of VM properties - * {@code config.resource}, {@code config.file} or {@code config.url} + * Default config loading strategy. Able to load resource, file or URL. Behavior + * may be altered by defining one of VM properties {@code config.resource}, + * {@code config.file} or {@code config.url} */ class DefaultConfigLoadingStrategy extends ConfigLoadingStrategy { override def parseApplicationConfig( diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/AbstractConfigNode.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/AbstractConfigNode.scala index e370fd89..c808c2a6 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/AbstractConfigNode.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/AbstractConfigNode.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2015 Typesafe Inc. + * Copyright (C) 2015 Typesafe Inc. */ package org.ekrich.config.impl diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/AbstractConfigNodeValue.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/AbstractConfigNodeValue.scala index 7f5bead6..4537f8e8 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/AbstractConfigNodeValue.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/AbstractConfigNodeValue.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2015 Typesafe Inc. + * Copyright (C) 2015 Typesafe Inc. */ package org.ekrich.config.impl 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 151d0edb..74c8e9b8 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 @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl @@ -26,7 +26,7 @@ object AbstractConfigObject { // we'll fail if anything along the path can't // be looked at without resolving. val next = path.remainder - val v = self.attemptPeekWithPartialResolve(path.first) + val v = self.attemptPeekWithPartialResolve(path.first) if (next == null) v else if (v.isInstanceOf[AbstractConfigObject]) peekPath(v.asInstanceOf[AbstractConfigObject], next) @@ -41,9 +41,9 @@ object AbstractConfigObject { ): ConfigOrigin = { if (stack.isEmpty) throw new ConfigException.BugOrBroken("can't merge origins on empty list") - val origins = new ju.ArrayList[ConfigOrigin] + val origins = new ju.ArrayList[ConfigOrigin] var firstOrigin: ConfigOrigin = null - var numMerged = 0 + var numMerged = 0 for (v <- stack.asScala) { if (firstOrigin == null) firstOrigin = v.origin if (v.isInstanceOf[AbstractConfigObject] && (v @@ -70,7 +70,7 @@ object AbstractConfigObject { ): ConfigOrigin = { val javaColl = stack.asJavaCollection mergeOrigins(javaColl) - //throws NotPossibleToResolve + // throws NotPossibleToResolve } private def weAreImmutable(method: String) = @@ -113,7 +113,8 @@ abstract class AbstractConfigObject(_origin: ConfigOrigin) * ConfigException.NotResolved will be thrown. * * @param key - * @return the unmodified raw value or null + * @return + * the unmodified raw value or null */ final private[impl] def peekAssumingResolved( key: String, @@ -132,11 +133,11 @@ abstract class AbstractConfigObject(_origin: ConfigOrigin) * then try to look up the key anyway if possible. * * @param key - * key to look up - * @return the value of the key, or null if known not to exist + * key to look up + * @return + * the value of the key, or null if known not to exist * @throws ConfigException.NotResolved - * if can't figure out key's value (or existence) without more - * resolving + * if can't figure out key's value (or existence) without more resolving */ private[impl] def attemptPeekWithPartialResolve( key: String @@ -144,8 +145,8 @@ abstract class AbstractConfigObject(_origin: ConfigOrigin) /** * Looks up the path with no transformation or type conversion. Returns null - * if the path is not found; throws ConfigException.NotResolved if we need - * to go through an unresolved node to look up the path. + * if the path is not found; throws ConfigException.NotResolved if we need to + * go through an unresolved node to look up the path. */ private[impl] def peekPath(path: Path): AbstractConfigValue = AbstractConfigObject.peekPath(this, path) diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/AbstractConfigValue.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/AbstractConfigValue.scala index 9550c4f6..9d57e41c 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/AbstractConfigValue.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/AbstractConfigValue.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl @@ -18,22 +18,20 @@ import org.ekrich.config.ConfigValue import org.ekrich.config.impl.AbstractConfigValue.NotPossibleToResolve /** - * * Trying very hard to avoid a parent reference in config values; when you have * a tree like this, the availability of parent() tends to result in a lot of * improperly-factored and non-modular code. Please don't add parent(). - * */ object AbstractConfigValue { /** * This exception means that a value is inherently not resolveable, at the - * moment the only known cause is a cycle of substitutions. This is a - * checked exception since it's internal to the library and we want to be - * sure we handle it before passing it out to public API. This is only - * supposed to be thrown by the target of a cyclic reference and it's - * supposed to be caught by the ConfigReference looking up that reference, - * so it should be impossible for an outermost resolve() to throw this. + * moment the only known cause is a cycle of substitutions. This is a checked + * exception since it's internal to the library and we want to be sure we + * handle it before passing it out to public API. This is only supposed to be + * thrown by the target of a cyclic reference and it's supposed to be caught + * by the ConfigReference looking up that reference, so it should be + * impossible for an outermost resolve() to throw this. * * Contrast with ConfigException.NotResolved which just means nobody called * resolve(). @@ -133,10 +131,11 @@ abstract class AbstractConfigValue private[impl] (val _origin: ConfigOrigin) * Called only by ResolveContext.resolve(). * * @param context - * state of the current resolve + * state of the current resolve * @param source - * where to look up values - * @return a new value if there were changes, or this if no changes + * where to look up values + * @return + * a new value if there were changes, or this if no changes */ @throws[NotPossibleToResolve] def resolveSubstitutions( @@ -149,15 +148,15 @@ abstract class AbstractConfigValue private[impl] (val _origin: ConfigOrigin) /** * This is used when including one file in another; the included file is - * relativized to the path it's included into in the parent file. The point - * is that if you include a file at `foo.bar` in the parent, and the included + * relativized to the path it's included into in the parent file. The point is + * that if you include a file at `foo.bar` in the parent, and the included * file as a substitution `\${a.b.c}`, the included substitution now needs to * be `\${foo.bar.a.b.c}` because we resolve substitutions globally only after * parsing everything. * * @param prefix - * @return value relativized to the given path or the same value if nothing - * to do + * @return + * value relativized to the given path or the same value if nothing to do */ private[impl] def relativized(prefix: Path) = this diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/BadMap.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/BadMap.scala index f07f6a7a..6250f663 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/BadMap.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/BadMap.scala @@ -2,9 +2,8 @@ package org.ekrich.config.impl import scala.annotation.tailrec /** - * A terrible Map that isn't as expensive as HashMap to copy and - * add one item to. Please write something real if you see this - * and get cranky. + * A terrible Map that isn't as expensive as HashMap to copy and add one item + * to. Please write something real if you see this and get cranky. */ object BadMap { final private[impl] class Entry private[impl] ( @@ -26,12 +25,12 @@ object BadMap { k: K, v: V ): Unit = { - val i = hash % entries.length + val i = hash % entries.length val old = entries(i) // old may be null entries(i) = new Entry(hash, k, v, old) } private def store(entries: Array[Entry], e: Entry): Unit = { - val i = e.hash % entries.length + val i = e.hash % entries.length val old = entries(i) if (old == null && e.next == null) { // share the entry since it has no "next" @@ -61,20 +60,20 @@ object BadMap { } } private val primes = Array( - /* Skip some early ones that are close together */ - 2, /* 3, */ 5, /* 7, */ 11, /* 13, */ 17, /* 19, */ 23, 29, 31, 37, 41, - 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, - 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, - 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, - 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, - 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, - 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, - 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, - 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, - 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, - 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, - 983, 991, 997, 1009, /* now we start skipping some, this is arbitrary */ - 2053, 3079, 4057, 7103, 10949, 16069, 32609, 65867, 104729) + /* Skip some early ones that are close together */ + 2, /* 3, */ 5, /* 7, */ 11, /* 13, */ 17, /* 19, */ 23, 29, 31, 37, 41, 43, + 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, + 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, + 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, + 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, + 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, + 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, + 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, + 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, + 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, + 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, + 991, 997, 1009, /* now we start skipping some, this is arbitrary */ + 2053, 3079, 4057, 7103, 10949, 16069, 32609, 65867, 104729) private def nextPrime(i: Int): Int = primes.find(p => p > i).getOrElse(primes(primes.length - 1)) @@ -87,7 +86,7 @@ final class BadMap[K, V] private ( def this() = this(0, BadMap.emptyEntries) private[impl] def copyingPut(k: K, v: V) = { - val newSize = size + 1 + val newSize = size + 1 var newEntries: Array[BadMap.Entry] = null if (newSize > entries.length) { // nextPrime doesn't always return a prime larger than @@ -107,8 +106,8 @@ final class BadMap[K, V] private ( if (entries.length == 0) null.asInstanceOf[V] else { val hash = Math.abs(k.hashCode) - val i = hash % entries.length - val e = entries(i) + val i = hash % entries.length + val e = entries(i) if (e == null) null.asInstanceOf[V] else e.find(k).asInstanceOf[V] } 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 821aa62a..97fcf075 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 @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl 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 0ecd6757..df428600 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 @@ -33,15 +33,15 @@ object ConfigConcatenation { builder: ju.ArrayList[AbstractConfigValue], origRight: AbstractConfigValue ): Unit = { - var left = builder.get(builder.size - 1) + var left = builder.get(builder.size - 1) var right = origRight // check for an object which can be converted to a list // (this will be an object with numeric keys, like foo.0, foo.1) - if (left.isInstanceOf[ConfigObject] && right - .isInstanceOf[SimpleConfigList]) + if (left.isInstanceOf[ConfigObject] && + right.isInstanceOf[SimpleConfigList]) left = DefaultTransformer.transform(left, ConfigValueType.LIST) - else if (left.isInstanceOf[SimpleConfigList] && right - .isInstanceOf[ConfigObject]) + else if (left.isInstanceOf[SimpleConfigList] && + right.isInstanceOf[ConfigObject]) right = DefaultTransformer.transform(right, ConfigValueType.LIST) // Since this depends on the type of two instances, I couldn't think // of much alternative to an instanceof chain. Visitors are sometimes @@ -49,20 +49,20 @@ object ConfigConcatenation { var joined: AbstractConfigValue = null if (left.isInstanceOf[ConfigObject] && right.isInstanceOf[ConfigObject]) joined = right.withFallback(left) - else if (left.isInstanceOf[SimpleConfigList] && right - .isInstanceOf[SimpleConfigList]) + else if (left.isInstanceOf[SimpleConfigList] && + right.isInstanceOf[SimpleConfigList]) joined = left .asInstanceOf[SimpleConfigList] .concatenate(right.asInstanceOf[SimpleConfigList]) - else if ((left.isInstanceOf[SimpleConfigList] || left - .isInstanceOf[ConfigObject]) && isIgnoredWhitespace(right)) { + else if ((left.isInstanceOf[SimpleConfigList] || + left.isInstanceOf[ConfigObject]) && isIgnoredWhitespace(right)) { joined = left // it should be impossible that left is whitespace and right is a list or object - } else if (left.isInstanceOf[ConfigConcatenation] || right - .isInstanceOf[ConfigConcatenation]) + } else if (left.isInstanceOf[ConfigConcatenation] || + right.isInstanceOf[ConfigConcatenation]) throw new ConfigException.BugOrBroken("unflattened ConfigConcatenation") - else if (left.isInstanceOf[Unmergeable] || right - .isInstanceOf[Unmergeable]) { + else if (left.isInstanceOf[Unmergeable] || + right.isInstanceOf[Unmergeable]) { // leave joined=null, cannot join } else { // handle primitive type or primitive type mixed with object or list val s1 = left.transformToString @@ -182,7 +182,7 @@ final class ConfigConcatenation( // content of ConfigConcatenation should not need to replaceChild, // but if it did we'd have to do this. val sourceWithParent = source // .pushParent(this) - var newContext = context + var newContext = context val resolved = new ju.ArrayList[AbstractConfigValue](pieces.size) for (p <- pieces.asScala) { // to concat into a string we have to do a full resolve, 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 a705badd..f967e56d 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 @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl @@ -44,8 +44,8 @@ object ConfigDelayedMerge { // we won't be a delayed merge anymore. If restrictToChildOrNull // is non-null, or resolve options allow partial resolves, // we may remain a delayed merge though. - var newContext = context - var count = 0 + var newContext = context + var count = 0 var merged: AbstractConfigValue = null for (end <- stack.asScala) { // the end value may or may not be resolved already var sourceForEnd: ResolveSource = null @@ -201,7 +201,7 @@ object ConfigDelayedMerge { sb.setLength(sb.length - 1) if (options.getFormatted) { sb.setLength(sb.length - 1) // also chop comma - sb.append("\n") // put a newline back + sb.append("\n") // put a newline back } if (commentMerge) { indent(sb, indentVal, options) 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 456ac5f9..b64997fa 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 @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl @@ -158,18 +158,18 @@ 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 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) = throw ConfigDelayedMergeObject.notResolved override def containsValue(value: Any) = 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 + 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/ConfigDocumentParser.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigDocumentParser.scala index 00c9e561..ec994273 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigDocumentParser.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigDocumentParser.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2015 Typesafe Inc. + * Copyright (C) 2015 Typesafe Inc. */ package org.ekrich.config.impl @@ -52,7 +52,7 @@ object ConfigDocumentParser { val baseOrigin: ConfigOrigin, val tokens: ju.Iterator[Token] ) { - private var lineNumber = 1 + private var lineNumber = 1 final private var buffer = new ArrayStack[Token] // this is the number of "equals" we are inside, // used to modify the error message to reflect that @@ -66,8 +66,7 @@ object ConfigDocumentParser { private def nextToken: Token = { val t = popToken if (flavor eq ConfigSyntax.JSON) - if (Tokens.isUnquotedText(t) && !ParseContext - .isUnquotedWhitespace(t)) + if (Tokens.isUnquotedText(t) && !ParseContext.isUnquotedWhitespace(t)) throw parseError( "Token not allowed in valid JSON: '" + Tokens .getUnquotedText(t) + "'" @@ -84,8 +83,8 @@ object ConfigDocumentParser { breakable { while (true) { val t: Token = nextToken - if (Tokens.isIgnoredWhitespace(t) || Tokens.isNewline(t) || ParseContext - .isUnquotedWhitespace(t)) { + if (Tokens.isIgnoredWhitespace(t) || Tokens.isNewline(t) || + ParseContext.isUnquotedWhitespace(t)) { nodes.add(new ConfigNodeSingleToken(t)) if (Tokens.isNewline(t)) { lineNumber = t.lineNumber + 1 @@ -95,7 +94,7 @@ object ConfigDocumentParser { } else { val newNumber = t.lineNumber if (newNumber >= 0) lineNumber = newNumber - //return t + // return t retToken = t break() // break - added for Scala to "return" } @@ -125,8 +124,8 @@ object ConfigDocumentParser { } } else { var sawSeparatorOrNewline = false - var t = nextToken - var retTrue = false // added for Scala for break below + var t = nextToken + var retTrue = false // added for Scala for break below breakable { while (true) { if (Tokens.isIgnoredWhitespace(t) || ParseContext @@ -141,13 +140,13 @@ object ConfigDocumentParser { // a comma if there is one. } else if (t eq Tokens.COMMA) { nodes.add(new ConfigNodeSingleToken(t)) - //return true + // return true retTrue = true break() // break - added for Scala to "return" } else { // non-newline-or-comma putBack(t) - //return sawSeparatorOrNewline + // return sawSeparatorOrNewline break() // break - added for Scala to "return" } t = nextToken @@ -174,9 +173,9 @@ object ConfigDocumentParser { var v: AbstractConfigNodeValue = null if (Tokens.isIgnoredWhitespace(t)) { values.add(new ConfigNodeSingleToken(t)) - } else if (Tokens.isValue(t) || Tokens.isUnquotedText(t) || Tokens - .isSubstitution(t) || - (t eq Tokens.OPEN_CURLY) || (t eq Tokens.OPEN_SQUARE)) { + } else if (Tokens.isValue(t) || Tokens.isUnquotedText(t) || + Tokens.isSubstitution(t) || + (t eq Tokens.OPEN_CURLY) || (t eq Tokens.OPEN_SQUARE)) { // there may be newlines _within_ the objects and arrays v = parseValue(t) valueCount += 1 @@ -189,24 +188,6 @@ object ConfigDocumentParser { } } - // original converted Java code - //while (true) { - // var v: : AbstractConfigNodeValue = null - // if (Tokens.isIgnoredWhitespace(t)) { - // values.add(new ConfigNodeSingleToken(t)) - // t = nextToken - // continue //todo: continue is not supported - // } else if (Tokens.isValue(t) || Tokens.isUnquotedText(t) || Tokens.isSubstitution( - // t - // ) || (t eq Tokens.OPEN_CURLY) || (t eq Tokens.OPEN_SQUARE)) { // there may be newlines _within_ the objects and arrays - // v = parseValue(t) - // valueCount += 1 - // } else break//todo: break is not supported - // if (v == null) throw new ConfigException.BugOrBroken("no value") - // values.add(v) - // t = nextToken // but don't consolidate across a newline - // - //} putBack(t) // No concatenation was seen, but a single value may have been parsed, so return it, and put back // all succeeding tokens @@ -273,7 +254,7 @@ object ConfigDocumentParser { } private def parseValue(t: Token): AbstractConfigNodeValue = { var v: AbstractConfigNodeValue = null - val startingEqualsCount = equalsCount + val startingEqualsCount = equalsCount if (Tokens.isValue(t) || Tokens.isUnquotedText(t) || Tokens .isSubstitution(t)) v = new ConfigNodeSimpleValue(t) else if (t eq Tokens.OPEN_CURLY) v = parseObject(true) @@ -304,7 +285,7 @@ object ConfigDocumentParser { ) else { val expression = new ju.ArrayList[Token] - var t = token + var t = token while (Tokens.isValue(t) || Tokens.isUnquotedText(t)) { expression.add(t) t = nextToken // note: don't cross a newline @@ -335,7 +316,7 @@ object ConfigDocumentParser { val r = kindText.replaceFirst("required\\(", "") if (r.length > 0) putBack(Tokens.newUnquotedText(t.origin, r)) children.add(new ConfigNodeSingleToken(t)) - //children.add(new ConfigNodeSingleToken(tOpen)); + // children.add(new ConfigNodeSingleToken(tOpen)); val res = parseIncludeResource(children, true) t = nextTokenCollectingWhitespace(children) if (Tokens.isUnquotedText(t) && Tokens.getUnquotedText(t) == ")") { @@ -359,9 +340,9 @@ object ConfigDocumentParser { // we either have a quoted string or the "file()" syntax if (Tokens.isUnquotedText(t)) { // get foo( - val kindText = Tokens.getUnquotedText(t) + val kindText = Tokens.getUnquotedText(t) var kind: ConfigIncludeKind = null - var prefix: String = null + var prefix: String = null if (kindText.startsWith("url(")) { kind = ConfigIncludeKind.URL prefix = "url(" @@ -405,13 +386,13 @@ object ConfigDocumentParser { } private def parseObject(hadOpenCurly: Boolean): ConfigNodeComplexValue = { // invoked just after the OPEN_CURLY (or START, if !hadOpenCurly) - var afterComma = false - val lastPath: Path = null // always null here ?? + var afterComma = false + val lastPath: Path = null // always null here ?? var lastInsideEquals = false val objectNodes = new ju.ArrayList[AbstractConfigNode] var keyValueNodes: ju.ArrayList[AbstractConfigNode] = null - val keys = new ju.HashMap[String, jl.Boolean] + val keys = new ju.HashMap[String, jl.Boolean] if (hadOpenCurly) objectNodes.add(new ConfigNodeSingleToken(Tokens.OPEN_CURLY)) breakable { @@ -438,7 +419,7 @@ object ConfigDocumentParser { putBack(t) break() // break } else if ((flavor ne ConfigSyntax.JSON) && ParseContext - .isIncludeKeyword(t)) { + .isIncludeKeyword(t)) { val includeNodes = new ju.ArrayList[AbstractConfigNode] includeNodes.add(new ConfigNodeSingleToken(t)) @@ -447,10 +428,10 @@ object ConfigDocumentParser { } else { keyValueNodes = new ju.ArrayList[AbstractConfigNode] val keyToken = t - val path = parseKey(keyToken) + val path = parseKey(keyToken) keyValueNodes.add(path) - val afterKey = nextTokenCollectingWhitespace(keyValueNodes) - var insideEquals = false + val afterKey = nextTokenCollectingWhitespace(keyValueNodes) + var insideEquals = false var nextValue: AbstractConfigNodeValue = null if ((flavor eq ConfigSyntax.CONF) && (afterKey eq Tokens.OPEN_CURLY)) { // can omit the ':' or '=' before an object value @@ -476,7 +457,7 @@ object ConfigDocumentParser { keyValueNodes.add(nextValue) if (insideEquals) equalsCount -= 1 lastInsideEquals = insideEquals - val key = path.value.first + val key = path.value.first val remaining = path.value.remainder if (remaining == null) { val existing = keys.get(key) @@ -552,7 +533,7 @@ object ConfigDocumentParser { new ju.ArrayList[AbstractConfigNode] children.add(new ConfigNodeSingleToken(Tokens.OPEN_SQUARE)) // invoked just after the OPEN_SQUARE - var t: Token = null + var t: Token = null var nextValue = consolidateValues(children) if (nextValue != null) children.add(nextValue) else { @@ -561,8 +542,9 @@ object ConfigDocumentParser { if (t eq Tokens.CLOSE_SQUARE) { children.add(new ConfigNodeSingleToken(t)) return new ConfigNodeArray(children) - } else if (Tokens.isValue(t) || (t eq Tokens.OPEN_CURLY) || (t eq Tokens.OPEN_SQUARE) || Tokens - .isUnquotedText(t) || Tokens.isSubstitution(t)) { + } else if (Tokens.isValue(t) || (t eq Tokens.OPEN_CURLY) || + (t eq Tokens.OPEN_SQUARE) || Tokens.isUnquotedText(t) || + Tokens.isSubstitution(t)) { nextValue = parseValue(t) children.add(nextValue) } else @@ -580,7 +562,7 @@ object ConfigDocumentParser { t = nextTokenCollectingWhitespace(children) if (t eq Tokens.CLOSE_SQUARE) { children.add(new ConfigNodeSingleToken(t)) - //return new ConfigNodeArray(children) + // return new ConfigNodeArray(children) break() // break - added for Scala to force return from while loop } else throw parseError( @@ -593,8 +575,9 @@ object ConfigDocumentParser { if (nextValue != null) children.add(nextValue) else { t = nextTokenCollectingWhitespace(children) - if (Tokens.isValue(t) || (t eq Tokens.OPEN_CURLY) || (t eq Tokens.OPEN_SQUARE) || Tokens - .isUnquotedText(t) || Tokens.isSubstitution(t)) { + if (Tokens.isValue(t) || (t eq Tokens.OPEN_CURLY) || + (t eq Tokens.OPEN_SQUARE) || Tokens.isUnquotedText(t) || + Tokens.isSubstitution(t)) { nextValue = parseValue(t) children.add(nextValue) } else if ((flavor ne ConfigSyntax.JSON) && (t eq Tokens.CLOSE_SQUARE)) { @@ -614,7 +597,7 @@ object ConfigDocumentParser { private[impl] def parse: ConfigNodeRoot = { val children = new ju.ArrayList[AbstractConfigNode] - var t = nextToken + var t = nextToken if (t eq Tokens.START) { // OK } else @@ -623,7 +606,7 @@ object ConfigDocumentParser { ) t = nextTokenCollectingWhitespace(children) var result: AbstractConfigNode = null - var missingCurly = false + var missingCurly = false if ((t eq Tokens.OPEN_CURLY) || (t eq Tokens.OPEN_SQUARE)) result = parseValue(t) else if (flavor eq ConfigSyntax.JSON) @@ -688,7 +671,7 @@ object ConfigDocumentParser { } else { putBack(t) val nodes = new ju.ArrayList[AbstractConfigNode] - val node = consolidateValues(nodes) + val node = consolidateValues(nodes) t = nextToken if (t eq Tokens.END) return node else 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 0d1e8cbe..9905226e 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 @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigImpl.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigImpl.scala index c629416f..e9e44af1 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigImpl.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigImpl.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl @@ -22,14 +22,14 @@ import org.ekrich.config.ConfigParseable import org.ekrich.config.ConfigValue /** - * Internal implementation detail, not ABI stable, do not touch. - * For use only by the {@link org.ekrich.config} package. + * Internal implementation detail, not ABI stable, do not touch. For use only by + * the {@link org.ekrich.config} package. */ object ConfigImpl { private[impl] class LoaderCache private[impl] () { private[impl] var currentSystemProperties: Config = null - private var currentLoader = new WeakReference[ClassLoader](null) - private val cache = new ju.HashMap[String, Config] + private var currentLoader = new WeakReference[ClassLoader](null) + private val cache = new ju.HashMap[String, Config] // for now, caching as long as the loader remains the same, // drop entire cache if it changes. @@ -303,7 +303,7 @@ object ConfigImpl { private def getSystemProperties: ju.Properties = { // Avoid ConcurrentModificationException due to parallel setting of system properties by copying properties - val systemProperties = System.getProperties + val systemProperties = System.getProperties val systemPropertiesCopy = new ju.Properties systemProperties.synchronized { for (entry <- systemProperties.entrySet().asScala) { @@ -397,7 +397,7 @@ object ConfigImpl { } private object DebugHolder { - private val LOADS = "loads" + private val LOADS = "loads" private val SUBSTITUTIONS = "substitutions" private def loadDiagnostics: ju.Map[String, jl.Boolean] = { val result = new ju.HashMap[String, jl.Boolean] @@ -422,7 +422,7 @@ object ConfigImpl { } } private[impl] val diagnostics: ju.Map[String, jl.Boolean] = loadDiagnostics - private[impl] val traceLoadsEnabled: Boolean = diagnostics.get(LOADS) + private[impl] val traceLoadsEnabled: Boolean = diagnostics.get(LOADS) private[impl] val traceSubstitutionsEnabled: Boolean = diagnostics.get(SUBSTITUTIONS) // two methods for the two previous vals are not needed in Scala diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigImplUtil.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigImplUtil.scala index ccce7a41..14b0b285 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigImplUtil.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigImplUtil.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl @@ -18,8 +18,8 @@ import org.ekrich.config.ConfigOrigin import org.ekrich.config.ConfigSyntax /** - * Internal implementation detail, not ABI stable, do not touch. - * For use only by the {@link org.ekrich.config} package. + * Internal implementation detail, not ABI stable, do not touch. For use only by + * the {@link org.ekrich.config} package. */ object ConfigImplUtil { def equalsHandlingNull(a: AnyRef, b: AnyRef) = @@ -31,7 +31,7 @@ object ConfigImplUtil { } else a == b def isC0Control(codepoint: Int) = - codepoint >= 0x0000 && codepoint <= 0x001F + codepoint >= 0x0000 && codepoint <= 0x001f def renderJsonString(s: String): String = { val sb = new StringBuilder @@ -71,8 +71,9 @@ object ConfigImplUtil { // to ensure we end up with a string and not a number val first = s.codePointAt(0) if (Character.isDigit(first) || first == '-') return renderJsonString(s) - if (s.startsWith("include") || s.startsWith("true") || s.startsWith("false") || - s.startsWith("null") || s.contains("//")) return renderJsonString(s) + if (s.startsWith("include") || s.startsWith("true") || s.startsWith("false") + || s.startsWith("null") || s.contains("//")) + return renderJsonString(s) // only unquote if it's pure alphanumeric var i = 0 while (i < s.length) { @@ -127,7 +128,7 @@ object ConfigImplUtil { val c = s.charAt(end - 1) if (c == ' ' || c == '\n') end -= 1 else { - var cp = 0 + var cp = 0 var delta = 0 if (Character.isLowSurrogate(c)) { cp = s.codePointAt(end - 2) @@ -152,7 +153,7 @@ object ConfigImplUtil { private[impl] def urlToFile(url: URL): File = { // this isn't really right, clearly, but not sure what to do. try // this will properly handle hex escapes, etc. - return new File(url.toURI()) + return new File(url.toURI()) catch { case e: URISyntaxException => // this handles some stuff like file:///c:/Whatever/ @@ -169,7 +170,7 @@ object ConfigImplUtil { def joinPath(elements: ju.List[String]): String = joinPath(elements.asScala.toSeq: _*) def splitPath(path: String): ju.List[String] = { - var p = Path.newPath(path) + var p = Path.newPath(path) val elements = new ju.ArrayList[String] while (p != null) { elements.add(p.first) @@ -190,7 +191,7 @@ object ConfigImplUtil { ) private[impl] def toCamelCase(originalName: String): String = { - val words = originalName.split("-+") + val words = originalName.split("-+") val nameBuilder = new StringBuilder(originalName.length) for (word <- words) { if (nameBuilder.length == 0) nameBuilder.append(word) @@ -205,8 +206,10 @@ object ConfigImplUtil { /** * Guess configuration syntax from given filename. * - * @param filename configuration filename - * @return configuration syntax if a match is found. Otherwise, null. + * @param filename + * configuration filename + * @return + * configuration syntax if a match is found. Otherwise, null. */ def syntaxFromExtension(filename: String): ConfigSyntax = if (filename == null) null 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 dbc601e9..0d45ab37 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 @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl 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 f1d533da..8b9f4b5a 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 @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeComplexValue.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeComplexValue.scala index 8e3f335b..df9bab68 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeComplexValue.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeComplexValue.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2015 Typesafe Inc. + * Copyright (C) 2015 Typesafe Inc. */ package org.ekrich.config.impl diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeField.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeField.scala index 140594bd..50c7c10a 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeField.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeField.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2015 Typesafe Inc. + * Copyright (C) 2015 Typesafe Inc. */ package org.ekrich.config.impl 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 f8ca4209..1a57855c 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 @@ -39,7 +39,7 @@ final class ConfigNodeObject private[impl] ( var seenNonMatching = false // Copy the value so we can change it to null but not modify the original parameter var valueCopy = value - var i = childrenCopy.size - 1 + var i = childrenCopy.size - 1 while (i >= 0) { breakable { if (childrenCopy.get(i).isInstanceOf[ConfigNodeSingleToken]) { @@ -72,7 +72,7 @@ final class ConfigNodeObject private[impl] ( childrenCopy.remove(j) j -= 1 } else break() // break - } else break() // break + } else break() // break j += 1 } @@ -186,7 +186,7 @@ final class ConfigNodeObject private[impl] ( .asInstanceOf[ConfigNodeSingleToken] .token == Tokens.CLOSE_CURLY)) { val beforeLast = children.get(children.size - 2) - var indent = "" + var indent = "" if (beforeLast.isInstanceOf[ConfigNodeSingleToken] && Tokens .isIgnoredWhitespace( beforeLast.asInstanceOf[ConfigNodeSingleToken].token @@ -209,8 +209,8 @@ final class ConfigNodeObject private[impl] ( value: AbstractConfigNodeValue, flavor: ConfigSyntax ): ConfigNodeObject = { - val path = desiredPath.value - val childrenCopy = new ju.ArrayList[AbstractConfigNode](children) + val path = desiredPath.value + val childrenCopy = new ju.ArrayList[AbstractConfigNode](children) val indentationCopy = new ju.ArrayList[AbstractConfigNode](indentation) // If the value we're inserting is a complex value, we'll need to indent it for insertion var indentedValue: AbstractConfigNodeValue = null @@ -236,11 +236,11 @@ final class ConfigNodeObject private[impl] ( } } if (index != -1) { - val i = lastIndex - index - val node = children.get(i).asInstanceOf[ConfigNodeField] - val key: Path = node.path.value + val i = lastIndex - index + val node = children.get(i).asInstanceOf[ConfigNodeField] + val key: Path = node.path.value val remainingPath = desiredPath.subPath(key.length) - val newValue = node.value.asInstanceOf[ConfigNodeObject] + val newValue = node.value.asInstanceOf[ConfigNodeObject] childrenCopy.set( i, node.replaceValue( @@ -318,19 +318,19 @@ final class ConfigNodeObject private[impl] ( childrenCopy.add(i - 1, new ConfigNodeField(newNodes)) i -= 1 } else if (previous.isInstanceOf[ConfigNodeSingleToken] && - Tokens.isIgnoredWhitespace( - previous.asInstanceOf[ConfigNodeSingleToken].token - )) { + Tokens.isIgnoredWhitespace( + previous.asInstanceOf[ConfigNodeSingleToken].token + )) { val beforePrevious = childrenCopy.get(i - 2) if (sameLine) { childrenCopy.add(i - 1, new ConfigNodeField(newNodes)) i -= 1 } else if (beforePrevious.isInstanceOf[ConfigNodeSingleToken] && - Tokens.isNewline( - beforePrevious - .asInstanceOf[ConfigNodeSingleToken] - .token - )) { + Tokens.isNewline( + beforePrevious + .asInstanceOf[ConfigNodeSingleToken] + .token + )) { childrenCopy.add(i - 2, new ConfigNodeField(newNodes)) i -= 2 } else childrenCopy.add(i, new ConfigNodeField(newNodes)) diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodePath.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodePath.scala index 5443b104..543148f8 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodePath.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodePath.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2015 Typesafe Inc. + * Copyright (C) 2015 Typesafe Inc. */ package org.ekrich.config.impl @@ -11,11 +11,11 @@ final class ConfigNodePath private[impl] ( tokensArg: ju.Collection[Token] ) extends AbstractConfigNode { override def tokens: ju.Collection[Token] = tokensArg - private[impl] def value: Path = path + private[impl] def value: Path = path private[impl] def subPath(toRemove: Int): ConfigNodePath = { var periodCount = 0 - val tokensCopy = new ju.ArrayList[Token](tokensArg) - var i = 0 + val tokensCopy = new ju.ArrayList[Token](tokensArg) + var i = 0 while (i < tokensCopy.size) { if (Tokens.isUnquotedText(tokensCopy.get(i)) && tokensCopy .get(i) @@ -36,7 +36,7 @@ final class ConfigNodePath private[impl] ( } private[impl] def first: ConfigNodePath = { val tokensCopy = new ju.ArrayList[Token](tokens) - var i = 0 + var i = 0 while (i < tokensCopy.size) { if (Tokens.isUnquotedText(tokensCopy.get(i)) && tokensCopy .get(i) 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 ff50684d..f27ad1af 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 @@ -14,7 +14,9 @@ final class ConfigNodeRoot private[impl] ( throw new ConfigException.BugOrBroken("Tried to indent the root object") private[impl] def value: ConfigNodeComplexValue = - children.asScala.find(node => node.isInstanceOf[ConfigNodeComplexValue]) match { + children.asScala.find(node => + node.isInstanceOf[ConfigNodeComplexValue] + ) match { case Some(node) => node.asInstanceOf[ConfigNodeComplexValue] case None => throw new ConfigException.BugOrBroken( diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeSimpleValue.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeSimpleValue.scala index f90f49cb..ffc12a96 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeSimpleValue.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeSimpleValue.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2015 Typesafe Inc. + * Copyright (C) 2015 Typesafe Inc. */ package org.ekrich.config.impl diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeSingleToken.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeSingleToken.scala index 924978a5..646d3cfc 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeSingleToken.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNodeSingleToken.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2015 Typesafe Inc. + * Copyright (C) 2015 Typesafe Inc. */ package org.ekrich.config.impl 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 36ca9d0f..4b2a90db 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 @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl @@ -16,7 +16,6 @@ import org.ekrich.config.ConfigValueType * where it was set to null) in case someone asks for the value. Also, null * overrides values set "earlier" in the search path, while missing values do * not. - * */ @SerialVersionUID(2L) final class ConfigNull(origin: ConfigOrigin) diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNumber.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNumber.scala index 1adec049..127a9286 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNumber.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigNumber.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl @@ -12,9 +12,10 @@ import org.ekrich.config.ConfigOrigin @SerialVersionUID(2L) object ConfigNumber { private[impl] def newNumber( // used ? - origin: ConfigOrigin, - number: Long, - originalText: String): ConfigNumber = + origin: ConfigOrigin, + number: Long, + originalText: String + ): ConfigNumber = if (number <= Integer.MAX_VALUE && number >= Integer.MIN_VALUE) new ConfigInt(origin, number.toInt, originalText) else new ConfigLong(origin, number, originalText) diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigParser.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigParser.scala index 2fb9fdd6..1a306dba 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigParser.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ConfigParser.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl @@ -36,8 +36,8 @@ object ConfigParser { ): AbstractConfigObject = { // for path foo.bar, we are creating // { "foo" : { "bar" : value } } - val keys = new ju.ArrayList[String] - var key = path.first + val keys = new ju.ArrayList[String] + var key = path.first var remaining = path.remainder breakable { while (key != null) { @@ -54,7 +54,7 @@ object ConfigParser { // on the exact leaf node they apply to. // a comment before "foo.bar" applies to the full setting // "foo.bar" not also to "foo" - val i = keys.listIterator(keys.size) + val i = keys.listIterator(keys.size) val deepest = i.previous var o = new SimpleConfigObject( value.origin.withComments(null), @@ -78,7 +78,7 @@ object ConfigParser { val includer: FullIncluder, val includeContext: ConfigIncludeContext ) { - private var lineNumber = 1 + private var lineNumber = 1 final private var pathStack = new ju.LinkedList[Path] // the number of lists we are inside; this is used to detect the "cannot // generate a reference to a list element" problem, and once we fix that @@ -130,7 +130,7 @@ object ConfigParser { comments: ju.List[String] ): AbstractConfigValue = { var v: AbstractConfigValue = null - val startingArrayCount = arrayCount + val startingArrayCount = arrayCount if (n.isInstanceOf[ConfigNodeSimpleValue]) v = n.asInstanceOf[ConfigNodeSimpleValue].value else if (n.isInstanceOf[ConfigNodeObject]) @@ -201,7 +201,7 @@ object ConfigParser { obj = obj.relativized(prefix) } for (key <- obj.keySet.asScala) { - val v = obj.get(key) + val v = obj.get(key) val existing = values.get(key) if (existing != null) values.put(key, v.withFallback(existing)) else values.put(key, v) @@ -211,28 +211,26 @@ object ConfigParser { private def parseObject(n: ConfigNodeObject): AbstractConfigObject = { val values = new ju.HashMap[String, AbstractConfigValue] - val objectOrigin = lineOrigin + val objectOrigin = lineOrigin var lastWasNewline = false val nodes = new ju.ArrayList[AbstractConfigNode](n.children) val comments = new ju.ArrayList[String] - var i = 0 + var i = 0 while (i < nodes.size) { val node = nodes.get(i) if (node.isInstanceOf[ConfigNodeComment]) { lastWasNewline = false comments.add(node.asInstanceOf[ConfigNodeComment].commentText) - } else if (node - .isInstanceOf[ConfigNodeSingleToken] && Tokens.isNewline( - node.asInstanceOf[ConfigNodeSingleToken].token - )) { + } else if (node.isInstanceOf[ConfigNodeSingleToken] && + Tokens.isNewline(node.asInstanceOf[ConfigNodeSingleToken].token)) { lineNumber += 1 if (lastWasNewline) { // Drop all comments if there was a blank line and start a new comment block comments.clear() } lastWasNewline = true - } else if ((flavor ne ConfigSyntax.JSON) && node - .isInstanceOf[ConfigNodeInclude]) { + } else if ((flavor ne ConfigSyntax.JSON) && + node.isInstanceOf[ConfigNodeInclude]) { parseInclude(values, node.asInstanceOf[ConfigNodeInclude]) lastWasNewline = false } else if (node.isInstanceOf[ConfigNodeField]) { @@ -257,7 +255,7 @@ object ConfigParser { arrayCount += 1 } var valueNode: AbstractConfigNodeValue = null - var newValue: AbstractConfigValue = null + var newValue: AbstractConfigValue = null valueNode = node.asInstanceOf[ConfigNodeField].value // comments from the key token go to the value token newValue = parseValue(valueNode, comments) @@ -316,7 +314,7 @@ object ConfigParser { } } pathStack.pop - val key = path.first + val key = path.first val remaining = path.remainder if (remaining == null) { val existing = values.get(key) @@ -350,19 +348,17 @@ object ConfigParser { private def parseArray(n: ConfigNodeArray) = { arrayCount += 1 - val arrayOrigin = lineOrigin - val values = new ju.ArrayList[AbstractConfigValue] - var lastWasNewLine = false - val comments = new ju.ArrayList[String] + val arrayOrigin = lineOrigin + val values = new ju.ArrayList[AbstractConfigValue] + var lastWasNewLine = false + val comments = new ju.ArrayList[String] var v: AbstractConfigValue = null for (node <- n.children.asScala) { if (node.isInstanceOf[ConfigNodeComment]) { comments.add(node.asInstanceOf[ConfigNodeComment].commentText) lastWasNewLine = false - } else if (node - .isInstanceOf[ConfigNodeSingleToken] && Tokens.isNewline( - node.asInstanceOf[ConfigNodeSingleToken].token - )) { + } else if (node.isInstanceOf[ConfigNodeSingleToken] && + Tokens.isNewline(node.asInstanceOf[ConfigNodeSingleToken].token)) { lineNumber += 1 if (lastWasNewLine && v == null) comments.clear() else if (v != null) { @@ -400,8 +396,8 @@ object ConfigParser { } private[impl] def parse: AbstractConfigValue = { var result: AbstractConfigValue = null - val comments = new ju.ArrayList[String] - var lastWasNewLine = false + val comments = new ju.ArrayList[String] + var lastWasNewLine = false breakable { for (node <- document.children.asScala) { if (node.isInstanceOf[ConfigNodeComment]) { 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 e3a719c4..406cc03c 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 @@ -39,7 +39,7 @@ final class ConfigReference( context: ResolveContext, source: ResolveSource ): ResolveResult[_ <: AbstractConfigValue] = { - var newContext = context.addCycleMarker(this) + var newContext = context.addCycleMarker(this) var v: AbstractConfigValue = null try { val resultWithPath = 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 5f0fec64..4f405e5d 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 @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/Container.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/Container.scala index b654e1c3..dc2766ed 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/Container.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/Container.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2014 Typesafe Inc. + * Copyright (C) 2014 Typesafe Inc. */ package org.ekrich.config.impl @@ -24,8 +24,8 @@ trait Container extends ConfigValue { ): AbstractConfigValue /** - * Super-expensive full traversal to see if descendant is anywhere - * underneath this container. + * Super-expensive full traversal to see if descendant is anywhere underneath + * this container. */ def hasDescendant(descendant: AbstractConfigValue): Boolean } diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/DefaultTransformer.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/DefaultTransformer.scala index a441ca4f..9e8c0a04 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/DefaultTransformer.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/DefaultTransformer.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl @@ -59,7 +59,7 @@ object DefaultTransformer { // get a missing-value error if you tried to get a null value // as a string. value.valueType match { - //case NUMBER => // FALL THROUGH + // case NUMBER => // FALL THROUGH case NUMBER | BOOLEAN => retVal = new ConfigString.Quoted(value.origin, value.transformToString) @@ -76,7 +76,7 @@ object DefaultTransformer { // as lists in most cases, we'll refuse to convert if the object // does not contain any numeric keys. This means we don't allow // empty objects here though :-/ - val o = value.asInstanceOf[AbstractConfigObject] + val o = value.asInstanceOf[AbstractConfigObject] val values = new ju.HashMap[Integer, AbstractConfigValue] for (key <- o.keySet.asScala) { breakable { diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/FullIncluder.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/FullIncluder.scala index 7425ad40..723bef63 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/FullIncluder.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/FullIncluder.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/MemoKey.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/MemoKey.scala index 0db8ee6f..9ebf8e59 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/MemoKey.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/MemoKey.scala @@ -1,6 +1,8 @@ package org.ekrich.config.impl -/** The key used to memoize already-traversed nodes when resolving substitutions */ +/** + * The key used to memoize already-traversed nodes when resolving substitutions + */ final class MemoKey private[impl] ( val value: AbstractConfigValue, val restrictToChildOrNull: Path @@ -23,5 +25,6 @@ final class MemoKey private[impl] ( } else false override final def toString: String = - "MemoKey(" + value + "@" + System.identityHashCode(value) + "," + restrictToChildOrNull + ")" + "MemoKey(" + value + "@" + System.identityHashCode(value) + "," + + restrictToChildOrNull + ")" } 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 68b2c3f5..d70ee25c 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 @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl @@ -23,13 +23,12 @@ import org.ekrich.config._ import org.ekrich.config.parser._ /** - * Internal implementation detail, not ABI stable, do not touch. - * For use only by the {@link org.ekrich.config} package. - * The point of this class is to avoid "propagating" each - * overload on "thing which can be parsed" through multiple - * interfaces. Most interfaces can have just one overload that - * takes a Parseable. Also it's used as an abstract "resource - * handle" in the ConfigIncluder interface. + * Internal implementation detail, not ABI stable, do not touch. For use only by + * the {@link org.ekrich.config} package. The point of this class is to avoid + * "propagating" each overload on "thing which can be parsed" through multiple + * interfaces. Most interfaces can have just one overload that takes a + * Parseable. Also it's used as an abstract "resource handle" in the + * ConfigIncluder interface. */ object Parseable { @@ -83,7 +82,7 @@ object Parseable { if (new File(filename).isAbsolute()) return null try { val siblingURI = url.toURI() - val relative = new URI(filename) + val relative = new URI(filename) // this seems wrong, but it's documented that the last // element of the path in siblingURI gets stripped out, // so to get something in the same directory as @@ -160,16 +159,16 @@ object Parseable { } def newString(input: String, options: ConfigParseOptions) = new ParseableString(input, options) - private val jsonContentType = "application/json" + private val jsonContentType = "application/json" private val propertiesContentType = "text/x-java-properties" - private val hoconContentType = "application/hocon" + private val hoconContentType = "application/hocon" private object ParseableURL { private def acceptContentType(options: ConfigParseOptions): String = { if (options.getSyntax == null) null else options.getSyntax match { - case ConfigSyntax.JSON => jsonContentType - case ConfigSyntax.CONF => hoconContentType + case ConfigSyntax.JSON => jsonContentType + case ConfigSyntax.CONF => hoconContentType case ConfigSyntax.PROPERTIES => propertiesContentType } } @@ -424,7 +423,7 @@ object Parseable { resource.substring(1) } else { val className = klass.getName() - val i = className.lastIndexOf('.') + val i = className.lastIndexOf('.') if (i < 0) { // no package resource } else { // need to be relative to the package @@ -472,7 +471,7 @@ abstract class Parseable protected ( private var initialOptions: ConfigParseOptions ) extends ConfigParseable { private var includeContext: ConfigIncludeContext = null - private var initialOrigin: ConfigOrigin = null + private var initialOrigin: ConfigOrigin = null def this() = this(null) private def fixupOptions(baseOptions: ConfigParseOptions) = { var syntax = baseOptions.getSyntax @@ -505,8 +504,8 @@ abstract class Parseable protected ( protected def reader(): Reader @throws[IOException] protected def reader(options: ConfigParseOptions): Reader = reader() - private[impl] def guessSyntax: ConfigSyntax = null - private[impl] def contentType: ConfigSyntax = null + private[impl] def guessSyntax: ConfigSyntax = null + private[impl] def contentType: ConfigSyntax = null private[impl] def relativeTo(filename: String): ConfigParseable = { // fall back to classpath; we treat the "filename" as absolute // (don't add a package name in front), @@ -649,7 +648,7 @@ abstract class Parseable protected ( origin: ConfigOrigin, finalOptions: ConfigParseOptions ): ConfigDocument = { - val readerVal: Reader = reader(finalOptions) + val readerVal: Reader = reader(finalOptions) val contentTypeVal: ConfigSyntax = contentType val optionsWithContentType = if (contentType != null) { @@ -678,10 +677,10 @@ abstract class Parseable protected ( def parse(): ConfigObject = Parseable.forceParsedToObject(parseValue(options())) - def parseConfigDocument(): ConfigDocument = parseDocument(options()) + def parseConfigDocument(): ConfigDocument = parseDocument(options()) private[impl] def parseValue(): AbstractConfigValue = parseValue(options()) - override final def origin(): ConfigOrigin = initialOrigin + override final def origin(): ConfigOrigin = initialOrigin protected def createOrigin(): ConfigOrigin override def options(): ConfigParseOptions = initialOptions - override def toString(): String = getClass.getSimpleName + override def toString(): String = getClass.getSimpleName } diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/Path.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/Path.scala index 6ac98abf..e9438f2d 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/Path.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/Path.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl @@ -22,14 +22,14 @@ object Path { } /** - * - * @return path minus the first element or null if no more elements + * @return + * path minus the first element or null if no more elements */ private def create(elements: String*): (String, Path) = { val first = if (elements.length > 0) elements(0) else null val remainder = if (elements.length > 1) { val pb = new PathBuilder - var i = 1 + var i = 1 while (i < elements.length) { pb.appendKey(elements(i)) i += 1 @@ -42,7 +42,7 @@ object Path { private def create(i: ju.Iterator[Path]): (String, Path) = if (i.hasNext) { val firstPath = i.next - val pb = new PathBuilder + val pb = new PathBuilder if (firstPath.remainder != null) pb.appendPath(firstPath.remainder) while (i.hasNext) pb.appendPath(i.next) @@ -53,8 +53,10 @@ object Path { } } -final class Path @throws(classOf[ConfigException]) (val first: String, - val remainder: Path) { +final class Path @throws(classOf[ConfigException]) ( + val first: String, + val remainder: Path +) { if (first == null) throw new ConfigException.BugOrBroken("empty path") @@ -70,13 +72,13 @@ final class Path @throws(classOf[ConfigException]) (val first: String, def this(pathsToConcat: ju.List[Path]) = this(pathsToConcat.iterator) /** - * - * @return path minus the last element or null if we have just one element + * @return + * path minus the last element or null if we have just one element */ private[impl] def parent: Path = { if (remainder == null) return null val pb = new PathBuilder - var p = this + var p = this while (p.remainder != null) { pb.appendKey(p.first) p = p.remainder @@ -85,8 +87,8 @@ final class Path @throws(classOf[ConfigException]) (val first: String, } /** - * - * @return last element in the path + * @return + * last element in the path */ private[impl] def last: String = { var p = this @@ -103,7 +105,7 @@ final class Path @throws(classOf[ConfigException]) (val first: String, private[impl] def length = { var count = 1 - var p = remainder + var p = remainder while (p != null) { count += 1 p = p.remainder @@ -113,7 +115,7 @@ final class Path @throws(classOf[ConfigException]) (val first: String, private[impl] def subPath(removeFromFront: Int): Path = { var count = removeFromFront - var p = this + var p = this while (p != null && count > 0) { count -= 1 p = p.remainder @@ -124,8 +126,8 @@ final class Path @throws(classOf[ConfigException]) (val first: String, private[impl] def subPath(firstIndex: Int, lastIndex: Int): Path = { if (lastIndex < firstIndex) throw new ConfigException.BugOrBroken("bad call to subPath") - var from = subPath(firstIndex) - val pb = new PathBuilder + var from = subPath(firstIndex) + val pb = new PathBuilder var count = lastIndex - firstIndex while (count > 0) { count -= 1 @@ -140,7 +142,7 @@ final class Path @throws(classOf[ConfigException]) (val first: String, } private[impl] def startsWith(other: Path): Boolean = { - var myRemainder = this + var myRemainder = this var otherRemainder = other if (otherRemainder.length <= myRemainder.length) { while (otherRemainder != null) { diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/PathBuilder.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/PathBuilder.scala index bbb793ef..6a7442bd 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/PathBuilder.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/PathBuilder.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl @@ -27,7 +27,7 @@ final class PathBuilder private[impl] () { private[impl] def appendPath(path: Path): Unit = { checkCanAppend() - var first = path.first + var first = path.first var remainder = path.remainder breakable { while (true) { diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/PathParser.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/PathParser.scala index 6a8dd8ca..930c1add 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/PathParser.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/PathParser.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2015 Typesafe Inc. + * Copyright (C) 2015 Typesafe Inc. */ package org.ekrich.config.impl @@ -178,7 +178,7 @@ object PathParser { ): ju.List[Token] = { val tokenText: String = t.tokenText if (tokenText == ".") return ju.Collections.singletonList(t) - val splitToken = tokenText.split("\\.") + val splitToken = tokenText.split("\\.") val splitTokens = new ju.ArrayList[Token] for (s <- splitToken) { if (flavor eq ConfigSyntax.CONF) @@ -197,7 +197,7 @@ object PathParser { wasQuoted: Boolean, newText: String ): Unit = { - val i = if (wasQuoted) -1 else newText.indexOf('.') + val i = if (wasQuoted) -1 else newText.indexOf('.') val current = buf.get(buf.size - 1) if (i < 0) { // add to current path element @@ -223,7 +223,7 @@ object PathParser { if (s.charAt(0) == '.') return true if (s.charAt(len - 1) == '.') return true - var i = 0 + var i = 0 var returnNow = false while (i < len) { diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/PropertiesParser.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/PropertiesParser.scala index 1cfc77b8..60beca8a 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/PropertiesParser.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/PropertiesParser.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl @@ -29,9 +29,9 @@ object PropertiesParser { if (i < 0) null else path.substring(0, i) } private[impl] def pathFromPropertyKey(key: String) = { - var last = lastElement(key) + var last = lastElement(key) var exceptLast = exceptLastElement(key) - var path = new Path(last, null: Path) + var path = new Path(last, null: Path) while ({ exceptLast != null }) { last = lastElement(exceptLast) exceptLast = exceptLastElement(exceptLast) @@ -133,7 +133,7 @@ object PropertiesParser { /* * Create maps for the object-valued values. */ - val root = new ju.HashMap[String, AbstractConfigValue] + val root = new ju.HashMap[String, AbstractConfigValue] val scopes = new ju.HashMap[Path, ju.Map[String, AbstractConfigValue]] for (path <- scopePaths.asScala) { val scope = new ju.HashMap[String, AbstractConfigValue] @@ -144,8 +144,8 @@ object PropertiesParser { val parentPath = path.parent val parent = if (parentPath != null) scopes.get(parentPath) else root - val last = path.last - val rawValue = pathMap.get(path) + val last = path.last + val rawValue = pathMap.get(path) var value: AbstractConfigValue = null if (convertedFromProperties) { if (rawValue.isInstanceOf[String]) { @@ -189,7 +189,7 @@ object PropertiesParser { * where we need the sorted list. */ for (scopePath <- sortedScopePaths.asScala) { - val scope = scopes.get(scopePath) + val scope = scopes.get(scopePath) val parentPath = scopePath.parent val parent = if (parentPath != null) scopes.get(parentPath) else root diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ResolveContext.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ResolveContext.scala index bbba4bc5..3a5332c0 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ResolveContext.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ResolveContext.scala @@ -112,7 +112,7 @@ private[impl] final class ResolveContext( private[impl] def unrestricted: ResolveContext = restrict(null) private[impl] def traceString: String = { val separator = ", " - val sb = new StringBuilder + val sb = new StringBuilder import scala.jdk.CollectionConverters._ for (value <- resolveStack.asScala) { if (value.isInstanceOf[ConfigReference]) { @@ -163,9 +163,9 @@ private[impl] final class ResolveContext( ): ResolveResult[_ <: AbstractConfigValue] = { // a fully-resolved (no restrictToChild) object can satisfy a // request for a restricted object, so always check that first. - val fullKey = new MemoKey(original, null) + val fullKey = new MemoKey(original, null) var restrictedKey: MemoKey = null - var cached = memos.get(fullKey) + var cached = memos.get(fullKey) // but if there was no fully-resolved object cached, we'll only // compute the restrictToChild object so use a more limited // memo key diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ResolveMemos.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ResolveMemos.scala index 1e2c4cf4..6ed3bdce 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ResolveMemos.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ResolveMemos.scala @@ -7,7 +7,8 @@ package org.ekrich.config.impl */ final class ResolveMemos private ( // note that we can resolve things to undefined (represented as Java null, // rather than ConfigNull) so this map can have null values. - val memos: BadMap[MemoKey, AbstractConfigValue]) { + val memos: BadMap[MemoKey, AbstractConfigValue] +) { def this() = this(new BadMap[MemoKey, AbstractConfigValue]) private[impl] def get(key: MemoKey): AbstractConfigValue = memos.get(key) diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ResolveSource.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ResolveSource.scala index c36ebb99..e269bba6 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/ResolveSource.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/ResolveSource.scala @@ -44,8 +44,8 @@ object ResolveSource { path: Path ): ValueWithPath = try // we'll fail if anything along the path can't - // be looked at without resolving. - findInObject(obj, path, null) + // be looked at without resolving. + findInObject(obj, path, null) catch { case e: ConfigException.NotResolved => throw ConfigImpl.improveNotResolved(path, e) @@ -55,7 +55,7 @@ object ResolveSource { path: Path, parents: Node[Container] ): ValueWithPath = { - val key = path.first + val key = path.first val next = path.remainder if (ConfigImpl.traceSubstitutionsEnabled) ConfigImpl.trace("*** looking up '" + key + "' in " + obj) @@ -118,7 +118,7 @@ object ResolveSource { def this(value: T) = this(value, null) private[impl] def prepend(value: T) = new ResolveSource.Node[T](value, this) - private[impl] def head: T = value + private[impl] def head: T = value private[impl] def tail: Node[T] = next private[impl] def last = { var i = this @@ -129,7 +129,7 @@ object ResolveSource { if (next == null) this else { var reversed = new ResolveSource.Node[T](value) - var i = next + var i = next while ({ i != null }) { reversed = reversed.prepend(i.value) i = i.next 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 1ae6f980..9b805f86 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 @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl @@ -42,7 +42,7 @@ import org.ekrich.config.ConfigValueType object SerializedConfigValue { private[impl] class FieldOut private[impl] (val code: SerializedField) { final private[impl] var bytes = new ByteArrayOutputStream - final private[impl] var data = new DataOutputStream(bytes) + final private[impl] var data = new DataOutputStream(bytes) } // this is a separate function to prevent bugs writing to the @@ -90,7 +90,7 @@ object SerializedConfigValue { m = ju.Collections.emptyMap[SerializedField, AnyRef] for (e <- m.entrySet.asScala) { val field = new FieldOut(e.getKey) - val v = e.getValue + val v = e.getValue writeOriginField(field.data, field.code, v) writeField(out, field) } @@ -133,7 +133,7 @@ object SerializedConfigValue { in.readInt val size = in.readInt val list = new ju.ArrayList[String](size) - var i = 0 + var i = 0 while (i < size) { list.add(in.readUTF) i += 1 @@ -204,7 +204,7 @@ object SerializedConfigValue { ): AbstractConfigValue = { import SerializedValueType._ val stb = in.readUnsignedByte - val st = SerializedValueType.forInt(stb) + val st = SerializedValueType.forInt(stb) st match { case BOOLEAN => @@ -227,8 +227,8 @@ object SerializedConfigValue { new ConfigString.Quoted(origin, in.readUTF) case LIST => val listSize = in.readInt - val list = new ju.ArrayList[AbstractConfigValue](listSize) - var i = 0 + val list = new ju.ArrayList[AbstractConfigValue](listSize) + var i = 0 while (i < listSize) { val v = readValue(in, origin) list.add(v) @@ -237,11 +237,11 @@ object SerializedConfigValue { new SimpleConfigList(origin, list) case OBJECT => val mapSize = in.readInt - val map = new ju.HashMap[String, AbstractConfigValue](mapSize) - var i = 0 + val map = new ju.HashMap[String, AbstractConfigValue](mapSize) + var i = 0 while (i < mapSize) { val key = in.readUTF - val v = readValue(in, origin) + val v = readValue(in, origin) map.put(key, v) i += 1 } diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleConfig.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleConfig.scala index f4d64047..a8315eb9 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleConfig.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleConfig.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl @@ -44,7 +44,7 @@ object SimpleConfig { ): Unit = { for (entry <- obj.entrySet.asScala) { val elem = entry.getKey - val v = entry.getValue + val v = entry.getValue var path = Path.newKey(elem) if (parent != null) path = path.prepend(parent) if (v.isInstanceOf[AbstractConfigObject]) @@ -111,7 +111,7 @@ object SimpleConfig { originalPath: Path ): AbstractConfigValue = try { - val key = path.first + val key = path.first val next = path.remainder if (next == null) findKeyOrNull(self, key, expected, originalPath) else { @@ -142,28 +142,29 @@ object SimpleConfig { /** * Parses a period string. If no units are specified in the string, it is - * assumed to be in days. The returned period is in days. - * The purpose of this function is to implement the period-related methods - * in the ConfigObject interface. + * assumed to be in days. The returned period is in days. The purpose of this + * function is to implement the period-related methods in the ConfigObject + * interface. * * @param input - * the string to parse + * the string to parse * @param originForException - * origin of the value being parsed + * origin of the value being parsed * @param pathForException - * path to include in exceptions - * @return duration in days + * path to include in exceptions + * @return + * duration in days * @throws ConfigException - * if string is invalid + * if string is invalid */ def parsePeriod( input: String, originForException: ConfigOrigin, pathForException: String ) = { - val s = ConfigImplUtil.unicodeTrim(input) + val s = ConfigImplUtil.unicodeTrim(input) val originalUnitString = getUnits(s) - var unitString = originalUnitString + var unitString = originalUnitString val numberString = ConfigImplUtil.unicodeTrim(s.substring(0, s.length - unitString.length)) var units: ChronoUnit = null @@ -225,28 +226,29 @@ object SimpleConfig { /** * Parses a duration string. If no units are specified in the string, it is - * assumed to be in milliseconds. The returned duration is in nanoseconds. - * The purpose of this function is to implement the duration-related methods - * in the ConfigObject interface. + * assumed to be in milliseconds. The returned duration is in nanoseconds. The + * purpose of this function is to implement the duration-related methods in + * the ConfigObject interface. * * @param input - * the string to parse + * the string to parse * @param originForException - * origin of the value being parsed + * origin of the value being parsed * @param pathForException - * path to include in exceptions - * @return duration in nanoseconds + * path to include in exceptions + * @return + * duration in nanoseconds * @throws ConfigException - * if string is invalid + * if string is invalid */ def parseDuration( input: String, originForException: ConfigOrigin, pathForException: String ): Long = { - val s = ConfigImplUtil.unicodeTrim(input) + val s = ConfigImplUtil.unicodeTrim(input) val originalUnitString = getUnits(s) - var unitString = originalUnitString + var unitString = originalUnitString val numberString = ConfigImplUtil.unicodeTrim(s.substring(0, s.length - unitString.length)) var units: TimeUnit = null @@ -303,27 +305,28 @@ object SimpleConfig { } /** - * Parses a size-in-bytes string. If no units are specified in the string, - * it is assumed to be in bytes. The returned value is in bytes. The purpose - * of this function is to implement the size-in-bytes-related methods in the + * Parses a size-in-bytes string. If no units are specified in the string, it + * is assumed to be in bytes. The returned value is in bytes. The purpose of + * this function is to implement the size-in-bytes-related methods in the * Config interface. * * @param input - * the string to parse + * the string to parse * @param originForException - * origin of the value being parsed + * origin of the value being parsed * @param pathForException - * path to include in exceptions - * @return size in bytes + * path to include in exceptions + * @return + * size in bytes * @throws ConfigException - * if string is invalid + * if string is invalid */ def parseBytes( input: String, originForException: ConfigOrigin, pathForException: String ): Long = { - val s = ConfigImplUtil.unicodeTrim(input) + val s = ConfigImplUtil.unicodeTrim(input) val unitString = getUnits(s) val numberString = ConfigImplUtil.unicodeTrim(s.substring(0, s.length - unitString.length)) @@ -570,13 +573,13 @@ object SimpleConfig { value.asInstanceOf[AbstractConfigObject], accumulator ) - } else if (reference.isInstanceOf[SimpleConfigList] && value - .isInstanceOf[SimpleConfigList]) { - val listRef = reference.asInstanceOf[SimpleConfigList] + } else if (reference.isInstanceOf[SimpleConfigList] && + value.isInstanceOf[SimpleConfigList]) { + val listRef = reference.asInstanceOf[SimpleConfigList] val listValue = value.asInstanceOf[SimpleConfigList] checkListCompatibility(path, listRef, listValue, accumulator) - } else if (reference.isInstanceOf[SimpleConfigList] && value - .isInstanceOf[SimpleConfigObject]) { + } else if (reference.isInstanceOf[SimpleConfigList] && + value.isInstanceOf[SimpleConfigObject]) { val listRef = reference.asInstanceOf[SimpleConfigList] val listValue = DefaultTransformer.transform(value, ConfigValueType.LIST) @@ -602,8 +605,8 @@ final class SimpleConfig private[impl] (val confObj: AbstractConfigObject) with MergeableValue with Serializable { override def root: AbstractConfigObject = confObj - override def origin: ConfigOrigin = confObj.origin - override def resolve(): SimpleConfig = resolve(ConfigResolveOptions.defaults) + override def origin: ConfigOrigin = confObj.origin + override def resolve(): SimpleConfig = resolve(ConfigResolveOptions.defaults) override def resolve(options: ConfigResolveOptions): SimpleConfig = resolveWith(this, options) override def resolveWith(source: Config): SimpleConfig = @@ -621,7 +624,7 @@ final class SimpleConfig private[impl] (val confObj: AbstractConfigObject) else new SimpleConfig(resolved.asInstanceOf[AbstractConfigObject]) } private def hasPathPeek(pathExpression: String) = { - val path = Path.newPath(pathExpression) + val path = Path.newPath(pathExpression) var peeked: AbstractConfigValue = null try peeked = confObj.peekPath(path) catch { @@ -693,7 +696,7 @@ final class SimpleConfig private[impl] (val confObj: AbstractConfigObject) val n = getConfigNumber(path) n.intValueRangeChecked(path) } - override def getLong(path: String): Long = getNumber(path).longValue + override def getLong(path: String): Long = getNumber(path).longValue override def getDouble(path: String): Double = getNumber(path).doubleValue override def getString(path: String): String = { val v = find(path, ConfigValueType.STRING) @@ -766,7 +769,7 @@ final class SimpleConfig private[impl] (val confObj: AbstractConfigObject) path: String, expected: ConfigValueType ): ju.List[T] = { - val l = new ju.ArrayList[T] + val l = new ju.ArrayList[T] val list = getList(path) for (cv <- list.asScala) { // variance would be nice, but stupid cast will do @@ -798,7 +801,7 @@ final class SimpleConfig private[impl] (val confObj: AbstractConfigObject) l } override def getLongList(path: String): ju.List[jl.Long] = { - val l = new ju.ArrayList[jl.Long] + val l = new ju.ArrayList[jl.Long] val numbers = getNumberList(path) for (n <- numbers.asScala) { l.add(n.longValue) @@ -806,7 +809,7 @@ final class SimpleConfig private[impl] (val confObj: AbstractConfigObject) l } override def getDoubleList(path: String): ju.List[jl.Double] = { - val l = new ju.ArrayList[jl.Double] + val l = new ju.ArrayList[jl.Double] val numbers = getNumberList(path) for (n <- numbers.asScala) { l.add(n.doubleValue) @@ -840,7 +843,7 @@ final class SimpleConfig private[impl] (val confObj: AbstractConfigObject) jl.Enum.valueOf(enumClass, enumName) } catch { case e: IllegalArgumentException => - val enumNames = new ju.ArrayList[String] + val enumNames = new ju.ArrayList[String] val enumConstants = enumClass.getEnumConstants if (enumConstants != null) for (enumConstant <- enumConstants) { enumNames.add(enumConstant.name) @@ -862,7 +865,7 @@ final class SimpleConfig private[impl] (val confObj: AbstractConfigObject) path: String, expected: ConfigValueType ): ju.List[T] = { - val l = new ju.ArrayList[T] + val l = new ju.ArrayList[T] val list = getList(path) for (cv <- list.asScala) { var v = cv.asInstanceOf[AbstractConfigValue] @@ -882,14 +885,14 @@ final class SimpleConfig private[impl] (val confObj: AbstractConfigObject) getHomogeneousWrappedList(path, ConfigValueType.OBJECT) override def getConfigList(path: String): ju.List[_ <: Config] = { val objects = getObjectList(path) - val l = new ju.ArrayList[Config] + val l = new ju.ArrayList[Config] for (o <- objects.asScala) { l.add(o.toConfig) } l } override def getAnyRefList(path: String): ju.List[_ <: AnyRef] = { - val l = new ju.ArrayList[AnyRef] + val l = new ju.ArrayList[AnyRef] val list = getList(path) for (v <- list.asScala) { l.add(v.unwrapped) @@ -897,7 +900,7 @@ final class SimpleConfig private[impl] (val confObj: AbstractConfigObject) l } override def getBytesList(path: String): ju.List[jl.Long] = { - val l = new ju.ArrayList[jl.Long] + val l = new ju.ArrayList[jl.Long] val list = getList(path) for (v <- list.asScala) { if (v.valueType eq ConfigValueType.NUMBER) { @@ -918,7 +921,7 @@ final class SimpleConfig private[impl] (val confObj: AbstractConfigObject) l } override def getMemorySizeList(path: String): ju.List[ConfigMemorySize] = { - val list = getBytesList(path) + val list = getBytesList(path) val builder = new ju.ArrayList[ConfigMemorySize] for (v <- list.asScala) { builder.add(ConfigMemorySize.ofBytes(v)) @@ -929,7 +932,7 @@ final class SimpleConfig private[impl] (val confObj: AbstractConfigObject) path: String, unit: TimeUnit ): ju.List[jl.Long] = { - val l = new ju.ArrayList[jl.Long] + val l = new ju.ArrayList[jl.Long] val list = getList(path) for (v <- list.asScala) { if (v.valueType eq ConfigValueType.NUMBER) { @@ -957,7 +960,7 @@ final class SimpleConfig private[impl] (val confObj: AbstractConfigObject) l } override def getDurationList(path: String): ju.List[Duration] = { - val l = getDurationList(path, TimeUnit.NANOSECONDS) + val l = getDurationList(path, TimeUnit.NANOSECONDS) val builder = new ju.ArrayList[Duration](l.size) for (value <- l.asScala) { builder.add(Duration.ofNanos(value)) @@ -980,7 +983,7 @@ final class SimpleConfig private[impl] (val confObj: AbstractConfigObject) // making it not match might catch some kinds of bug. 41 * confObj.hashCode } - override def toString: String = "Config(" + confObj.toString + ")" + override def toString: String = "Config(" + confObj.toString + ")" private def peekPath(path: Path): AbstractConfigValue = root.peekPath(path) override def isResolved: Boolean = root.resolveStatus eq ResolveStatus.RESOLVED @@ -1004,7 +1007,7 @@ final class SimpleConfig private[impl] (val confObj: AbstractConfigObject) SimpleConfig.checkValidObject(null, ref.root, root, problems) else for (p <- restrictToPaths) { - val path = Path.newPath(p) + val path = Path.newPath(p) val refValue = ref.peekPath(path) if (refValue != null) { val child = peekPath(path) @@ -1033,7 +1036,7 @@ final class SimpleConfig private[impl] (val confObj: AbstractConfigObject) private[impl] def atKey(origin: ConfigOrigin, key: String) = root.atKey(origin, key) override def atKey(key: String): SimpleConfig = root.atKey(key) - override def atPath(path: String): Config = root.atPath(path) + override def atPath(path: String): Config = root.atPath(path) // serialization all goes through SerializedConfigValue @throws[ObjectStreamException] private def writeReplace(): AnyRef = new SerializedConfigValue(this) 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 167676da..4a6577aa 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 @@ -44,10 +44,9 @@ final class SimpleConfigDocument private[impl] ( parseOptions ) override def hasPath(path: String): Boolean = configNodeTree.hasValue(path) - override def render: String = configNodeTree.render + override def render: String = configNodeTree.render override def equals(other: Any): Boolean = - other.isInstanceOf[ConfigDocument] && render == other - .asInstanceOf[ConfigDocument] - .render + other.isInstanceOf[ConfigDocument] && + render == other.asInstanceOf[ConfigDocument].render override def hashCode: Int = render.hashCode } 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 ef756a9e..2dd00036 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 @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl @@ -32,16 +32,16 @@ object SimpleConfigList { i: ju.ListIterator[AbstractConfigValue] ): ju.ListIterator[ConfigValue] = new ju.ListIterator[ConfigValue]() { - override def hasNext: Boolean = i.hasNext + override def hasNext: Boolean = i.hasNext override def next: ConfigValue = i.next override def remove(): Unit = throw weAreImmutable("listIterator().remove") override def add(arg0: ConfigValue): Unit = throw weAreImmutable("listIterator().add") - override def hasPrevious: Boolean = i.hasPrevious - override def nextIndex: Int = i.nextIndex + override def hasPrevious: Boolean = i.hasPrevious + override def nextIndex: Int = i.nextIndex override def previous: ConfigValue = i.previous - override def previousIndex: Int = i.previousIndex + override def previousIndex: Int = i.previousIndex override def set(arg0: ConfigValue): Unit = { throw weAreImmutable("listIterator().set") } @@ -114,7 +114,7 @@ final class SimpleConfigList( ): SimpleConfigList = { // lazy-create for optimization var changed: ju.List[AbstractConfigValue] = null - var i = 0 + var i = 0 for (v <- value.asScala) { val modified = modifier.modifyChildMayThrow(null /* key */, v) // lazy-create the new list if required @@ -170,23 +170,25 @@ final class SimpleConfigList( } } override def relativized(prefix: Path): SimpleConfigList = - modify(new NoExceptionsModifier() { - override def modifyChild( - key: String, - v: AbstractConfigValue - ): AbstractConfigValue = - v.relativized(prefix) - }, resolveStatus) + modify( + new NoExceptionsModifier() { + override def modifyChild( + key: String, + v: AbstractConfigValue + ): AbstractConfigValue = + v.relativized(prefix) + }, + resolveStatus + ) override def canEqual(other: Any): Boolean = other.isInstanceOf[SimpleConfigList] override def equals(other: Any): Boolean = { // note that "origin" is deliberately NOT part of equality if (other.isInstanceOf[SimpleConfigList]) { // optimization to avoid unwrapped() for two ConfigList - canEqual(other) && ((value eq other - .asInstanceOf[SimpleConfigList] - .value) || - value == other.asInstanceOf[SimpleConfigList].value) + canEqual(other) && + ((value eq other.asInstanceOf[SimpleConfigList].value) || + value == other.asInstanceOf[SimpleConfigList].value) } else false } override def hashCode: Int = value.hashCode @@ -235,15 +237,15 @@ final class SimpleConfigList( sb.append("]") } } - override def contains(o: Any): Boolean = value.contains(o) + override def contains(o: Any): Boolean = value.contains(o) override def containsAll(c: ju.Collection[_]): Boolean = value.containsAll(c) - override def get(index: Int): AbstractConfigValue = value.get(index) - override def indexOf(o: Any): Int = value.indexOf(o) - override def isEmpty: Boolean = value.isEmpty + override def get(index: Int): AbstractConfigValue = value.get(index) + override def indexOf(o: Any): Int = value.indexOf(o) + override def isEmpty: Boolean = value.isEmpty override def iterator: ju.Iterator[ConfigValue] = { val i = value.iterator new ju.Iterator[ConfigValue]() { - override def hasNext: Boolean = return i.hasNext + override def hasNext: Boolean = return i.hasNext override def next: ConfigValue = return i.next override def remove(): Unit = throw SimpleConfigList.weAreImmutable("iterator().remove") 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 630f830a..18c0750f 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 @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl @@ -59,7 +59,7 @@ object SimpleConfigObject { val length = s.length // empty string doesn't count as a number if (length == 0) return false - var i = 0 + var i = 0 var allDigits = true while (i < length) { breakable { @@ -176,8 +176,8 @@ final class SimpleConfigObject( // withOnlyPath("a.b.c") that we don't keep an empty // "a" object. override def withOnlyPathOrNull(path: Path): SimpleConfigObject = { - val key = path.first - val next = path.remainder + val key = path.first + val next = path.remainder var v: AbstractConfigValue = value.get(key) if (next != null) { if (v != null && v.isInstanceOf[AbstractConfigObject]) { @@ -211,9 +211,9 @@ final class SimpleConfigObject( } override def withoutPath(path: Path): SimpleConfigObject = { - val key = path.first + val key = path.first val next = path.remainder - var v = value.get(key) + var v = value.get(key) if (v != null && next != null && v.isInstanceOf[AbstractConfigObject]) { v = v.asInstanceOf[AbstractConfigObject].withoutPath(next) val updated = new ju.HashMap[String, AbstractConfigValue](value) @@ -262,7 +262,7 @@ final class SimpleConfigObject( } override def withValue(path: Path, v: ConfigValue): SimpleConfigObject = { - val key = path.first + val key = path.first val next = path.remainder if (next == null) withValue(key, v) else { @@ -358,17 +358,17 @@ final class SimpleConfigObject( throw new ConfigException.BugOrBroken( "should not be reached (merging non-SimpleConfigObject)" ) - val fallback = abstractFallback.asInstanceOf[SimpleConfigObject] - var changed = false + val fallback = abstractFallback.asInstanceOf[SimpleConfigObject] + var changed = false var allResolved = true - val merged = new ju.HashMap[String, AbstractConfigValue] - val allKeys = new ju.HashSet[String] + val merged = new ju.HashMap[String, AbstractConfigValue] + val allKeys = new ju.HashSet[String] allKeys.addAll(this.keySet) allKeys.addAll(fallback.keySet) for (key <- allKeys.asScala) { - val first = this.value.get(key) - val second = fallback.value.get(key) + val first = this.value.get(key) + val second = fallback.value.get(key) var kept: AbstractConfigValue = null if (first == null) kept = second else if (second == null) kept = first @@ -377,7 +377,7 @@ final class SimpleConfigObject( if (first ne kept) changed = true if (kept.resolveStatus eq ResolveStatus.UNRESOLVED) allResolved = false } - val newResolveStatus = ResolveStatus.fromBoolean(allResolved) + val newResolveStatus = ResolveStatus.fromBoolean(allResolved) val newIgnoresFallbacks = fallback.ignoresFallbacks if (changed) new SimpleConfigObject( @@ -416,7 +416,7 @@ final class SimpleConfigObject( } if (changes == null) this else { - val modified = new ju.HashMap[String, AbstractConfigValue] + val modified = new ju.HashMap[String, AbstractConfigValue] var sawUnresolved = false for (k <- keySet.asScala) { if (changes.containsKey(k)) { @@ -426,7 +426,7 @@ final class SimpleConfigObject( if (newValue.resolveStatus eq ResolveStatus.UNRESOLVED) sawUnresolved = true } else { - //remove this child; don't put it in the new map. + // remove this child; don't put it in the new map. } } else { val newValue = value.get(k) @@ -493,7 +493,7 @@ final class SimpleConfigObject( if (options.getFormatted) sb.append('\n') } else innerIndent = indentVal var separatorCount = 0 - val keys = new ju.ArrayList[String] + val keys = new ju.ArrayList[String] keys.addAll(keySet) ju.Collections.sort(keys, new SimpleConfigObject.RenderComparator) // val keys: Array[String] = keySet.toArray(new Array[String](size)) diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleConfigOrigin.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleConfigOrigin.scala index 5168343e..a16a1d70 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleConfigOrigin.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleConfigOrigin.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl @@ -65,9 +65,9 @@ object SimpleConfigOrigin { a: SimpleConfigOrigin, b: SimpleConfigOrigin ): SimpleConfigOrigin = { - var mergedDesc: String = null - var mergedStartLine = 0 - var mergedEndLine = 0 + var mergedDesc: String = null + var mergedStartLine = 0 + var mergedEndLine = 0 var mergedComments: ju.List[String] = null val mergedType = if (a.originType eq b.originType) a.originType else OriginType.GENERIC @@ -421,7 +421,8 @@ final class SimpleConfigOrigin protected ( private[impl] def prependComments( comments: ju.List[String] ): SimpleConfigOrigin = - if (ConfigImplUtil.equalsHandlingNull(comments, this.commentsOrNull) || comments == null) + if (ConfigImplUtil.equalsHandlingNull(comments, this.commentsOrNull) || + comments == null) this else if (this.commentsOrNull == null) withComments(comments) else { @@ -434,7 +435,8 @@ final class SimpleConfigOrigin protected ( private[impl] def appendComments( comments: ju.List[String] ): SimpleConfigOrigin = - if (ConfigImplUtil.equalsHandlingNull(comments, this.commentsOrNull) || comments == null) + if (ConfigImplUtil.equalsHandlingNull(comments, this.commentsOrNull) || + comments == null) this else if (this.commentsOrNull == null) withComments(comments) else { @@ -454,7 +456,10 @@ final class SimpleConfigOrigin protected ( val otherOrigin = other.asInstanceOf[SimpleConfigOrigin] this._description == otherOrigin._description && this.lineNumber == otherOrigin.lineNumber && this.endLineNumber == otherOrigin.endLineNumber && (this.originType eq otherOrigin.originType) && - ConfigImplUtil.equalsHandlingNull(this.urlOrNull, otherOrigin.urlOrNull) && + ConfigImplUtil.equalsHandlingNull( + this.urlOrNull, + otherOrigin.urlOrNull + ) && ConfigImplUtil.equalsHandlingNull( this.resourceOrNull, otherOrigin.resourceOrNull @@ -493,7 +498,7 @@ final class SimpleConfigOrigin protected ( null } override def resource: String = resourceOrNull - override def lineNumber: Int = _lineNumber + override def lineNumber: Int = _lineNumber override def comments: ju.List[String] = if (commentsOrNull != null) ju.Collections.unmodifiableList(commentsOrNull) else ju.Collections.emptyList[String] 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 a42b3549..12adbd66 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 @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleIncluder.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleIncluder.scala index 046469ff..9766a3c4 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleIncluder.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleIncluder.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl @@ -122,8 +122,8 @@ object SimpleIncluder { val propsHandle = source.nameToParseable(name + ".properties", options) var gotSomething = false - val fails = new ju.ArrayList[ConfigException.IO] - val syntax = options.getSyntax + val fails = new ju.ArrayList[ConfigException.IO] + val syntax = options.getSyntax obj = SimpleConfigObject.empty(SimpleConfigOrigin.newSimple(name)) if (syntax == null || (syntax eq ConfigSyntax.CONF)) try { obj = confHandle.parse( diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/Token.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/Token.scala index cb09998f..006ada8e 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/Token.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/Token.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/Tokenizer.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/Tokenizer.scala index 6d24f498..002c4fe6 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/Tokenizer.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/Tokenizer.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl @@ -153,11 +153,11 @@ object Tokenizer { val input: Reader, val allowComments: Boolean ) extends ju.Iterator[Token] { - val origin = _origin.asInstanceOf[SimpleConfigOrigin] - val buffer = new ju.LinkedList[Integer] + val origin = _origin.asInstanceOf[SimpleConfigOrigin] + val buffer = new ju.LinkedList[Integer] var lineNumber = 1 var lineOrigin = origin.withLineNumber(lineNumber) - val tokens = new ju.LinkedList[Token] + val tokens = new ju.LinkedList[Token] tokens.add(Tokens.START) val whitespaceSaver = new TokenIterator.WhitespaceSaver @@ -250,7 +250,7 @@ object Tokenizer { ) doubleSlash = true } - val sb = new jl.StringBuilder + val sb = new jl.StringBuilder var token: Token = null breakable { while (true) { @@ -275,10 +275,10 @@ object Tokenizer { // that parses as JSON is treated the JSON way and otherwise // we assume it's a string and let the parser sort it out. private def pullUnquotedText: Token = { - val origin = lineOrigin - val sb = new jl.StringBuilder + val origin = lineOrigin + val sb = new jl.StringBuilder var t: Token = null - var c = nextCharRaw + var c = nextCharRaw var retToken = false breakable { while (true) { @@ -286,7 +286,7 @@ object Tokenizer { else if (TokenIterator.notInUnquotedText.indexOf(c) >= 0) break() // break else if (TokenIterator.isWhitespace(c)) - break() // break + break() // break else if (startOfComment(c)) break() // break else sb.appendCodePoint(c) // we parse true/false/null tokens as such no matter @@ -327,7 +327,7 @@ object Tokenizer { val sb = new jl.StringBuilder sb.appendCodePoint(firstChar) var containedDecimalOrE = false - var c = nextCharRaw + var c = nextCharRaw while (c != -1 && TokenIterator.numberChars.indexOf(c) >= 0) { if (c == '.' || c == 'e' || c == 'E') containedDecimalOrE = true sb.appendCodePoint(c) @@ -336,12 +336,14 @@ object Tokenizer { // the last character we looked at wasn't part of the number, put it back putBack(c) val s = sb.toString - try if (containedDecimalOrE) { - // force floating point representation - Tokens.newDouble(lineOrigin, s.toDouble, s) - } else { // this should throw if the integer is too large for Long - Tokens.newLong(lineOrigin, s.toLong, s) - } catch { + try + if (containedDecimalOrE) { + // force floating point representation + Tokens.newDouble(lineOrigin, s.toDouble, s) + } else { // this should throw if the integer is too large for Long + Tokens.newLong(lineOrigin, s.toLong, s) + } + catch { case e: NumberFormatException => // not a number after all, see if it's an unquoted string. for (u <- s.toCharArray) { @@ -467,7 +469,8 @@ object Tokenizer { } else if (ConfigImplUtil.isC0Control(c)) throw problem( asString(c), - "JSON does not allow unescaped " + asString(c) + " in quoted strings, use a backslash escape" + "JSON does not allow unescaped " + + asString(c) + " in quoted strings, use a backslash escape" ) else { sb.appendCodePoint(c) @@ -502,7 +505,7 @@ object Tokenizer { private def pullSubstitution: Tokens.Substitution = { // the initial '$' has already been consumed val origin = lineOrigin - var c = nextCharRaw + var c = nextCharRaw if (c != '{') throw problem( asString(c), @@ -515,7 +518,7 @@ object Tokenizer { val saver = new TokenIterator.WhitespaceSaver val expression = new ju.ArrayList[Token] - var t: Token = null + var t: Token = null breakable { while ({ t = pullNextToken(saver) @@ -523,7 +526,7 @@ object Tokenizer { // the substitution here; we even allow nested substitutions // in the tokenizer. The parser sorts it out. if (t eq Tokens.CLOSE_CURLY) { // end the loop, done! - break() // break + break() // break } else if (t eq Tokens.END) { throw TokenIterator.problem( origin, @@ -571,7 +574,8 @@ object Tokenizer { else if (TokenIterator.notInUnquotedText.indexOf(c) >= 0) throw problem( asString(c), - "Reserved character '" + asString(c) + "' is not allowed outside quotes", + "Reserved character '" + asString(c) + + "' is not allowed outside quotes", true ) else { @@ -588,7 +592,7 @@ object Tokenizer { } @throws[ProblemException] private def queueNextToken(): Unit = { - val t = pullNextToken(whitespaceSaver) + val t = pullNextToken(whitespaceSaver) val whitespace = whitespaceSaver.check(t, origin, lineNumber) if (whitespace != null) tokens.add(whitespace) tokens.add(t) diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/Tokens.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/Tokens.scala index db21c63f..74d737b4 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/Tokens.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/Tokens.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl @@ -38,7 +38,7 @@ object Tokens { .asInstanceOf[Tokens.Line] .lineNumber == lineNumber override def hashCode: Int = 41 * (41 + super.hashCode) + lineNumber - override def tokenText = "\n" + override def tokenText = "\n" } // This is not a Value, because it requires special processing @@ -53,7 +53,7 @@ object Tokens { super.equals(other) && other .asInstanceOf[Tokens.UnquotedText] .value == value - override def hashCode(): Int = 41 * (41 + super.hashCode) + value.hashCode + override def hashCode(): Int = 41 * (41 + super.hashCode) + value.hashCode override def tokenText: String = value } @@ -68,7 +68,7 @@ object Tokens { super.equals(other) && other .asInstanceOf[Tokens.IgnoredWhitespace] .value == value - override def hashCode(): Int = 41 * (41 + super.hashCode) + value.hashCode + override def hashCode(): Int = 41 * (41 + super.hashCode) + value.hashCode override def tokenText: String = value } diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/impl/Unmergeable.scala b/sconfig/shared/src/main/scala/org/ekrich/config/impl/Unmergeable.scala index b045b966..30e56b02 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/impl/Unmergeable.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/impl/Unmergeable.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011-2012 Typesafe Inc. + * Copyright (C) 2011-2012 Typesafe Inc. */ package org.ekrich.config.impl @@ -8,8 +8,8 @@ import java.{util => ju} /** * Interface that tags a ConfigValue that is not mergeable until after * substitutions are resolved. Basically these are special ConfigValue that - * never appear in a resolved tree, like `ConfigSubstitution` and - * {@link ConfigDelayedMerge}. + * never appear in a resolved tree, like `ConfigSubstitution` and {@link + * ConfigDelayedMerge}. */ trait Unmergeable { def unmergedValues: ju.Collection[_ <: AbstractConfigValue] diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/parser/ConfigDocument.scala b/sconfig/shared/src/main/scala/org/ekrich/config/parser/ConfigDocument.scala index 03253e24..82e2da3a 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/parser/ConfigDocument.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/parser/ConfigDocument.scala @@ -3,19 +3,16 @@ package org.ekrich.config.parser import org.ekrich.config.ConfigValue /** - * Represents an individual HOCON or JSON file, preserving all - * formatting and syntax details. This can be used to replace - * individual values and exactly render the original text of the - * input. + * Represents an individual HOCON or JSON file, preserving all formatting and + * syntax details. This can be used to replace individual values and exactly + * render the original text of the input. * - *

- * Because this object is immutable, it is safe to use from multiple threads and - * there's no need for "defensive copies." + *

Because this object is immutable, it is safe to use from multiple threads + * and there's no need for "defensive copies." * - *

- * Do not implement interface {@code ConfigDocument}; it should only be - * implemented by the config library. Arbitrary implementations will not work - * because the library internals assume a specific concrete implementation. + *

Do not implement interface {@code ConfigDocument}; it should + * only be implemented by the config library. Arbitrary implementations will not + * work because the library internals assume a specific concrete implementation. * Also, this interface is likely to grow new methods over time, so third-party * implementations will break. */ @@ -23,63 +20,75 @@ trait ConfigDocument { /** * Returns a new ConfigDocument that is a copy of the current ConfigDocument, - * but with the desired value set at the desired path. If the path exists, it will - * remove all duplicates before the final occurrence of the path, and replace the value - * at the final occurrence of the path. If the path does not exist, it will be added. If - * the document has an array as the root value, an exception will be thrown. + * but with the desired value set at the desired path. If the path exists, it + * will remove all duplicates before the final occurrence of the path, and + * replace the value at the final occurrence of the path. If the path does not + * exist, it will be added. If the document has an array as the root value, an + * exception will be thrown. * - * @param path the path at which to set the desired value - * @param newValue the value to set at the desired path, represented as a string. This - * string will be parsed into a ConfigNode using the same options used to - * parse the entire document, and the text will be inserted - * as-is into the document. Leading and trailing comments, whitespace, or - * newlines are not allowed, and if present an exception will be thrown. - * If a concatenation is passed in for newValue but the document was parsed - * with JSON, the first value in the concatenation will be parsed and inserted - * into the ConfigDocument. - * @return a copy of the ConfigDocument with the desired value at the desired path + * @param path + * the path at which to set the desired value + * @param newValue + * the value to set at the desired path, represented as a string. This + * string will be parsed into a ConfigNode using the same options used to + * parse the entire document, and the text will be inserted as-is into the + * document. Leading and trailing comments, whitespace, or newlines are not + * allowed, and if present an exception will be thrown. If a concatenation + * is passed in for newValue but the document was parsed with JSON, the + * first value in the concatenation will be parsed and inserted into the + * ConfigDocument. + * @return + * a copy of the ConfigDocument with the desired value at the desired path */ def withValueText(path: String, newValue: String): ConfigDocument /** - * Returns a new ConfigDocument that is a copy of the current - * ConfigDocument, but with the desired value set at the - * desired path. Works like {@link #withValueText}, - * but takes a ConfigValue instead of a string. + * Returns a new ConfigDocument that is a copy of the current ConfigDocument, + * but with the desired value set at the desired path. Works like {@link + * #withValueText}, but takes a ConfigValue instead of a string. * - * @param path the path at which to set the desired value - * @param newValue the value to set at the desired path, represented as a ConfigValue. - * The rendered text of the ConfigValue will be inserted into the - * ConfigDocument. - * @return a copy of the ConfigDocument with the desired value at the desired path + * @param path + * the path at which to set the desired value + * @param newValue + * the value to set at the desired path, represented as a ConfigValue. The + * rendered text of the ConfigValue will be inserted into the + * ConfigDocument. + * @return + * a copy of the ConfigDocument with the desired value at the desired path */ def withValue(path: String, newValue: ConfigValue): ConfigDocument /** - * Returns a new ConfigDocument that is a copy of the current ConfigDocument, but with - * all values at the desired path removed. If the path does not exist in the document, - * a copy of the current document will be returned. If there is an array at the root, an exception - * will be thrown. + * Returns a new ConfigDocument that is a copy of the current ConfigDocument, + * but with all values at the desired path removed. If the path does not exist + * in the document, a copy of the current document will be returned. If there + * is an array at the root, an exception will be thrown. * - * @param path the path to remove from the document - * @return a copy of the ConfigDocument with the desired value removed from the document. + * @param path + * the path to remove from the document + * @return + * a copy of the ConfigDocument with the desired value removed from the + * document. */ def withoutPath(path: String): ConfigDocument /** - * Returns a boolean indicating whether or not a ConfigDocument has a value at the desired path. - * null counts as a value for purposes of this check. + * Returns a boolean indicating whether or not a ConfigDocument has a value at + * the desired path. null counts as a value for purposes of this check. * - * @param path the path to check - * @return true if the path exists in the document, otherwise false + * @param path + * the path to check + * @return + * true if the path exists in the document, otherwise false */ def hasPath(path: String): Boolean /** - * The original text of the input, modified if necessary with - * any replaced or added values. + * The original text of the input, modified if necessary with any replaced or + * added values. * - * @return the modified original text + * @return + * the modified original text */ def render: String } diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/parser/ConfigDocumentFactory.scala b/sconfig/shared/src/main/scala/org/ekrich/config/parser/ConfigDocumentFactory.scala index 271dff9a..ef3b4dda 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/parser/ConfigDocumentFactory.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/parser/ConfigDocumentFactory.scala @@ -6,8 +6,7 @@ import java.io.File import java.io.Reader /** - * Factory for creating - * [[org.ekrich.config.parser.ConfigDocument]] instances. + * Factory for creating [[org.ekrich.config.parser.ConfigDocument]] instances. */ object ConfigDocumentFactory { @@ -15,11 +14,13 @@ object ConfigDocumentFactory { * Parses a Reader into a ConfigDocument instance. * * @param reader - * the reader to parse + * the reader to parse * @param options - * parse options to control how the reader is interpreted - * @return the parsed configuration - * @throws ConfigException on IO or parse errors + * parse options to control how the reader is interpreted + * @return + * the parsed configuration + * @throws ConfigException + * on IO or parse errors */ def parseReader(reader: Reader, options: ConfigParseOptions): ConfigDocument = Parseable.newReader(reader, options).parseConfigDocument() @@ -30,9 +31,11 @@ object ConfigDocumentFactory { * but always uses the default parse options. * * @param reader - * the reader to parse - * @return the parsed configuration - * @throws org.ekrich.config.ConfigException on IO or parse errors + * the reader to parse + * @return + * the parsed configuration + * @throws org.ekrich.config.ConfigException + * on IO or parse errors */ def parseReader(reader: Reader): ConfigDocument = parseReader(reader, ConfigParseOptions.defaults) @@ -41,11 +44,13 @@ object ConfigDocumentFactory { * Parses a file into a ConfigDocument instance. * * @param file - * the file to parse + * the file to parse * @param options - * parse options to control how the file is interpreted - * @return the parsed configuration - * @throws org.ekrich.config.ConfigException on IO or parse errors + * parse options to control how the file is interpreted + * @return + * the parsed configuration + * @throws org.ekrich.config.ConfigException + * on IO or parse errors */ def parseFile(file: File, options: ConfigParseOptions): ConfigDocument = Parseable.newFile(file, options).parseConfigDocument() @@ -56,9 +61,11 @@ object ConfigDocumentFactory { * but always uses the default parse options. * * @param file - * the file to parse - * @return the parsed configuration - * @throws org.ekrich.config.ConfigException on IO or parse errors + * the file to parse + * @return + * the parsed configuration + * @throws org.ekrich.config.ConfigException + * on IO or parse errors */ def parseFile(file: File): ConfigDocument = parseFile(file, ConfigParseOptions.defaults) @@ -66,19 +73,24 @@ object ConfigDocumentFactory { /** * Parses a string which should be valid HOCON or JSON. * - * @param s string to parse - * @param options parse options - * @return the parsed configuration + * @param s + * string to parse + * @param options + * parse options + * @return + * the parsed configuration */ def parseString(s: String, options: ConfigParseOptions): ConfigDocument = Parseable.newString(s, options).parseConfigDocument() /** - * Parses a string (which should be valid HOCON or JSON). Uses the - * default parse options. + * Parses a string (which should be valid HOCON or JSON). Uses the default + * parse options. * - * @param s string to parse - * @return the parsed configuration + * @param s + * string to parse + * @return + * the parsed configuration */ def parseString(s: String): ConfigDocument = parseString(s, ConfigParseOptions.defaults) diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/parser/ConfigNode.scala b/sconfig/shared/src/main/scala/org/ekrich/config/parser/ConfigNode.scala index bfb3dbd0..0443e305 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/parser/ConfigNode.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/parser/ConfigNode.scala @@ -1,24 +1,21 @@ /** - * Copyright (C) 2015 Typesafe Inc. + * Copyright (C) 2015 Typesafe Inc. */ package org.ekrich.config.parser /** * A node in the syntax tree for a HOCON or JSON document. * - *

- * Note: at present there is no way to obtain an instance of this interface, so - * please ignore it. A future release will make syntax tree nodes available in - * the public API. If you are interested in working on it, please see: Note: at present there is no way to obtain an instance of this interface, + * so please ignore it. A future release will make syntax tree nodes available + * in the public API. If you are interested in working on it, please see: https://github.com/lightbend/config/issues/300 * - *

- * Because this object is immutable, it is safe to use from multiple threads and - * there's no need for "defensive copies." + *

Because this object is immutable, it is safe to use from multiple threads + * and there's no need for "defensive copies." * - *

- * Do not implement interface {@code ConfigNode}; it should only be + *

Do not implement interface {@code ConfigNode}; it should only be * implemented by the config library. Arbitrary implementations will not work * because the library internals assume a specific concrete implementation. * Also, this interface is likely to grow new methods over time, so third-party @@ -27,10 +24,10 @@ package org.ekrich.config.parser trait ConfigNode { /** - * The original text of the input which was used to form this particular - * node. + * The original text of the input which was used to form this particular node. * - * @return the original text used to form this node as a String + * @return + * the original text used to form this node as a String */ def render: String } diff --git a/sconfig/shared/src/test/scala/junit/Profiling.scala b/sconfig/shared/src/test/scala/junit/Profiling.scala index 25cb97f5..9d609478 100644 --- a/sconfig/shared/src/test/scala/junit/Profiling.scala +++ b/sconfig/shared/src/test/scala/junit/Profiling.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011 Typesafe Inc. + * Copyright (C) 2011 Typesafe Inc. */ import org.ekrich.config.Config import org.ekrich.config.ConfigFactory diff --git a/sconfig/shared/src/test/scala/junit/Rendering.scala b/sconfig/shared/src/test/scala/junit/Rendering.scala index f23b00c2..b1ca8755 100644 --- a/sconfig/shared/src/test/scala/junit/Rendering.scala +++ b/sconfig/shared/src/test/scala/junit/Rendering.scala @@ -2,10 +2,10 @@ import org.ekrich.config.ConfigFactory import org.ekrich.config.ConfigRenderOptions object RenderExample extends App { - val formatted = args.contains("--formatted") + val formatted = args.contains("--formatted") val originComments = args.contains("--origin-comments") - val comments = args.contains("--comments") - val hocon = args.contains("--hocon") + val comments = args.contains("--comments") + val hocon = args.contains("--hocon") val options = ConfigRenderOptions.defaults .setFormatted(formatted) .setOriginComments(originComments) @@ -65,10 +65,10 @@ object RenderOptions extends App { val rendered = allBooleanLists(4).foldLeft(0) { (count, values) => - val formatted = values(0) + val formatted = values(0) val originComments = values(1) - val comments = values(2) - val json = values(3) + val comments = values(2) + val json = values(3) val options = ConfigRenderOptions.defaults .setFormatted(formatted) diff --git a/sconfig/shared/src/test/scala/org/ekrich/config/impl/BadMapTest.scala b/sconfig/shared/src/test/scala/org/ekrich/config/impl/BadMapTest.scala index 5314339e..6bf9dea3 100644 --- a/sconfig/shared/src/test/scala/org/ekrich/config/impl/BadMapTest.scala +++ b/sconfig/shared/src/test/scala/org/ekrich/config/impl/BadMapTest.scala @@ -6,7 +6,7 @@ import org.junit.Test class BadMapTest extends TestUtils { @Test def copyingPut(): Unit = { - val map = new BadMap[String, String]() + val map = new BadMap[String, String]() val copy = map.copyingPut("key", "value") assertNull(map.get("key")) @@ -45,7 +45,7 @@ class BadMapTest extends TestUtils { @Test def putMany(): Unit = { val entries = (1 to 1000).map(i => (s"key$i", s"value$i")) - var map = new BadMap[String, String]() + var map = new BadMap[String, String]() for ((key, value) <- entries) { map = map.copyingPut(key, value) @@ -58,9 +58,9 @@ class BadMapTest extends TestUtils { @Test def putSameHash(): Unit = { - val hash = 2 + val hash = 2 val entries = (1 to 10).map(i => (new UniqueKeyWithHash(hash), s"value$i")) - var map = new BadMap[UniqueKeyWithHash, String]() + var map = new BadMap[UniqueKeyWithHash, String]() for ((key, value) <- entries) { map = map.copyingPut(key, value) diff --git a/sconfig/shared/src/test/scala/org/ekrich/config/impl/ConcatenationTest.scala b/sconfig/shared/src/test/scala/org/ekrich/config/impl/ConcatenationTest.scala index 2c8dee65..fe2184c6 100644 --- a/sconfig/shared/src/test/scala/org/ekrich/config/impl/ConcatenationTest.scala +++ b/sconfig/shared/src/test/scala/org/ekrich/config/impl/ConcatenationTest.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2012 Typesafe Inc. + * Copyright (C) 2012 Typesafe Inc. */ package org.ekrich.config.impl diff --git a/sconfig/shared/src/test/scala/org/ekrich/config/impl/ConfigDocumentParserTest.scala b/sconfig/shared/src/test/scala/org/ekrich/config/impl/ConfigDocumentParserTest.scala index f169bc06..b8e80e6a 100644 --- a/sconfig/shared/src/test/scala/org/ekrich/config/impl/ConfigDocumentParserTest.scala +++ b/sconfig/shared/src/test/scala/org/ekrich/config/impl/ConfigDocumentParserTest.scala @@ -132,7 +132,7 @@ class ConfigDocumentParserTest extends TestUtils { parseTest("""{include "foo.conf"}""") parseTest(" \n{foo:bar}\n ") - //Can parse a map with all simple types + // Can parse a map with all simple types parseTest("""{ aUnquoted : bar aString = "qux" diff --git a/sconfig/shared/src/test/scala/org/ekrich/config/impl/ConfigMemorySizeTest.scala b/sconfig/shared/src/test/scala/org/ekrich/config/impl/ConfigMemorySizeTest.scala index c3a30b3a..a8f759db 100644 --- a/sconfig/shared/src/test/scala/org/ekrich/config/impl/ConfigMemorySizeTest.scala +++ b/sconfig/shared/src/test/scala/org/ekrich/config/impl/ConfigMemorySizeTest.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2015 Typesafe Inc. + * Copyright (C) 2015 Typesafe Inc. */ package org.ekrich.config.impl diff --git a/sconfig/shared/src/test/scala/org/ekrich/config/impl/ConfigNodeTest.scala b/sconfig/shared/src/test/scala/org/ekrich/config/impl/ConfigNodeTest.scala index f017062a..3dabb251 100644 --- a/sconfig/shared/src/test/scala/org/ekrich/config/impl/ConfigNodeTest.scala +++ b/sconfig/shared/src/test/scala/org/ekrich/config/impl/ConfigNodeTest.scala @@ -45,9 +45,9 @@ class ConfigNodeTest extends TestUtils { nodeCloseBrace ) val complexNode = configNodeObject(complexNodeChildren) - val newNode = complexNode.setValueOnPath(key, newValue) - val origText = "{" + key + " : " + value.render + "}" - val finalText = "{" + key + " : " + newValue.render + "}" + val newNode = complexNode.setValueOnPath(key, newValue) + val origText = "{" + key + " : " + value.render + "}" + val finalText = "{" + key + " : " + newValue.render + "}" assertEquals(origText, complexNode.render) assertEquals(finalText, newNode.render) @@ -58,14 +58,14 @@ class ConfigNodeTest extends TestUtils { value2: AbstractConfigNodeValue, value3: AbstractConfigNodeValue ): Unit = { - val key = configNodeKey("foo") + val key = configNodeKey("foo") val keyValPair1 = nodeKeyValuePair(key, value1) val keyValPair2 = nodeKeyValuePair(key, value2) val keyValPair3 = nodeKeyValuePair(key, value3) val complexNode = configNodeObject( List(keyValPair1, keyValPair2, keyValPair3) ) - val origText = keyValPair1.render + keyValPair2.render + keyValPair3.render + val origText = keyValPair1.render + keyValPair2.render + keyValPair3.render val finalText = key.render + " : 15" assertEquals(origText, complexNode.render) @@ -80,14 +80,14 @@ class ConfigNodeTest extends TestUtils { List(nodeKeyValuePair(configNodeKey("bar"), nodeInt(15))) ) assertEquals("bar : 15", node.render) - val newNode = node.setValueOnPath("foo", value) + val newNode = node.setValueOnPath("foo", value) val finalText = "bar : 15, foo : " + value.render assertEquals(finalText, newNode.render) } @Test def createBasicConfigNode(): Unit = { - //Ensure a ConfigNodeSingleToken can handle all its required token types + // Ensure a ConfigNodeSingleToken can handle all its required token types singleTokenNodeTest(Tokens.START) singleTokenNodeTest(Tokens.END) singleTokenNodeTest(Tokens.OPEN_CURLY) @@ -109,7 +109,7 @@ class ConfigNodeTest extends TestUtils { @Test def createConfigNodeSetting(): Unit = { - //Ensure a ConfigNodeSetting can handle the normal key types + // Ensure a ConfigNodeSetting can handle the normal key types keyNodeTest("foo") keyNodeTest("\"Hello I am a key how are you today\"") } @@ -125,7 +125,7 @@ class ConfigNodeTest extends TestUtils { @Test def createConfigNodeSimpleValue(): Unit = { - //Ensure a ConfigNodeSimpleValue can handle the normal value types + // Ensure a ConfigNodeSimpleValue can handle the normal value types simpleValueNodeTest(tokenInt(10)) simpleValueNodeTest(tokenLong(10000)) simpleValueNodeTest(tokenDouble(3.14159)) @@ -160,7 +160,7 @@ class ConfigNodeTest extends TestUtils { @Test def replaceNodes(): Unit = { - //Ensure simple values can be replaced by other simple values + // Ensure simple values can be replaced by other simple values topLevelValueReplaceTest(nodeInt(10), nodeInt(15)) topLevelValueReplaceTest(nodeLong(10000), nodeInt(20)) topLevelValueReplaceTest(nodeDouble(3.14159), nodeLong(10000)) @@ -238,7 +238,7 @@ class ConfigNodeTest extends TestUtils { topLevelValueReplaceTest(array, concatenation) topLevelValueReplaceTest(concatenation, array) - //Ensure a key with format "a.b" will be properly replaced + // Ensure a key with format "a.b" will be properly replaced topLevelValueReplaceTest(nodeInt(10), nestedMap, "foo.bar") } @@ -248,7 +248,7 @@ class ConfigNodeTest extends TestUtils { val emptyArrayNode = configNodeArray( List(nodeOpenBracket, nodeCloseBracket) ) - //Ensure duplicates of a key are removed from a map + // Ensure duplicates of a key are removed from a map replaceDuplicatesTest(nodeInt(10), nodeTrue, nodeNull) replaceDuplicatesTest(emptyMapNode, emptyMapNode, emptyMapNode) replaceDuplicatesTest(emptyArrayNode, emptyArrayNode, emptyArrayNode) @@ -345,7 +345,7 @@ class ConfigNodeTest extends TestUtils { "foo : bar\nbaz : {\n\t\"abc.def\" : true\n\t//This is a comment about the below setting\n\n\tabc : {\n\t\t" + "def : false\n\t\t\n\t\t\"this.does.not.exist@@@+$#\" : {\n\t\t end : doesnotexist\n\t\t}\n\t}\n}\n\nbaz.abc.ghi : randomunquotedString\n}" - //Can replace settings in nested maps + // Can replace settings in nested maps // Paths with quotes in the name are treated as a single Path, rather than multiple sub-paths var newNode = origNode.setValueOnPath( "baz.\"abc.def\"", diff --git a/sconfig/shared/src/test/scala/org/ekrich/config/impl/PathTest.scala b/sconfig/shared/src/test/scala/org/ekrich/config/impl/PathTest.scala index eba0a3f9..489e665a 100644 --- a/sconfig/shared/src/test/scala/org/ekrich/config/impl/PathTest.scala +++ b/sconfig/shared/src/test/scala/org/ekrich/config/impl/PathTest.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011 Typesafe Inc. + * Copyright (C) 2011 Typesafe Inc. */ package org.ekrich.config.impl @@ -15,7 +15,7 @@ class PathTest extends TestUtils { val a = Path.newKey("foo.bar") // check that newKey worked assertEquals(path("foo.bar"), a) - val sameAsA = Path.newKey("foo.bar") + val sameAsA = Path.newKey("foo.bar") val differentKey = Path.newKey("hello") // here foo.bar is two elements val twoElements = Path.newPath("foo.bar") diff --git a/sconfig/shared/src/test/scala/org/ekrich/config/impl/PropertiesTest.scala b/sconfig/shared/src/test/scala/org/ekrich/config/impl/PropertiesTest.scala index 79b6b2e0..bfbd620d 100644 --- a/sconfig/shared/src/test/scala/org/ekrich/config/impl/PropertiesTest.scala +++ b/sconfig/shared/src/test/scala/org/ekrich/config/impl/PropertiesTest.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011 Typesafe Inc. + * Copyright (C) 2011 Typesafe Inc. */ package org.ekrich.config.impl @@ -16,7 +16,7 @@ import org.ekrich.config.ConfigResolveOptions class PropertiesTest extends TestUtils { @Test def pathSplitting(): Unit = { - def last(s: String) = PropertiesParser.lastElement(s) + def last(s: String) = PropertiesParser.lastElement(s) def exceptLast(s: String) = PropertiesParser.exceptLastElement(s) assertEquals("a", last("a")) @@ -170,13 +170,13 @@ class PropertiesTest extends TestUtils { ConfigFactory.parseProperties(props, ConfigParseOptions.defaults) assertEquals(Seq(0, 1, 2), conf1.getIntList("a").asScala.toSeq) - val conf2 = ConfigFactory.parseString(""" + val conf2 = ConfigFactory.parseString(""" a += 3 a += 4 a = ${a} [ 5, 6 ] a = [-2, -1] ${a} """) - val conf = conf2.withFallback(conf1).resolve() + val conf = conf2.withFallback(conf1).resolve() val reference = ConfigFactory.parseString("{ a : [-2,-1,0,1,2,3,4,5,6] }") assertEquals( diff --git a/sconfig/shared/src/test/scala/org/ekrich/config/impl/TestUtils.scala b/sconfig/shared/src/test/scala/org/ekrich/config/impl/TestUtils.scala index b2ec9c37..95a06b06 100644 --- a/sconfig/shared/src/test/scala/org/ekrich/config/impl/TestUtils.scala +++ b/sconfig/shared/src/test/scala/org/ekrich/config/impl/TestUtils.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011 Typesafe Inc. + * Copyright (C) 2011 Typesafe Inc. */ package org.ekrich.config.impl @@ -29,7 +29,7 @@ import language.implicitConversions abstract trait TestUtils { protected def intercept[E <: Throwable: ClassTag](block: => Any): E = { - val expectedClass = classTag[E].runtimeClass + val expectedClass = classTag[E].runtimeClass var thrown: Option[Throwable] = None val result = try { @@ -127,8 +127,8 @@ abstract trait TestUtils { sb.append('_') sb.appendCodePoint(b.asInstanceOf[Char]) } else { - sb.appendCodePoint(hexDigits((b & 0xF0) >> 4)) - sb.appendCodePoint(hexDigits(b & 0x0F)) + sb.appendCodePoint(hexDigits((b & 0xf0) >> 4)) + sb.appendCodePoint(hexDigits(b & 0x0f)) } } sb.toString @@ -152,15 +152,15 @@ abstract trait TestUtils { } private def copyViaSerialize(o: java.io.Serializable): AnyRef = { - val byteStream = new ByteArrayOutputStream() + val byteStream = new ByteArrayOutputStream() val objectStream = new ObjectOutputStream(byteStream) objectStream.writeObject(o) objectStream.close() val bytes = byteStream.toByteArray() - //outputStringLiteral(bytes) // uncomment to print - val inStream = new ByteArrayInputStream(bytes) + // outputStringLiteral(bytes) // uncomment to print + val inStream = new ByteArrayInputStream(bytes) val inObjectStream = new ObjectInputStream(inStream) - val copy = inObjectStream.readObject() + val copy = inObjectStream.readObject() inObjectStream.close() copy } @@ -174,7 +174,7 @@ abstract trait TestUtils { final def outputStringLiteral(hex: String): Unit = { if (hex.nonEmpty) { val (head, tail) = hex.splitAt(80) - val plus = if (tail.isEmpty) "" else " +" + val plus = if (tail.isEmpty) "" else " +" System.err.println("\"" + head + "\"" + plus) outputStringLiteral(tail) } @@ -186,8 +186,8 @@ abstract trait TestUtils { changedOK: Boolean = false ): Unit = { // be sure we can still deserialize the old one - val inStream = new ByteArrayInputStream(decodeLegibleBinary(expectedHex)) - var failure: Option[Exception] = None + val inStream = new ByteArrayInputStream(decodeLegibleBinary(expectedHex)) + var failure: Option[Exception] = None var inObjectStream: ObjectInputStream = null val deserialized = try { @@ -206,7 +206,7 @@ abstract trait TestUtils { .map({ e => ": " + e.getClass.getSimpleName + ": " + e.getMessage }) .getOrElse("") - val byteStream = new ByteArrayOutputStream() + val byteStream = new ByteArrayOutputStream() val objectStream = new ObjectOutputStream(byteStream) objectStream.writeObject(o) objectStream.close() @@ -246,7 +246,7 @@ abstract trait TestUtils { // no ObjectOutputStream / Serialization on Scala.js protected def checkNotSerializable(o: AnyRef): Unit = { - val byteStream = new ByteArrayOutputStream() + val byteStream = new ByteArrayOutputStream() val objectStream = new ObjectOutputStream(byteStream) val e = intercept[NotSerializableException] { objectStream.writeObject(o) @@ -364,58 +364,58 @@ abstract trait TestUtils { "[", "]", ",", - ParseTest(true, "10"), // value not in array or object - ParseTest(true, "\"foo\""), // value not in array or object - "\"", // single quote by itself - ParseTest(false, "[,]"), // array with just a comma in it - ParseTest(false, "[,,]"), // array with just two commas in it - ParseTest(false, "[1,2,,]"), // array with two trailing commas - ParseTest(false, "[,1,2]"), // array with initial comma - ParseTest(false, "{ , }"), // object with just a comma in it - ParseTest(false, "{ , , }"), // object with just two commas in it - "{ 1,2 }", // object with single values not key-value pair - ParseTest(false, "{ , \"foo\" : 10 }"), // object starts with comma + ParseTest(true, "10"), // value not in array or object + ParseTest(true, "\"foo\""), // value not in array or object + "\"", // single quote by itself + ParseTest(false, "[,]"), // array with just a comma in it + ParseTest(false, "[,,]"), // array with just two commas in it + ParseTest(false, "[1,2,,]"), // array with two trailing commas + ParseTest(false, "[,1,2]"), // array with initial comma + ParseTest(false, "{ , }"), // object with just a comma in it + ParseTest(false, "{ , , }"), // object with just two commas in it + "{ 1,2 }", // object with single values not key-value pair + ParseTest(false, "{ , \"foo\" : 10 }"), // object starts with comma ParseTest(false, "{ \"foo\" : 10 ,, }"), // object has two trailing commas - " \"a\" : 10 ,, ", // two trailing commas for braceless root object - "{ \"foo\" : }", // no value in object - "{ : 10 }", // no key in object - ParseTest(false, " \"foo\" : "), // no value in object with no braces - ParseTest(false, " : 10 "), // no key in object with no braces - " \"foo\" : 10 } ", // close brace but no open - " \"foo\" : 10 [ ", // no-braces object with trailing gunk - "{ \"foo\" }", // no value or colon - "{ \"a\" : [ }", // [ is not a valid value - "{ \"foo\" : 10, true }", // non-key after comma - "{ foo \n bar : 10 }", // newline in the middle of the unquoted key - "[ 1, \\", // ends with backslash + " \"a\" : 10 ,, ", // two trailing commas for braceless root object + "{ \"foo\" : }", // no value in object + "{ : 10 }", // no key in object + ParseTest(false, " \"foo\" : "), // no value in object with no braces + ParseTest(false, " : 10 "), // no key in object with no braces + " \"foo\" : 10 } ", // close brace but no open + " \"foo\" : 10 [ ", // no-braces object with trailing gunk + "{ \"foo\" }", // no value or colon + "{ \"a\" : [ }", // [ is not a valid value + "{ \"foo\" : 10, true }", // non-key after comma + "{ foo \n bar : 10 }", // newline in the middle of the unquoted key + "[ 1, \\", // ends with backslash // these two problems are ignored by the json tokenizer - "[:\"foo\", \"bar\"]", // colon in an array - "[\"foo\" : \"bar\"]", // colon in an array another way - "[ \"hello ]", // unterminated string + "[:\"foo\", \"bar\"]", // colon in an array + "[\"foo\" : \"bar\"]", // colon in an array another way + "[ \"hello ]", // unterminated string ParseTest(false, "{ \"foo\" , true }"), // comma instead of colon ParseTest( false, "{ \"foo\" : true \"bar\" : false }" - ), // missing comma between fields - "[ 10, }]", // array with } as an element - "[ 10, {]", // array with { as an element - "{}x", // trailing invalid token after the root object - "[]x", // trailing invalid token after the root array - ParseTest(false, "{}{}"), // trailing token after the root object - ParseTest(false, "{}true"), // trailing token after the root object - ParseTest(false, "[]{}"), // trailing valid token after the root array - ParseTest(false, "[]true"), // trailing valid token after the root array - "[${]", // unclosed substitution - "[$]", // '$' by itself - "[$ ]", // '$' by itself with spaces after - "[${}]", // empty substitution (no path) - "[${?}]", // no path with ? substitution - ParseTest(false, true, "[${ ?foo}]"), // space before ? not allowed - """{ "a" : [1,2], "b" : y${a}z }""", // trying to interpolate an array in a string + ), // missing comma between fields + "[ 10, }]", // array with } as an element + "[ 10, {]", // array with { as an element + "{}x", // trailing invalid token after the root object + "[]x", // trailing invalid token after the root array + ParseTest(false, "{}{}"), // trailing token after the root object + ParseTest(false, "{}true"), // trailing token after the root object + ParseTest(false, "[]{}"), // trailing valid token after the root array + ParseTest(false, "[]true"), // trailing valid token after the root array + "[${]", // unclosed substitution + "[$]", // '$' by itself + "[$ ]", // '$' by itself with spaces after + "[${}]", // empty substitution (no path) + "[${?}]", // no path with ? substitution + ParseTest(false, true, "[${ ?foo}]"), // space before ? not allowed + """{ "a" : [1,2], "b" : y${a}z }""", // trying to interpolate an array in a string """{ "a" : { "c" : 2 }, "b" : y${a}z }""", // trying to interpolate an object in a string - """{ "a" : ${a} }""", // simple cycle - """[ { "a" : 2, "b" : ${${a}} } ]""", // nested substitution - "[ = ]", // = is not a valid token in unquoted text + """{ "a" : ${a} }""", // simple cycle + """[ { "a" : 2, "b" : ${${a}} } ]""", // nested substitution + "[ = ]", // = is not a valid token in unquoted text "[ + ]", "[ # ]", "[ ` ]", @@ -430,20 +430,20 @@ abstract trait TestUtils { "[ += ]", "+= 10", "10 +=", - "[ 10e+3e ]", // "+" not allowed in unquoted strings, and not a valid number + "[ 10e+3e ]", // "+" not allowed in unquoted strings, and not a valid number ParseTest(false, "[ \"foo\nbar\" ]"), // unescaped newline in quoted string "[ # comment ]", "${ #comment }", "[ // comment ]", "${ // comment }", - "{ include \"bar\" : 10 }", // include with a value after it - "{ include foo }", // include with unquoted string + "{ include \"bar\" : 10 }", // include with a value after it + "{ include foo }", // include with unquoted string "{ include : { \"a\" : 1 } }", // include used as unquoted key - "a=", // no value - "a:", // no value with colon - "a= ", // no value with whitespace after - "a.b=", // no value with path - "{ a= }", // no value inside braces + "a=", // no value + "a:", // no value with colon + "a= ", // no value with whitespace after + "a.b=", // no value with path + "{ a= }", // no value inside braces "{ a: }" ) // no value with colon inside braces @@ -455,7 +455,7 @@ abstract trait TestUtils { """{ "foo" : "bar" }""", """["foo", "bar"]""", """{ "foo" : 42 }""", - "{ \"foo\"\n : 42 }", // newline after key + "{ \"foo\"\n : 42 }", // newline after key "{ \"foo\" : \n 42 }", // newline after colon """[10, 11]""", """[10,"foo"]""", @@ -467,7 +467,7 @@ abstract trait TestUtils { """[[[[[[]]]]]]""", """[[1], [1,2], [1,2,3], []]""", // nested multiple-valued array """{"a":{"a":{"a":{"a":{"a":{"a":{"a":{"a":42}}}}}}}}""", - "[ \"#comment\" ]", // quoted # comment + "[ \"#comment\" ]", // quoted # comment "[ \"//comment\" ]", // quoted // comment // this long one is mostly to test rendering """{ "foo" : { "bar" : "baz", "woo" : "w00t" }, "baz" : { "bar" : "baz", "woo" : [1,2,3,4], "w00t" : true, "a" : false, "b" : 3.14, "c" : null } }""", @@ -477,57 +477,57 @@ abstract trait TestUtils { // spray-json throws so change to false private val validConfInvalidJson = List[ParseTest]( - "", // empty document - " ", // empty document single space - "\n", // empty document single newline - " \n \n \n\n\n", // complicated empty document - "# foo", // just a comment - "# bar\n", // just a comment with a newline - "# foo\n//bar", // comment then another with no newline - """{ "foo" = 42 }""", // equals rather than colon - """{ "foo" = (42) }""", // value with round braces - """{ foo { "bar" : 42 } }""", // omit the colon for object value - """{ foo baz { "bar" : 42 } }""", // omit the colon with unquoted key with spaces - """ "foo" : 42 """, // omit braces on root object - """{ "foo" : bar }""", // no quotes on value - """{ "foo" : null bar 42 baz true 3.14 "hi" }""", // bunch of values to concat into a string - "{ foo : \"bar\" }", // no quotes on key - "{ foo : bar }", // no quotes on key or value - "{ foo.bar : bar }", // path expression in key - "{ foo.\"hello world\".baz : bar }", // partly-quoted path expression in key - "{ foo.bar \n : bar }", // newline after path expression in key - "{ foo bar : bar }", // whitespace in the key - "{ true : bar }", // key is a non-string token + "", // empty document + " ", // empty document single space + "\n", // empty document single newline + " \n \n \n\n\n", // complicated empty document + "# foo", // just a comment + "# bar\n", // just a comment with a newline + "# foo\n//bar", // comment then another with no newline + """{ "foo" = 42 }""", // equals rather than colon + """{ "foo" = (42) }""", // value with round braces + """{ foo { "bar" : 42 } }""", // omit the colon for object value + """{ foo baz { "bar" : 42 } }""", // omit the colon with unquoted key with spaces + """ "foo" : 42 """, // omit braces on root object + """{ "foo" : bar }""", // no quotes on value + """{ "foo" : null bar 42 baz true 3.14 "hi" }""", // bunch of values to concat into a string + "{ foo : \"bar\" }", // no quotes on key + "{ foo : bar }", // no quotes on key or value + "{ foo.bar : bar }", // path expression in key + "{ foo.\"hello world\".baz : bar }", // partly-quoted path expression in key + "{ foo.bar \n : bar }", // newline after path expression in key + "{ foo bar : bar }", // whitespace in the key + "{ true : bar }", // key is a non-string token ParseTest(true, """{ "foo" : "bar", "foo" : "bar2" }"""), // dup keys - ParseTest(false, "[ 1, 2, 3, ]"), // single trailing comma - ParseTest(false, "[1,2,3 , ]"), // single trailing comma with whitespace - ParseTest(false, "[1,2,3\n\n , \n]"), // single trailing comma with newlines - ParseTest(false, "[1,]"), // single trailing comma with one-element array - ParseTest(false, "{ \"foo\" : 10, }"), // extra trailing comma - ParseTest(false, "{ \"a\" : \"b\", }"), // single trailing comma in object - "{ a : b, }", // single trailing comma in object (unquoted strings) - "{ a : b \n , \n }", // single trailing comma in object with newlines - "a : b, c : d,", // single trailing comma in object with no root braces - "{ a : b\nc : d }", // skip comma if there's a newline - "a : b\nc : d", // skip comma if there's a newline and no root braces - "a : b\nc : d,", // skip one comma but still have one at the end - "[ foo ]", // not a known token in JSON - "[ t ]", // start of "true" but ends wrong in JSON + ParseTest(false, "[ 1, 2, 3, ]"), // single trailing comma + ParseTest(false, "[1,2,3 , ]"), // single trailing comma with whitespace + ParseTest(false, "[1,2,3\n\n , \n]"), // single trailing comma with newlines + ParseTest(false, "[1,]"), // single trailing comma with one-element array + ParseTest(false, "{ \"foo\" : 10, }"), // extra trailing comma + ParseTest(false, "{ \"a\" : \"b\", }"), // single trailing comma in object + "{ a : b, }", // single trailing comma in object (unquoted strings) + "{ a : b \n , \n }", // single trailing comma in object with newlines + "a : b, c : d,", // single trailing comma in object with no root braces + "{ a : b\nc : d }", // skip comma if there's a newline + "a : b\nc : d", // skip comma if there's a newline and no root braces + "a : b\nc : d,", // skip one comma but still have one at the end + "[ foo ]", // not a known token in JSON + "[ t ]", // start of "true" but ends wrong in JSON "[ tx ]", "[ tr ]", "[ trx ]", "[ tru ]", "[ trux ]", "[ truex ]", - "[ 10x ]", // number token with trailing junk - "[ / ]", // unquoted string "slash" - "{ include \"foo\" }", // valid include - "{ include\n\"foo\" }", // include with just a newline separating from string - "{ include\"foo\" }", // include with no whitespace after it - "[ include ]", // include can be a string value in an array - "{ foo : include }", // include can be a field value also + "[ 10x ]", // number token with trailing junk + "[ / ]", // unquoted string "slash" + "{ include \"foo\" }", // valid include + "{ include\n\"foo\" }", // include with just a newline separating from string + "{ include\"foo\" }", // include with no whitespace after it + "[ include ]", // include can be a string value in an array + "{ foo : include }", // include can be a field value also "{ include \"foo\", \"a\" : \"b\" }", // valid include followed by comma and field - "{ foo include : 42 }", // valid to have a key not starting with include + "{ foo include : 42 }", // valid to have a key not starting with include "[ ${foo} ]", "[ ${?foo} ]", "[ ${\"foo\"} ]", @@ -557,7 +557,7 @@ abstract trait TestUtils { , 11]""", """[ 10 // comment , 11]""", - """{ /a/b/c : 10 }""", // key has a slash in it + """{ /a/b/c : 10 }""", // key has a slash in it ParseTest(false, true, "[${ foo.bar}]"), // substitution with leading spaces ParseTest( false, @@ -573,17 +573,17 @@ abstract trait TestUtils { false, true, "[${\"foo.bar\" }]" - ), // substitution with trailing spaces and quoted - """[ ${"foo""bar"} ]""", // multiple strings in substitution + ), // substitution with trailing spaces and quoted + """[ ${"foo""bar"} ]""", // multiple strings in substitution """[ ${foo "bar" baz} ]""", // multiple strings and whitespace in substitution - "[${true}]", // substitution with unquoted true token - "a = [], a += b", // += operator with previous init - "{ a = [], a += 10 }", // += in braces object with previous init - "a += b", // += operator without previous init - "{ a += 10 }", // += in braces object without previous init - "[ 10e3e3 ]", // two exponents. this should parse to a number plus string "e3" - "[ 1-e3 ]", // malformed number should end up as a string instead - "[ 1.0.0 ]", // two decimals, should end up as a string + "[${true}]", // substitution with unquoted true token + "a = [], a += b", // += operator with previous init + "{ a = [], a += 10 }", // += in braces object with previous init + "a += b", // += operator without previous init + "{ a += 10 }", // += in braces object without previous init + "[ 10e3e3 ]", // two exponents. this should parse to a number plus string "e3" + "[ 1-e3 ]", // malformed number should end up as a string instead + "[ 1.0.0 ]", // two decimals, should end up as a string "[ 1.0. ]" ) // trailing decimal should end up as a string @@ -657,10 +657,10 @@ abstract trait TestUtils { // instances, because we may be testing that the public API returns the // right instance by comparing to these, so using public API here would // make the test compare public API to itself. - protected def intValue(i: Int) = new ConfigInt(fakeOrigin(), i, null) - protected def longValue(l: Long) = new ConfigLong(fakeOrigin(), l, null) + protected def intValue(i: Int) = new ConfigInt(fakeOrigin(), i, null) + protected def longValue(l: Long) = new ConfigLong(fakeOrigin(), l, null) protected def boolValue(b: Boolean) = new ConfigBoolean(fakeOrigin(), b) - protected def nullValue() = new ConfigNull(fakeOrigin()) + protected def nullValue() = new ConfigNull(fakeOrigin()) protected def stringValue(s: String) = new ConfigString.Quoted(fakeOrigin(), s) protected def doubleValue(d: Double) = @@ -706,16 +706,16 @@ abstract trait TestUtils { substInString(ref, false) } - def tokenTrue = Tokens.newBoolean(fakeOrigin(), true) - def tokenFalse = Tokens.newBoolean(fakeOrigin(), false) - def tokenNull = Tokens.newNull(fakeOrigin()) + def tokenTrue = Tokens.newBoolean(fakeOrigin(), true) + def tokenFalse = Tokens.newBoolean(fakeOrigin(), false) + def tokenNull = Tokens.newNull(fakeOrigin()) def tokenUnquoted(s: String) = Tokens.newUnquotedText(fakeOrigin(), s) def tokenString(s: String) = Tokens.newString(fakeOrigin(), s, "\"" + s + "\"") def tokenDouble(d: Double) = Tokens.newDouble(fakeOrigin(), d, "" + d) - def tokenInt(i: Int) = Tokens.newInt(fakeOrigin(), i, "" + i) - def tokenLong(l: Long) = Tokens.newLong(fakeOrigin(), l, l.toString()) - def tokenLine(line: Int) = Tokens.newLine(fakeOrigin().withLineNumber(line)) + def tokenInt(i: Int) = Tokens.newInt(fakeOrigin(), i, "" + i) + def tokenLong(l: Long) = Tokens.newLong(fakeOrigin(), l, l.toString()) + def tokenLine(line: Int) = Tokens.newLine(fakeOrigin().withLineNumber(line)) def tokenCommentDoubleSlash(text: String) = Tokens.newCommentDoubleSlash(fakeOrigin(), text) def tokenCommentHash(text: String) = @@ -793,13 +793,13 @@ abstract trait TestUtils { new ConfigNodeConcatenation(nodes.asJavaCollection) } - def nodeColon = new ConfigNodeSingleToken(Tokens.COLON) - def nodeSpace = new ConfigNodeSingleToken(tokenUnquoted(" ")) - def nodeOpenBrace = new ConfigNodeSingleToken(Tokens.OPEN_CURLY) - def nodeCloseBrace = new ConfigNodeSingleToken(Tokens.CLOSE_CURLY) - def nodeOpenBracket = new ConfigNodeSingleToken(Tokens.OPEN_SQUARE) - def nodeCloseBracket = new ConfigNodeSingleToken(Tokens.CLOSE_SQUARE) - def nodeComma = new ConfigNodeSingleToken(Tokens.COMMA) + def nodeColon = new ConfigNodeSingleToken(Tokens.COLON) + def nodeSpace = new ConfigNodeSingleToken(tokenUnquoted(" ")) + def nodeOpenBrace = new ConfigNodeSingleToken(Tokens.OPEN_CURLY) + def nodeCloseBrace = new ConfigNodeSingleToken(Tokens.CLOSE_CURLY) + def nodeOpenBracket = new ConfigNodeSingleToken(Tokens.OPEN_SQUARE) + def nodeCloseBracket = new ConfigNodeSingleToken(Tokens.CLOSE_SQUARE) + def nodeComma = new ConfigNodeSingleToken(Tokens.COMMA) def nodeLine(line: Integer) = new ConfigNodeSingleToken(tokenLine(line)) def nodeWhitespace(whitespace: String) = new ConfigNodeSingleToken(tokenWhitespace(whitespace)) @@ -807,12 +807,12 @@ abstract trait TestUtils { val nodes = List(key, nodeSpace, nodeColon, nodeSpace, value) new ConfigNodeField(nodes.asJavaCollection) } - def nodeInt(value: Integer) = new ConfigNodeSimpleValue(tokenInt(value)) + def nodeInt(value: Integer) = new ConfigNodeSimpleValue(tokenInt(value)) def nodeString(value: String) = new ConfigNodeSimpleValue(tokenString(value)) - def nodeLong(value: Long) = new ConfigNodeSimpleValue(tokenLong(value)) + def nodeLong(value: Long) = new ConfigNodeSimpleValue(tokenLong(value)) def nodeDouble(value: Double) = new ConfigNodeSimpleValue(tokenDouble(value)) - def nodeTrue = new ConfigNodeSimpleValue(tokenTrue) - def nodeFalse = new ConfigNodeSimpleValue(tokenFalse) + def nodeTrue = new ConfigNodeSimpleValue(tokenTrue) + def nodeFalse = new ConfigNodeSimpleValue(tokenFalse) def nodeCommentHash(text: String) = new ConfigNodeComment(tokenCommentHash(text)) def nodeCommentDoubleSlash(text: String) = @@ -855,7 +855,7 @@ abstract trait TestUtils { val executor = Executors.newSingleThreadExecutor() val f = executor.submit(new Callable[T] { override def call(): T = { - val t = Thread.currentThread() + val t = Thread.currentThread() val old = t.getContextClassLoader() t.setContextClassLoader(loader) val result = @@ -986,13 +986,13 @@ abstract trait TestUtils { } protected def checkSerializableWithCustomSerializer[T: ClassTag](o: T): T = { - val byteStream = new ByteArrayOutputStream() + val byteStream = new ByteArrayOutputStream() val objectStream = new CustomObjectOutputStream(byteStream) objectStream.writeObject(o) objectStream.close() - val inStream = new ByteArrayInputStream(byteStream.toByteArray) + val inStream = new ByteArrayInputStream(byteStream.toByteArray) val inObjectStream = new CustomObjectInputStream(inStream) - val copy = inObjectStream.readObject() + val copy = inObjectStream.readObject() inObjectStream.close() copy.asInstanceOf[T] } diff --git a/sconfig/shared/src/test/scala/org/ekrich/config/impl/TokenTest.scala b/sconfig/shared/src/test/scala/org/ekrich/config/impl/TokenTest.scala index 92870c48..304058c2 100644 --- a/sconfig/shared/src/test/scala/org/ekrich/config/impl/TokenTest.scala +++ b/sconfig/shared/src/test/scala/org/ekrich/config/impl/TokenTest.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011 Typesafe Inc. + * Copyright (C) 2011 Typesafe Inc. */ package org.ekrich.config.impl diff --git a/sconfig/shared/src/test/scala/org/ekrich/config/impl/TokenizerTest.scala b/sconfig/shared/src/test/scala/org/ekrich/config/impl/TokenizerTest.scala index 4304f4c3..8f370809 100644 --- a/sconfig/shared/src/test/scala/org/ekrich/config/impl/TokenizerTest.scala +++ b/sconfig/shared/src/test/scala/org/ekrich/config/impl/TokenizerTest.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011 Typesafe Inc. + * Copyright (C) 2011 Typesafe Inc. */ package org.ekrich.config.impl @@ -20,14 +20,14 @@ class TokenizerTest extends TestUtils { @Test def tokenizeEmptyString(): Unit = { - val source = "" + val source = "" val expected = List() tokenizerTest(expected, source) } @Test def tokenizeNewlines(): Unit = { - val source = "\n\n" + val source = "\n\n" val expected = List(tokenLine(1), tokenLine(2)) tokenizerTest(expected, source) } @@ -161,49 +161,49 @@ class TokenizerTest extends TestUtils { @Test def tokenizeTrueAndUnquotedText(): Unit = { - val source = """truefoo""" + val source = """truefoo""" val expected = List(tokenTrue, tokenUnquoted("foo")) tokenizerTest(expected, source) } @Test def tokenizeFalseAndUnquotedText(): Unit = { - val source = """falsefoo""" + val source = """falsefoo""" val expected = List(tokenFalse, tokenUnquoted("foo")) tokenizerTest(expected, source) } @Test def tokenizeNullAndUnquotedText(): Unit = { - val source = """nullfoo""" + val source = """nullfoo""" val expected = List(tokenNull, tokenUnquoted("foo")) tokenizerTest(expected, source) } @Test def tokenizeUnquotedTextContainingRoundBrace(): Unit = { - val source = """(footrue)""" + val source = """(footrue)""" val expected = List(tokenUnquoted("(footrue)")) tokenizerTest(expected, source) } @Test def tokenizeUnquotedTextContainingTrue(): Unit = { - val source = """footrue""" + val source = """footrue""" val expected = List(tokenUnquoted("footrue")) tokenizerTest(expected, source) } @Test def tokenizeUnquotedTextContainingSpaceTrue(): Unit = { - val source = """foo true""" + val source = """foo true""" val expected = List(tokenUnquoted("foo"), tokenUnquoted(" "), tokenTrue) tokenizerTest(expected, source) } @Test def tokenizeTrueAndSpaceAndUnquotedText(): Unit = { - val source = """true foo""" + val source = """true foo""" val expected = List(tokenTrue, tokenUnquoted(" "), tokenUnquoted("foo")) tokenizerTest(expected, source) } @@ -296,21 +296,21 @@ class TokenizerTest extends TestUtils { @Test def tokenizerReturnsProblemOnInvalidStrings(): Unit = { val invalidTests = List( - """ "\" """, // nothing after a backslash - """ "\q" """, // there is no \q escape sequence - "\"\\u123\"", // too short - "\"\\u12\"", // too short - "\"\\u1\"", // too short - "\"\\u\"", // too short - "\"", // just a single quote + """ "\" """, // nothing after a backslash + """ "\q" """, // there is no \q escape sequence + "\"\\u123\"", // too short + "\"\\u12\"", // too short + "\"\\u1\"", // too short + "\"\\u\"", // too short + "\"", // just a single quote """ "abcdefg""", // no end quote - """\"\""", // file ends with a backslash - "$", // file ends with a $ - "${" // file ends with a ${ + """\"\""", // file ends with a backslash + "$", // file ends with a $ + "${" // file ends with a ${ ) for (t <- invalidTests) { - val tokenized = tokenizeAsList(t) + val tokenized = tokenizeAsList(t) val maybeProblem = tokenized.find(Tokens.isProblem(_)) assertTrue( s"expected failure for <$t> but got ${t}", @@ -321,35 +321,35 @@ class TokenizerTest extends TestUtils { @Test def tokenizerEmptyTripleQuoted(): Unit = { - val source = "\"\"\"\"\"\"" + val source = "\"\"\"\"\"\"" val expected = List(tokenString("")) tokenizerTest(expected, source) } @Test def tokenizerTrivialTripleQuoted(): Unit = { - val source = "\"\"\"bar\"\"\"" + val source = "\"\"\"bar\"\"\"" val expected = List(tokenString("bar")) tokenizerTest(expected, source) } @Test def tokenizerNoEscapesInTripleQuoted(): Unit = { - val source = "\"\"\"\\n\"\"\"" + val source = "\"\"\"\\n\"\"\"" val expected = List(tokenString("\\n")) tokenizerTest(expected, source) } @Test def tokenizerTrailingQuotesInTripleQuoted(): Unit = { - val source = "\"\"\"\"\"\"\"\"\"" + val source = "\"\"\"\"\"\"\"\"\"" val expected = List(tokenString("\"\"\"")) tokenizerTest(expected, source) } @Test def tokenizerNewlineInTripleQuoted(): Unit = { - val source = "\"\"\"foo\nbar\"\"\"" + val source = "\"\"\"foo\nbar\"\"\"" val expected = List(tokenString("foo\nbar")) tokenizerTest(expected, source) } diff --git a/sconfig/shared/src/test/scala/org/ekrich/config/impl/UnitParserTest.scala b/sconfig/shared/src/test/scala/org/ekrich/config/impl/UnitParserTest.scala index 05715062..6d59567a 100644 --- a/sconfig/shared/src/test/scala/org/ekrich/config/impl/UnitParserTest.scala +++ b/sconfig/shared/src/test/scala/org/ekrich/config/impl/UnitParserTest.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011 Typesafe Inc. + * Copyright (C) 2011 Typesafe Inc. */ package org.ekrich.config.impl @@ -91,7 +91,7 @@ class UnitParserTest extends TestUtils { val oneYear = ChronoUnit.DAYS.between(epochDate, epochDate.plus(Period.ofYears(1))) for (y <- oneYears) { - val period = SimpleConfig.parsePeriod(y, fakeOrigin(), "test") + val period = SimpleConfig.parsePeriod(y, fakeOrigin(), "test") val dayCount = ChronoUnit.DAYS.between(epochDate, epochDate.plus(period)) assertEquals(oneYear, dayCount) } @@ -119,7 +119,7 @@ class UnitParserTest extends TestUtils { // this broke because "1d" is a valid double for parseDouble @Test def parseOneDayAsMilliseconds(): Unit = { - val result = SimpleConfig.parseDuration("1d", fakeOrigin(), "test") + val result = SimpleConfig.parseDuration("1d", fakeOrigin(), "test") val dayInNanos = TimeUnit.DAYS.toNanos(1) assertEquals("could parse 1d", dayInNanos, result) diff --git a/sconfig/shared/src/test/scala/org/ekrich/config/impl/UtilTest.scala b/sconfig/shared/src/test/scala/org/ekrich/config/impl/UtilTest.scala index a4add7d8..25653f4b 100644 --- a/sconfig/shared/src/test/scala/org/ekrich/config/impl/UtilTest.scala +++ b/sconfig/shared/src/test/scala/org/ekrich/config/impl/UtilTest.scala @@ -1,5 +1,5 @@ /** - * Copyright (C) 2011 Typesafe Inc. + * Copyright (C) 2011 Typesafe Inc. */ package org.ekrich.config.impl @@ -10,8 +10,8 @@ import org.junit._ class UtilTest extends TestUtils { private lazy val supplementaryChars = { val sb = new java.lang.StringBuilder() - val codepoints = Seq(0x2070E, 0x20731, 0x20779, 0x20C53, 0x20C78, 0x20C96, - 0x20CCF, 0x20CD5, 0x20D15, 0x20D7C) + val codepoints = Seq(0x2070e, 0x20731, 0x20779, 0x20c53, 0x20c78, 0x20c96, + 0x20ccf, 0x20cd5, 0x20d15, 0x20d7c) for (c <- codepoints) { sb.appendCodePoint(c) } @@ -30,9 +30,9 @@ class UtilTest extends TestUtils { ConfigImplUtil.unicodeTrim(supplementaryChars) ) - val s = " \u00A0 \n " + supplementaryChars + " \n \u00A0 " + val s = " \u00A0 \n " + supplementaryChars + " \n \u00A0 " val asciiTrimmed = s.trim() - val unitrimmed = ConfigImplUtil.unicodeTrim(s) + val unitrimmed = ConfigImplUtil.unicodeTrim(s) assertFalse(asciiTrimmed.equals(unitrimmed)) assertEquals(supplementaryChars, unitrimmed) @@ -64,7 +64,7 @@ class UtilTest extends TestUtils { private def roundtripJson(s: String): Unit = { val rendered = ConfigImplUtil.renderJsonString(s) - val parsed = parseConfig("{ foo: " + rendered + "}").getString("foo") + val parsed = parseConfig("{ foo: " + rendered + "}").getString("foo") assertTrue( "String round-tripped through maybe-unquoted escaping '" + s + "' " + s.length + " rendering '" + rendered + "' " + rendered.length + @@ -75,7 +75,7 @@ class UtilTest extends TestUtils { private def roundtripUnquoted(s: String): Unit = { val rendered = ConfigImplUtil.renderStringUnquotedIfPossible(s) - val parsed = parseConfig("{ foo: " + rendered + "}").getString("foo") + val parsed = parseConfig("{ foo: " + rendered + "}").getString("foo") assertTrue( "String round-tripped through maybe-unquoted escaping '" + s + "' " + s.length + " rendering '" + rendered + "' " + rendered.length + diff --git a/scripts/.coursier b/scripts/.coursier deleted file mode 100755 index 87c7519657802092df9af8c4b0c9c1aeb10269f2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17633 zcmcheWpo_LlBmVZOcpaUGcz+YGs|MB#mvlTFF&zP>3p`|lGbMlSEyyq_Vo zvj6w5zb>PbrlY1JbTM-!q@#Ps3lhJ-dB0aAp_BF{CgkDycWpBlBa?rBv*IJAq_iTW zA!MSW`q!_f4)$g+Fu#-Ntc{%Cag45J9q6{b)8W0o|6p)gSpB&I{1?T;B)^T&mTVJy6Zi-sCdPaK0-GYY~eD2`_{yN^2n5&4IT@7nM< zKVScH=eOc>eZ8UK4^)Sq7lnoCq}eY*92?F_EsTbrPQ|#D<&QkK+)^K0jp+*Il}+HBLUZ8SvD{f!$Lhk2zD2lU8G3d@Bi^#$ zxf=7i9CM9+gkyH>F8ycTdx+Zh%C(J?iNiA7I5AD}=48vqnFMU_9Wf8(jF zY%Ps1TZ#X=ws(ncMdnS*XLUvPQFykv&;^{YxVRW@MY>6Q*!s|lrA>bE0kj>Q_6{;M zR;H|2QhZciybzlzZ$mt8wLjL%nw#f~od0e>fV%(9#zLSlHw#haZd0#;Ii4JTn#y-} zzba~f#el`Pb5*s*FdOIRIN`|Gln^v8>f$mO0~0F}Ha=}SO=+s~ho&m=#K^)uHnmZ) zS+t9F9R$siwo4s2bra7$e^>(*=%%1fHZxw$X6>(UiYfVOoZl$}`MJ5c)V4a?G-gZ3 zlSstb4<*=$^K(UCJQG*ZmXo)FF-H`nsBss?LuaMbl&3@=UB1Y2lUZ4j9b?n%I!9I{ zbb8I;?>TxEs?#cat39MwjV>ooIvj+G#;8q1y*1wf4R;$oensZ(kA@gd8{4s)ixCf0mPb?S?QzxDR{SnhH z{4=7f?cv!WoW}sjAyGyT_ejX-!$rR>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G`OW?*%7DL{79b$x_tzL05D+{6uW$bc_KL-1 diff --git a/scripts/.scalafmt-2.3.2 b/scripts/.scalafmt-2.3.2 deleted file mode 100755 index 91ce22f7639983322a63e764049395c2fd095414..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18060 zcmch;WmH|u(x{EQy9IZ5UAViuySoPn?(XjHP6!s<-3e|1f=h7u$Ugf$Cwt$0?-=j- z@ik*ICUf&#Ng`e#9(A;$6#vbM(At-V`u1O?#xR{0s~{o%fv(IZeeL- zN~ldpOlnC?NcVnA`bPyqT^>Rcdl!44vL_jKu#xN%8x){UzJ~A=tZI|CLM@mS!&Rg8b3u@4}dR zm>LsW8M+z%(O@tN(x6~yKu}OnK#JaWB#8%cntX?;r;i=KGFPo4nGGdOQiQ4!p#RFl@Q)sZDjo7~a^XgfIV9b`z1bZL=<*r=RX0X9|c zrdaG+e~hISH_sPY-#tG+HQ$@fMSme~7NW|%re1wBJX!oyq^QasnySPSA`14|R7XW;(JnT$5j2Y1F16v* zj6L>!VfB@vn*uu7OaU6rT3_E3lJitKzft=0adUC0Zg;k+&z6iQl8CV%iL(*s<%qm^ zB&?yWBy9&`j>t<=<1UGX%u1>%O^G}@f05xPv$P~T#-`bGil~V1^qj%pcknDwqgC=! zeMqYsT}hg>KMaF+`RRgy5Y*1S+qqpmn!fexriL;?&@ZL6zvWNQ)e%4KKBiQ zTLn}}?^dQrwL(X6&S^uK%(Efl`v~sQJ~ZM2u|OD1omevTM@-wW&xkHIM`uTH?gNmI zecHP-9KF~V#ExKTNz~7HO#>ac#qkr- zENA&jv5wrNTwFp?N`X{GcGr)a%O5w;F#W((rMi5Yam=1dF*6wHNo+5s)CSPutUFm% zR_4QztXy6ZfRdu;B&N%WfK4^@&OIs|)~Lw|c>?Ip%?HQp7Ze;mLMV zma$+rZv;1$>0B&Urt+wqM^VEBb$Md2C0FJCk<;jv7CAaMgrwGz5IJgmsWX6FQ8_|% z5%a2{%~C2oWkxRbf%|c~uC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