Skip to content

Commit

Permalink
Prefer explicit constructor declarations without default parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffdgr8 committed Nov 15, 2023
1 parent 0978461 commit 80e4185
Show file tree
Hide file tree
Showing 17 changed files with 68 additions and 31 deletions.
14 changes: 9 additions & 5 deletions couchbase-lite-ee/api/android/couchbase-lite-ee.api
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,8 @@ public final class kotbase/DatabaseChange : kotbase/internal/DelegatedClass {
}

public final class kotbase/DatabaseConfiguration : kotbase/internal/DelegatedClass {
public fun <init> ()V
public fun <init> (Lkotbase/DatabaseConfiguration;)V
public synthetic fun <init> (Lkotbase/DatabaseConfiguration;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getDirectory ()Ljava/lang/String;
public final fun setDirectory (Ljava/lang/String;)Lkotbase/DatabaseConfiguration;
public final fun setDirectory (Ljava/lang/String;)V
Expand Down Expand Up @@ -1052,8 +1052,8 @@ public final class kotbase/Ordering$SortOrder : kotbase/Ordering {
}

public final class kotbase/Parameters : kotbase/internal/DelegatedClass {
public fun <init> ()V
public fun <init> (Lkotbase/Parameters;)V
public synthetic fun <init> (Lkotbase/Parameters;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getValue (Ljava/lang/String;)Ljava/lang/Object;
public final fun setArray (Ljava/lang/String;Lkotbase/Array;)Lkotbase/Parameters;
public final fun setBlob (Ljava/lang/String;Lkotbase/Blob;)Lkotbase/Parameters;
Expand Down Expand Up @@ -1336,8 +1336,8 @@ public final class kotbase/SelectResult$From : kotbase/SelectResult {
}

public final class kotbase/SessionAuthenticator : kotbase/Authenticator {
public fun <init> (Ljava/lang/String;)V
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public synthetic fun getActual$couchbase_lite_ee_release ()Ljava/lang/Object;
public final fun getCookieName ()Ljava/lang/String;
public final fun getSessionID ()Ljava/lang/String;
Expand Down Expand Up @@ -1392,6 +1392,7 @@ public final class kotbase/URLEndpointListener : kotbase/internal/DelegatedClass
}

public final class kotbase/URLEndpointListenerConfiguration : kotbase/internal/DelegatedClass {
public static final field Companion Lkotbase/URLEndpointListenerConfiguration$Companion;
public fun <init> (Lkotbase/Database;Ljava/lang/String;IZLkotbase/TLSIdentity;Lkotbase/ListenerAuthenticator;ZZ)V
public synthetic fun <init> (Lkotbase/Database;Ljava/lang/String;IZLkotbase/TLSIdentity;Lkotbase/ListenerAuthenticator;ZZILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Lkotbase/URLEndpointListenerConfiguration;)V
Expand All @@ -1412,9 +1413,12 @@ public final class kotbase/URLEndpointListenerConfiguration : kotbase/internal/D
public final fun setTlsIdentity (Lkotbase/TLSIdentity;)V
}

public final class kotbase/URLEndpointListenerConfiguration$Companion {
}

public final class kotbase/URLEndpointListenerConfigurationKt {
public static final fun getMAX_PORT (Lkotbase/URLEndpointListenerConfiguration;)I
public static final fun getMIN_PORT (Lkotbase/URLEndpointListenerConfiguration;)I
public static final fun getMAX_PORT (Lkotbase/URLEndpointListenerConfiguration$Companion;)I
public static final fun getMIN_PORT (Lkotbase/URLEndpointListenerConfiguration$Companion;)I
}

public final class kotbase/ValueIndex : kotbase/Index {
Expand Down
14 changes: 9 additions & 5 deletions couchbase-lite-ee/api/jvm/couchbase-lite-ee.api
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,8 @@ public final class kotbase/DatabaseChange : kotbase/internal/DelegatedClass {
}

public final class kotbase/DatabaseConfiguration : kotbase/internal/DelegatedClass {
public fun <init> ()V
public fun <init> (Lkotbase/DatabaseConfiguration;)V
public synthetic fun <init> (Lkotbase/DatabaseConfiguration;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getDirectory ()Ljava/lang/String;
public final fun setDirectory (Ljava/lang/String;)Lkotbase/DatabaseConfiguration;
public final fun setDirectory (Ljava/lang/String;)V
Expand Down Expand Up @@ -1047,8 +1047,8 @@ public final class kotbase/Ordering$SortOrder : kotbase/Ordering {
}

public final class kotbase/Parameters : kotbase/internal/DelegatedClass {
public fun <init> ()V
public fun <init> (Lkotbase/Parameters;)V
public synthetic fun <init> (Lkotbase/Parameters;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getValue (Ljava/lang/String;)Ljava/lang/Object;
public final fun setArray (Ljava/lang/String;Lkotbase/Array;)Lkotbase/Parameters;
public final fun setBlob (Ljava/lang/String;Lkotbase/Blob;)Lkotbase/Parameters;
Expand Down Expand Up @@ -1331,8 +1331,8 @@ public final class kotbase/SelectResult$From : kotbase/SelectResult {
}

public final class kotbase/SessionAuthenticator : kotbase/Authenticator {
public fun <init> (Ljava/lang/String;)V
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public synthetic fun getActual$couchbase_lite_ee ()Ljava/lang/Object;
public final fun getCookieName ()Ljava/lang/String;
public final fun getSessionID ()Ljava/lang/String;
Expand Down Expand Up @@ -1391,6 +1391,7 @@ public final class kotbase/URLEndpointListener : kotbase/internal/DelegatedClass
}

public final class kotbase/URLEndpointListenerConfiguration : kotbase/internal/DelegatedClass {
public static final field Companion Lkotbase/URLEndpointListenerConfiguration$Companion;
public fun <init> (Lkotbase/Database;Ljava/lang/String;IZLkotbase/TLSIdentity;Lkotbase/ListenerAuthenticator;ZZ)V
public synthetic fun <init> (Lkotbase/Database;Ljava/lang/String;IZLkotbase/TLSIdentity;Lkotbase/ListenerAuthenticator;ZZILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Lkotbase/URLEndpointListenerConfiguration;)V
Expand All @@ -1411,9 +1412,12 @@ public final class kotbase/URLEndpointListenerConfiguration : kotbase/internal/D
public final fun setTlsIdentity (Lkotbase/TLSIdentity;)V
}

public final class kotbase/URLEndpointListenerConfiguration$Companion {
}

public final class kotbase/URLEndpointListenerConfigurationKt {
public static final fun getMAX_PORT (Lkotbase/URLEndpointListenerConfiguration;)I
public static final fun getMIN_PORT (Lkotbase/URLEndpointListenerConfiguration;)I
public static final fun getMAX_PORT (Lkotbase/URLEndpointListenerConfiguration$Companion;)I
public static final fun getMIN_PORT (Lkotbase/URLEndpointListenerConfiguration$Companion;)I
}

public final class kotbase/ValueIndex : kotbase/Index {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,3 @@ public fun DatabaseConfiguration.setEncryptionKey(encryptionKey: EncryptionKey?)
* A key to encrypt the database with.
*/
public expect var DatabaseConfiguration.encryptionKey: EncryptionKey?

// TODO: provide update EE KTX creator function
6 changes: 3 additions & 3 deletions couchbase-lite/api/android/couchbase-lite.api
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ public final class kotbase/DatabaseChange : kotbase/internal/DelegatedClass {
}

public final class kotbase/DatabaseConfiguration : kotbase/internal/DelegatedClass {
public fun <init> ()V
public fun <init> (Lkotbase/DatabaseConfiguration;)V
public synthetic fun <init> (Lkotbase/DatabaseConfiguration;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getDirectory ()Ljava/lang/String;
public final fun setDirectory (Ljava/lang/String;)Lkotbase/DatabaseConfiguration;
public final fun setDirectory (Ljava/lang/String;)V
Expand Down Expand Up @@ -920,8 +920,8 @@ public final class kotbase/Ordering$SortOrder : kotbase/Ordering {
}

public final class kotbase/Parameters : kotbase/internal/DelegatedClass {
public fun <init> ()V
public fun <init> (Lkotbase/Parameters;)V
public synthetic fun <init> (Lkotbase/Parameters;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getValue (Ljava/lang/String;)Ljava/lang/Object;
public final fun setArray (Ljava/lang/String;Lkotbase/Array;)Lkotbase/Parameters;
public final fun setBlob (Ljava/lang/String;Lkotbase/Blob;)Lkotbase/Parameters;
Expand Down Expand Up @@ -1169,8 +1169,8 @@ public final class kotbase/SelectResult$From : kotbase/SelectResult {
}

public final class kotbase/SessionAuthenticator : kotbase/Authenticator {
public fun <init> (Ljava/lang/String;)V
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public synthetic fun getActual$couchbase_lite_release ()Ljava/lang/Object;
public final fun getCookieName ()Ljava/lang/String;
public final fun getSessionID ()Ljava/lang/String;
Expand Down
6 changes: 3 additions & 3 deletions couchbase-lite/api/jvm/couchbase-lite.api
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ public final class kotbase/DatabaseChange : kotbase/internal/DelegatedClass {
}

public final class kotbase/DatabaseConfiguration : kotbase/internal/DelegatedClass {
public fun <init> ()V
public fun <init> (Lkotbase/DatabaseConfiguration;)V
public synthetic fun <init> (Lkotbase/DatabaseConfiguration;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getDirectory ()Ljava/lang/String;
public final fun setDirectory (Ljava/lang/String;)Lkotbase/DatabaseConfiguration;
public final fun setDirectory (Ljava/lang/String;)V
Expand Down Expand Up @@ -920,8 +920,8 @@ public final class kotbase/Ordering$SortOrder : kotbase/Ordering {
}

public final class kotbase/Parameters : kotbase/internal/DelegatedClass {
public fun <init> ()V
public fun <init> (Lkotbase/Parameters;)V
public synthetic fun <init> (Lkotbase/Parameters;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getValue (Ljava/lang/String;)Ljava/lang/Object;
public final fun setArray (Ljava/lang/String;Lkotbase/Array;)Lkotbase/Parameters;
public final fun setBlob (Ljava/lang/String;Lkotbase/Blob;)Lkotbase/Parameters;
Expand Down Expand Up @@ -1169,8 +1169,8 @@ public final class kotbase/SelectResult$From : kotbase/SelectResult {
}

public final class kotbase/SessionAuthenticator : kotbase/Authenticator {
public fun <init> (Ljava/lang/String;)V
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public synthetic fun getActual$couchbase_lite ()Ljava/lang/Object;
public final fun getCookieName ()Ljava/lang/String;
public final fun getSessionID ()Ljava/lang/String;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import kotbase.internal.DelegatedClass
public actual class DatabaseConfiguration
internal constructor(actual: CBLDatabaseConfiguration) : DelegatedClass<CBLDatabaseConfiguration>(actual) {

public actual constructor() : this(CBLDatabaseConfiguration())

public actual constructor(config: DatabaseConfiguration?) : this(
CBLDatabaseConfiguration(config?.actual)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import platform.Foundation.NSNumber
public actual class Parameters
internal constructor(actual: CBLQueryParameters) : DelegatedClass<CBLQueryParameters>(actual) {

public actual constructor() : this(CBLQueryParameters())

public actual constructor(parameters: Parameters?) : this(
CBLQueryParameters(parameters?.actual)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ internal constructor(
override val actual: CBLSessionAuthenticator
) : Authenticator(actual) {

public actual constructor(sessionID: String) : this(CBLSessionAuthenticator(sessionID))

public actual constructor(sessionID: String, cookieName: String?) : this(
CBLSessionAuthenticator(sessionID, cookieName)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ package kotbase
/**
* Configuration for opening a database.
*/
public expect class DatabaseConfiguration(
config: DatabaseConfiguration? = null
) {
public expect class DatabaseConfiguration {

public constructor()

public constructor(config: DatabaseConfiguration?)

/**
* Set the canonical path of the directory to store the database in.
Expand Down
6 changes: 5 additions & 1 deletion couchbase-lite/src/commonMain/kotlin/kotbase/Parameters.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ import kotlinx.datetime.Instant
/**
* A Parameters object used for setting values to the query parameters defined in the query.
*/
public expect class Parameters(parameters: Parameters? = null) {
public expect class Parameters {

public constructor()

public constructor(parameters: Parameters?)

/**
* Gets a parameter's value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,23 @@ package kotbase
* SessionAuthenticator class is an authenticator that will authenticate by using the session ID of
* the session created by a Sync Gateway
*/
public expect class SessionAuthenticator
public expect class SessionAuthenticator : Authenticator {

/**
* Initializes with the session ID and the cookie name. If the given cookieName
* is null, the default cookie name will be used.
*
* @param sessionID Sync Gateway session ID
* @param cookieName The cookie name
*/
constructor(sessionID: String, cookieName: String? = null) : Authenticator {
/**
* Initializes with the Sync Gateway session ID and uses the default cookie name.
*
* @param sessionID Sync Gateway session ID
*/
public constructor(sessionID: String)

/**
* Initializes with the session ID and the cookie name. If the given cookieName
* is null, the default cookie name will be used.
*
* @param sessionID Sync Gateway session ID
* @param cookieName The cookie name
*/
public constructor(sessionID: String, cookieName: String?)

/**
* Return session ID of the session created by a Sync Gateway.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import com.couchbase.lite.DatabaseConfiguration as CBLDatabaseConfiguration
public actual class DatabaseConfiguration
internal constructor(actual: CBLDatabaseConfiguration) : DelegatedClass<CBLDatabaseConfiguration>(actual) {

public actual constructor() : this(CBLDatabaseConfiguration())

public actual constructor(config: DatabaseConfiguration?) : this(CBLDatabaseConfiguration(config?.actual))

public actual fun setDirectory(directory: String): DatabaseConfiguration {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import com.couchbase.lite.Parameters as CBLParameters
public actual class Parameters
internal constructor(actual: CBLParameters) : DelegatedClass<CBLParameters>(actual) {

public actual constructor() : this(CBLParameters())

public actual constructor(parameters: Parameters?) : this(CBLParameters(parameters?.actual))

public actual fun getValue(name: String): Any? =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ internal constructor(
override val actual: CBLSessionAuthenticator
) : Authenticator(actual) {

public actual constructor(sessionID: String) : this(CBLSessionAuthenticator(sessionID))

public actual constructor(sessionID: String, cookieName: String?) : this(
CBLSessionAuthenticator(sessionID, cookieName)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import kotlin.native.ref.createCleaner
public actual class DatabaseConfiguration
public actual constructor(config: DatabaseConfiguration?) {

public actual constructor() : this(null)

private val arena = Arena()

internal val actual: CPointer<CBLDatabaseConfiguration> =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ internal constructor(
FLDict_Release(it)
}

public actual constructor() : this(null)

public actual constructor(parameters: Parameters?) : this(
if (parameters != null) {
FLDict_MutableCopy(parameters.actual, kFLDefaultCopy)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ private constructor(
actual: CPointer<CBLAuthenticator>
) : Authenticator(actual) {

public actual constructor(sessionID: String) : this(sessionID, null)

public actual constructor(sessionID: String, cookieName: String?) : this(
sessionID,
cookieName ?: DEFAULT_SYNC_GATEWAY_SESSION_ID_NAME,
Expand Down

0 comments on commit 80e4185

Please sign in to comment.