Skip to content

Commit 871bf5e

Browse files
authored
Change ConfigFactory/SimpleConfigObject def to no paren (#488)
1 parent 87ec47a commit 871bf5e

File tree

9 files changed

+19
-20
lines changed

9 files changed

+19
-20
lines changed

sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfigBeanFactoryTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ class ConfigBeanFactoryTest extends TestUtils {
396396
def testDifferentFieldNameFromAccessors(): Unit = {
397397
val e = intercept[ConfigException.ValidationFailed] {
398398
ConfigBeanFactory.create(
399-
ConfigFactory.empty(),
399+
ConfigFactory.empty,
400400
classOf[DifferentFieldNameFromAccessorsConfig]
401401
)
402402
}

sconfig/jvm/src/test/scala/org/ekrich/config/impl/ConfigValueTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ class ConfigValueTest extends TestUtils {
251251

252252
@Test
253253
def configDelayedMergeObjectNotSerializable(): Unit = {
254-
val empty = SimpleConfigObject.empty()
254+
val empty = SimpleConfigObject.empty
255255
val s1 = subst("foo")
256256
val s2 = subst("bar")
257257
val a = new ConfigDelayedMergeObject(

sconfig/jvm/src/test/scala/org/ekrich/config/impl/PublicApiTest.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ class PublicApiTest extends TestUtils {
103103

104104
@Test
105105
def emptyConfigs(): Unit = {
106-
assertTrue(ConfigFactory.empty().isEmpty)
107-
assertEquals("empty config", ConfigFactory.empty().origin.description)
106+
assertTrue(ConfigFactory.empty.isEmpty)
107+
assertEquals("empty config", ConfigFactory.empty.origin.description)
108108
assertTrue(ConfigFactory.empty("foo").isEmpty)
109109
assertEquals("foo", ConfigFactory.empty("foo").origin.description)
110110
}

sconfig/shared/src/main/scala/org/ekrich/config/ConfigFactory.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ object ConfigFactory extends PlatformConfigFactory {
519519
* @return
520520
* an empty configuration
521521
*/
522-
def empty(): Config = empty(null)
522+
def empty: Config = empty(null)
523523

524524
/**
525525
* Gets an empty configuration with a description to be used to create a

sconfig/shared/src/main/scala/org/ekrich/config/impl/ResolveSource.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ final class ResolveSource(
180180
private def rootMustBeObj(value: Container) =
181181
if (value.isInstanceOf[AbstractConfigObject])
182182
value.asInstanceOf[AbstractConfigObject]
183-
else SimpleConfigObject.empty()
183+
else SimpleConfigObject.empty
184184
@throws[NotPossibleToResolve]
185185
private[impl] def lookupSubst(
186186
context: ResolveContext,
@@ -298,7 +298,7 @@ final class ResolveSource(
298298
newPath.last.asInstanceOf[AbstractConfigObject],
299299
newPath
300300
)
301-
else new ResolveSource(SimpleConfigObject.empty())
301+
else new ResolveSource(SimpleConfigObject.empty)
302302
} else if (old eq root) new ResolveSource(rootMustBeObj(replacement))
303303
else {
304304
throw new ConfigException.BugOrBroken(

sconfig/shared/src/main/scala/org/ekrich/config/impl/SimpleConfigObject.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,10 @@ object SimpleConfigObject {
145145

146146
private val emptyInstance = empty(SimpleConfigOrigin.newSimple(EMPTY_NAME))
147147

148-
private[impl] def empty(): SimpleConfigObject = emptyInstance
148+
private[impl] def empty: SimpleConfigObject = emptyInstance
149149

150150
private[impl] def empty(origin: ConfigOrigin): SimpleConfigObject =
151-
if (origin == null) empty()
151+
if (origin == null) empty
152152
else
153153
new SimpleConfigObject(
154154
origin,

sconfig/shared/src/test/scala/org/ekrich/config/impl/ConfigTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ConfigTest extends TestUtilsShared {
2828

2929
def mergeUnresolved(toMerge: AbstractConfigObject*) = {
3030
if (toMerge.isEmpty) {
31-
SimpleConfigObject.empty()
31+
SimpleConfigObject.empty
3232
} else {
3333
toMerge.reduce((first, second) => first.withFallback(second))
3434
}

sconfig/shared/src/test/scala/org/ekrich/config/impl/ConfigValueSharedTest.scala

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ class ConfigValueSharedTest extends TestUtilsShared {
201201

202202
@Test
203203
def configDelayedMergeObjectEquality(): Unit = {
204-
val empty = SimpleConfigObject.empty()
204+
val empty = SimpleConfigObject.empty
205205
val s1 = subst("foo")
206206
val s2 = subst("bar")
207207
val a = new ConfigDelayedMergeObject(
@@ -232,7 +232,7 @@ class ConfigValueSharedTest extends TestUtilsShared {
232232
stringValue("hi").toString()
233233
nullValue().toString()
234234
boolValue(true).toString()
235-
val emptyObj = SimpleConfigObject.empty()
235+
val emptyObj = SimpleConfigObject.empty
236236
emptyObj.toString()
237237
(new SimpleConfigList(
238238
fakeOrigin(),
@@ -413,7 +413,7 @@ class ConfigValueSharedTest extends TestUtilsShared {
413413
unresolved { dm.unwrapped }
414414

415415
// ConfigDelayedMergeObject
416-
val emptyObj = SimpleConfigObject.empty()
416+
val emptyObj = SimpleConfigObject.empty
417417
val dmo = new ConfigDelayedMergeObject(
418418
fakeOrigin(),
419419
List[AbstractConfigValue](emptyObj, subst("a"), subst("b")).asJava
@@ -728,23 +728,23 @@ class ConfigValueSharedTest extends TestUtilsShared {
728728
@Test
729729
def withValueDepth1FromEmpty(): Unit = {
730730
val v = ConfigValueFactory.fromAnyRef(42: Integer)
731-
val config = ConfigFactory.empty().withValue("a", v)
731+
val config = ConfigFactory.empty.withValue("a", v)
732732
assertEquals(parseConfig("a=42"), config)
733733
assertTrue(config.getValue("a") eq v)
734734
}
735735

736736
@Test
737737
def withValueDepth2FromEmpty(): Unit = {
738738
val v = ConfigValueFactory.fromAnyRef(42: Integer)
739-
val config = ConfigFactory.empty().withValue("a.b", v)
739+
val config = ConfigFactory.empty.withValue("a.b", v)
740740
assertEquals(parseConfig("a.b=42"), config)
741741
assertTrue(config.getValue("a.b") eq v)
742742
}
743743

744744
@Test
745745
def withValueDepth3FromEmpty(): Unit = {
746746
val v = ConfigValueFactory.fromAnyRef(42: Integer)
747-
val config = ConfigFactory.empty().withValue("a.b.c", v)
747+
val config = ConfigFactory.empty.withValue("a.b.c", v)
748748
assertEquals(parseConfig("a.b.c=42"), config)
749749
assertTrue(config.getValue("a.b.c") eq v)
750750
}
@@ -785,8 +785,7 @@ class ConfigValueSharedTest extends TestUtilsShared {
785785
val v2 = ConfigValueFactory.fromAnyRef(2: Integer)
786786
val v3 = ConfigValueFactory.fromAnyRef(3: Integer)
787787
val v4 = ConfigValueFactory.fromAnyRef(4: Integer)
788-
val config = ConfigFactory
789-
.empty()
788+
val config = ConfigFactory.empty
790789
.withValue("a", v1)
791790
.withValue("b.c", v2)
792791
.withValue("b.d", v3)
@@ -804,7 +803,7 @@ class ConfigValueSharedTest extends TestUtilsShared {
804803
SimpleConfigOrigin.newSimple("\n5\n6\n7\n"),
805804
java.util.Collections.singletonList(v.asInstanceOf[AbstractConfigValue])
806805
)
807-
val conf = ConfigFactory.empty().withValue("bar", list)
806+
val conf = ConfigFactory.empty.withValue("bar", list)
808807
val rendered = conf.root.render
809808
def assertHas(s: String): Unit =
810809
assertTrue(s"has ${s.replace("\n", "\\n")} in it", rendered.contains(s))

sconfig/shared/src/test/scala/org/ekrich/config/impl/Json4sTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class Json4sTest extends TestUtilsJson4s {
146146
// be sure we do the same thing as json parser when we build our JSON "DOM"
147147
for (valid <- whitespaceVariations(validJson, true)) {
148148
val jsonAST = if (valid.jsonBehaviorUnexpected) {
149-
SimpleConfigObject.empty()
149+
SimpleConfigObject.empty
150150
} else {
151151
addOffendingJsonToException("json", valid.test) {
152152
fromJsonWithJsonParser(valid.test)

0 commit comments

Comments
 (0)