Skip to content

Instantly share code, notes, and snippets.

@mezentsev
Last active November 17, 2019 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mezentsev/db3785d0a4fc8af1f70198364ae68b65 to your computer and use it in GitHub Desktop.
Save mezentsev/db3785d0a4fc8af1f70198364ae68b65 to your computer and use it in GitHub Desktop.
object Lib {
private val instance: LibInternal by lazy {
LibInternal()
}
fun init(buider: Builder) = instance.init(builder)
internal class LibInternal : Lib {
private var inited: Boolean
@Synchronized
override fun init(builder: Builder) {
if (inited) throw IllegalStateException("Already inited")
inited = true
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment