Change ConfigFactory/SimpleConfigObject def to no paren#488
Change ConfigFactory/SimpleConfigObject def to no paren#488ekrich merged 1 commit intoekrich:mainfrom
Conversation
ekrich
left a comment
There was a problem hiding this comment.
This looks good. It may be possible that we missed other sites as well. Do you mind adding a scalafix rule for this as well?
So the ScalaFix rule is actually correct, it translated Given this I don't think there is anything that needs to be done unless I misunderstood something? |
|
I didn't think to look. Thanks. |
|
There are some pending pr in the lightbend configuration, can we have them.here? |
While working on apache/pekko#2187, as part of doing this migration I noticed that I had to change
ConfigFactory.emptytoConfigFactory.empty(). In Scala its idiomatic to have empty parens only on methods that create side effects andConfigFactor.emptyhas no side effects (its a pure value). Other parts of sconfig already do this (i.e. seeValueTypewhich is correctly missing parens) so I think that having the parens onConfigFactory/SimpleConfigObjectmay have been an oversight.This change may be source breaking (newer versions of Scala have deprecated the ability to automatically remove empty parens if the method definition has empty parens and vice versa depending on deprecation flags) but its not breaking binary compatibility in any way. The worst that users may have to experience is they would have to remove the parens from
ConfigFactory.empty()in their Scala source code when updating sconfig to a release that his this fix. Java users are entirely unaffected (in Java you always have these parens for functions, regardless of how its defined in Scala).