-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for classes to @safeConfig. #2
Conversation
val liftedTypesafeConfig = tq"com.kinja.config.LiftedTypesafeConfig" | ||
|
||
// The root element. | ||
val root = q"""lazy val root = com.kinja.config.BootupErrors(com.kinja.config.LiftedTypesafeConfig($underlying, "root"))""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the root
object can now be defined as a member of the containing class
/object
we need to make this lazy
so that it doesn't try to reference uninitialized values.
0cd6de1
to
9b9a73b
Compare
Running
|
I tried to make this work the way you described in the readme, but getting these compile errors:
(FYI The code does work without the Similarly, I experimented with the following code: import com.typesafe.config.Config
import com.kinja.config.safeConfig
@safeConfig("rawConfig")
class AppConfig(private val rawConfig: Config) {
val secret = getString("application.secret")
} And got the same errors:
|
@balagez |
Nevermind, there was some weird caching going on that allowed it to succeed. I'm looking into those errors now. |
In retrospect, I didn't correctly handle class arguments and protected members when type-checking. Fix incoming. |
b858a5a
to
d5aa6ec
Compare
@balagez Please test again. |
Works perfectly now. |
b3a5889
to
e414d8b
Compare
Add support for classes to @safeConfig.
@balagez This PR extends the
@safeConfig
macro to work onclass
es so that it can be used with Play 2.4 (in light of scalamacros/paradise#49).