Skip to content

Commit 4b8faf6

Browse files
authored
fix: build warnings part 2 (#10650)
2 parents 5f50e1b + 89f1350 commit 4b8faf6

28 files changed

Lines changed: 271 additions & 229 deletions

File tree

core/configstore/api/src/commonTest/kotlin/net/thunderbird/core/configstore/BaseConfigStoreTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ class BaseConfigStoreTest {
2929
val result = testSubject.config.first()
3030

3131
// Assert
32-
assertThat(result?.stringValue).isEqualTo(testConfig.stringValue)
33-
assertThat(result?.intValue).isEqualTo(testConfig.intValue)
32+
assertThat(result.stringValue).isEqualTo(testConfig.stringValue)
33+
assertThat(result.intValue).isEqualTo(testConfig.intValue)
3434
}
3535

3636
@Test

feature/account/setup/src/test/kotlin/app/k9mail/feature/account/setup/ui/autodiscovery/AccountAutoDiscoveryStateMapperKtTest.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,14 +204,12 @@ class AccountAutoDiscoveryStateMapperKtTest {
204204
val AUTO_DISCOVERY_STATE_USERNAME_EMPTY = AUTO_DISCOVERY_STATE.copy(
205205
autoDiscoverySettings = AUTO_DISCOVERY_STATE.autoDiscoverySettings?.copy(
206206
incomingServerSettings = (
207-
AUTO_DISCOVERY_STATE.autoDiscoverySettings
208-
?.incomingServerSettings as ImapServerSettings
207+
AUTO_DISCOVERY_STATE.autoDiscoverySettings.incomingServerSettings as ImapServerSettings
209208
).copy(
210209
username = "",
211210
),
212211
outgoingServerSettings = (
213-
AUTO_DISCOVERY_STATE.autoDiscoverySettings
214-
?.outgoingServerSettings as SmtpServerSettings
212+
AUTO_DISCOVERY_STATE.autoDiscoverySettings.outgoingServerSettings as SmtpServerSettings
215213
).copy(
216214
username = "",
217215
),

feature/mail/message/list/internal/src/test/kotlin/net/thunderbird/feature/mail/message/list/internal/domain/usecase/CreateArchiveFolderTest.kt

Lines changed: 25 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import assertk.assertions.prop
99
import com.fsck.k9.backend.api.FolderInfo
1010
import com.fsck.k9.mail.folders.FolderServerId
1111
import dev.mokkery.matcher.any
12-
import dev.mokkery.matcher.eq
1312
import dev.mokkery.spy
1413
import dev.mokkery.verify
1514
import dev.mokkery.verify.VerifyMode.Companion.exactly
@@ -158,13 +157,11 @@ class CreateArchiveFolderTest {
158157
// verify doesn't support verifying the extension function `createFolder`,
159158
// thus we verify the call of `createFolders(list)` instead.
160159
backendStorageFactory.backendFolderUpdater.createFolders(
161-
eq(
162-
listOf(
163-
FolderInfo(
164-
serverId = folderName,
165-
name = folderName,
166-
type = LegacyFolderType.ARCHIVE,
167-
),
160+
listOf(
161+
FolderInfo(
162+
serverId = folderName,
163+
name = folderName,
164+
type = LegacyFolderType.ARCHIVE,
168165
),
169166
),
170167
)
@@ -204,13 +201,11 @@ class CreateArchiveFolderTest {
204201
// verify doesn't support verifying the extension function `createFolder`,
205202
// thus we verify the call of `createFolders(list)` instead.
206203
backendStorageFactory.backendFolderUpdater.createFolders(
207-
eq(
208-
listOf(
209-
FolderInfo(
210-
serverId = folderName,
211-
name = folderName,
212-
type = LegacyFolderType.ARCHIVE,
213-
),
204+
listOf(
205+
FolderInfo(
206+
serverId = folderName,
207+
name = folderName,
208+
type = LegacyFolderType.ARCHIVE,
214209
),
215210
),
216211
)
@@ -251,13 +246,11 @@ class CreateArchiveFolderTest {
251246
// verify doesn't support verifying the extension function `createFolder`,
252247
// thus we verify the call of `createFolders(list)` instead.
253248
backendStorageFactory.backendFolderUpdater.createFolders(
254-
eq(
255-
listOf(
256-
FolderInfo(
257-
serverId = folderName,
258-
name = folderName,
259-
type = LegacyFolderType.ARCHIVE,
260-
),
249+
listOf(
250+
FolderInfo(
251+
serverId = folderName,
252+
name = folderName,
253+
type = LegacyFolderType.ARCHIVE,
261254
),
262255
),
263256
)
@@ -304,13 +297,11 @@ class CreateArchiveFolderTest {
304297
// verify doesn't support verifying the extension function `createFolder`,
305298
// thus we verify the call of `createFolders(list)` instead.
306299
backendStorageFactory.backendFolderUpdater.createFolders(
307-
eq(
308-
listOf(
309-
FolderInfo(
310-
serverId = folderName,
311-
name = folderName,
312-
type = LegacyFolderType.ARCHIVE,
313-
),
300+
listOf(
301+
FolderInfo(
302+
serverId = folderName,
303+
name = folderName,
304+
type = LegacyFolderType.ARCHIVE,
314305
),
315306
),
316307
)
@@ -363,13 +354,11 @@ class CreateArchiveFolderTest {
363354
// verify doesn't support verifying the extension function `createFolder`,
364355
// thus we verify the call of `createFolders(list)` instead.
365356
backendStorageFactory.backendFolderUpdater.createFolders(
366-
eq(
367-
listOf(
368-
FolderInfo(
369-
serverId = folderName,
370-
name = folderName,
371-
type = LegacyFolderType.ARCHIVE,
372-
),
357+
listOf(
358+
FolderInfo(
359+
serverId = folderName,
360+
name = folderName,
361+
type = LegacyFolderType.ARCHIVE,
373362
),
374363
),
375364
)

feature/mail/message/list/internal/src/test/kotlin/net/thunderbird/feature/mail/message/list/internal/domain/usecase/SetArchiveFolderTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import assertk.assertions.isEqualTo
66
import assertk.assertions.isInstanceOf
77
import assertk.assertions.prop
88
import dev.mokkery.matcher.any
9-
import dev.mokkery.matcher.matching
9+
import dev.mokkery.matcher.matches
1010
import dev.mokkery.spy
1111
import dev.mokkery.verify
1212
import dev.mokkery.verify.VerifyMode.Companion.exactly
@@ -75,7 +75,7 @@ class SetArchiveFolderTest {
7575
}
7676
verify(exactly(1)) {
7777
fakeAccountManager.saveAccount(
78-
account = matching {
78+
account = matches {
7979
it.id == AccountIdFactory.of(accountUuid)
8080
},
8181
)

feature/settings/import/src/test/kotlin/app/k9mail/feature/settings/import/ui/SettingsImportViewModelTest.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package app.k9mail.feature.settings.import.ui
33
import android.app.Application
44
import android.content.ContentResolver
55
import androidx.core.net.toUri
6-
import androidx.lifecycle.viewmodel.compose.viewModel
76
import app.k9mail.feature.settings.import.SettingsImportExternalContract.AccountActivator
87
import assertk.all
98
import assertk.assertThat
@@ -261,7 +260,7 @@ class SettingsImportViewModelTest {
261260
assertThat(uiModelLiveData.value!!.statusText).isEqualTo(StatusText.IMPORTING_PROGRESS)
262261

263262
settingsImporter.stub {
264-
onBlocking { importSettings(inputStream, false, listOf("uuid-1")) } doReturn ImportResults(
263+
on { importSettings(inputStream, false, listOf("uuid-1")) } doReturn ImportResults(
265264
globalSettings = false,
266265
importedAccounts = listOf(
267266
AccountDescriptionPair(

feature/widget/unread/src/test/kotlin/app/k9mail/feature/widget/unread/UnreadWidgetDataProviderTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ class UnreadWidgetDataProviderTest : AutoCloseKoinTest() {
160160

161161
private fun createFolderRepository(): FolderRepository {
162162
return mock {
163-
onBlocking { getFolder(account.id, FOLDER_ID) } doReturn FOLDER
163+
on { getFolder(account.id, FOLDER_ID) } doReturn FOLDER
164164
}
165165
}
166166

legacy/core/src/main/java/com/fsck/k9/LocalKeyStoreManager.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class LocalKeyStoreManager(
1919
} else {
2020
account.outgoingServerSettings
2121
}
22-
localKeyStore.addCertificate(serverSettings.host!!, serverSettings.port, certificate)
22+
localKeyStore.addCertificate(serverSettings.host, serverSettings.port, certificate)
2323
}
2424

2525
/**
@@ -33,7 +33,7 @@ class LocalKeyStoreManager(
3333
} else {
3434
account.outgoingServerSettings
3535
}
36-
val oldHost = serverSettings.host!!
36+
val oldHost = serverSettings.host
3737
val oldPort = serverSettings.port
3838
if (oldPort == -1) {
3939
// This occurs when a new account is created
@@ -50,11 +50,11 @@ class LocalKeyStoreManager(
5050
*/
5151
fun deleteCertificates(account: LegacyAccountDto) {
5252
account.incomingServerSettings.let { serverSettings ->
53-
localKeyStore.deleteCertificate(serverSettings.host!!, serverSettings.port)
53+
localKeyStore.deleteCertificate(serverSettings.host, serverSettings.port)
5454
}
5555

5656
account.outgoingServerSettings.let { serverSettings ->
57-
localKeyStore.deleteCertificate(serverSettings.host!!, serverSettings.port)
57+
localKeyStore.deleteCertificate(serverSettings.host, serverSettings.port)
5858
}
5959
}
6060
}

legacy/core/src/main/java/com/fsck/k9/controller/PendingCommandSerializer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ public static PendingCommandSerializer getInstance() {
5555

5656

5757
public <T extends PendingCommand> String serialize(T command) {
58-
// noinspection unchecked, we know the map has correctly matching adapters
58+
@SuppressWarnings("unchecked")
59+
// we know the map has correctly matching adapters
5960
JsonAdapter<T> adapter = (JsonAdapter<T>) adapters.get(command.getCommandName());
6061
if (adapter == null) {
6162
throw new IllegalArgumentException("Unsupported pending command type!");

legacy/core/src/main/java/com/fsck/k9/message/quote/TextQuoteCreator.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class TextQuoteCreator(
9393
}
9494
}
9595

96-
private fun Array<Address>.displayString() = Address.toString(this)?.let { if (it.isEmpty()) null else it }
96+
private fun Array<Address>.displayString() = Address.toString(this).let { it.ifEmpty { null } }
9797

9898
companion object {
9999
private const val CRLF = "\r\n"

legacy/core/src/main/java/com/fsck/k9/preferences/Settings.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import com.fsck.k9.FontSizes;
1212
import com.fsck.k9.K9;
1313
import net.thunderbird.core.logging.legacy.Log;
14+
import net.thunderbird.core.preference.storage.Storage;
1415
import net.thunderbird.core.preference.storage.StorageEditor;
1516

1617
/*
@@ -117,7 +118,7 @@ public static Map<String, String> convert(Map<String, Object> settings,
117118
TreeMap<Integer, SettingsDescription<?>> versionedSetting = settingDescriptions.get(settingName);
118119
Integer highestVersion = versionedSetting.lastKey();
119120

120-
//noinspection unchecked
121+
@SuppressWarnings("unchecked")
121122
SettingsDescription<Object> settingDesc =
122123
(SettingsDescription<Object>) versionedSetting.get(highestVersion);
123124

0 commit comments

Comments
 (0)