Skip to content

Commit 0f44b67

Browse files
committed
Fix lint + Kotlin compiler warnings
1 parent fd9987d commit 0f44b67

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

sentry-compose/src/androidMain/kotlin/io/sentry/compose/SentryComposeHelper.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import io.sentry.ILogger
1212
import io.sentry.SentryLevel
1313
import java.lang.reflect.Field
1414

15-
internal class SentryComposeHelper(private val logger: ILogger) {
15+
internal class SentryComposeHelper(logger: ILogger) {
1616

1717
private val testTagElementField: Field? =
1818
loadField(logger, "androidx.compose.ui.platform.TestTagElement", "tag")
@@ -131,7 +131,7 @@ public fun LayoutCoordinates.boundsInWindow(rootCoordinates: LayoutCoordinates?)
131131
* `kotlin.comparisons.minOf()` for 4 arguments as it avoids allocating an array because of the
132132
* varargs.
133133
*/
134-
private inline fun fastMinOf(a: Float, b: Float, c: Float, d: Float): Float {
134+
private fun fastMinOf(a: Float, b: Float, c: Float, d: Float): Float {
135135
return minOf(a, minOf(b, minOf(c, d)))
136136
}
137137

@@ -140,7 +140,7 @@ private inline fun fastMinOf(a: Float, b: Float, c: Float, d: Float): Float {
140140
* `kotlin.comparisons.maxOf()` for 4 arguments as it avoids allocating an array because of the
141141
* varargs.
142142
*/
143-
private inline fun fastMaxOf(a: Float, b: Float, c: Float, d: Float): Float {
143+
private fun fastMaxOf(a: Float, b: Float, c: Float, d: Float): Float {
144144
return maxOf(a, maxOf(b, maxOf(c, d)))
145145
}
146146

@@ -149,15 +149,15 @@ private inline fun fastMaxOf(a: Float, b: Float, c: Float, d: Float): Float {
149149
* [maximumValue]. Unlike [Float.coerceIn], the range is not validated: the caller must ensure that
150150
* [minimumValue] is less than [maximumValue].
151151
*/
152-
private inline fun Float.fastCoerceIn(minimumValue: Float, maximumValue: Float) =
152+
private fun Float.fastCoerceIn(minimumValue: Float, maximumValue: Float) =
153153
this.fastCoerceAtLeast(minimumValue).fastCoerceAtMost(maximumValue)
154154

155155
/** Ensures that this value is not less than the specified [minimumValue]. */
156-
private inline fun Float.fastCoerceAtLeast(minimumValue: Float): Float {
156+
private fun Float.fastCoerceAtLeast(minimumValue: Float): Float {
157157
return if (this < minimumValue) minimumValue else this
158158
}
159159

160160
/** Ensures that this value is not greater than the specified [maximumValue]. */
161-
private inline fun Float.fastCoerceAtMost(maximumValue: Float): Float {
161+
private fun Float.fastCoerceAtMost(maximumValue: Float): Float {
162162
return if (this > maximumValue) maximumValue else this
163163
}

sentry-compose/src/androidMain/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocator.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
package io.sentry.compose.gestures
44

5+
import androidx.compose.ui.InternalComposeUiApi
56
import androidx.compose.ui.geometry.Offset
67
import androidx.compose.ui.node.LayoutNode
78
import androidx.compose.ui.node.Owner
@@ -17,6 +18,7 @@ import io.sentry.util.AutoClosableReentrantLock
1718
import java.util.LinkedList
1819
import java.util.Queue
1920

21+
@OptIn(InternalComposeUiApi::class)
2022
public class ComposeGestureTargetLocator(private val logger: ILogger) : GestureTargetLocator {
2123
@Volatile
2224
private var composeHelper: SentryComposeHelper? = null

sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/viewhierarchy/ComposeViewHierarchyExporterTest.kt

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import io.sentry.protocol.ViewHierarchyNode
1717
import org.junit.Assert
1818
import org.junit.Test
1919
import org.mockito.Mockito
20-
import org.mockito.Mockito.`when`
2120
import org.mockito.kotlin.any
21+
import org.mockito.kotlin.mock
2222
import org.mockito.kotlin.whenever
2323

2424
class ComposeViewHierarchyExporterTest {
@@ -31,10 +31,8 @@ class ComposeViewHierarchyExporterTest {
3131
val childC = mockLayoutNode(false, null, 10, 20)
3232
val parent = mockLayoutNode(true, "root", 30, 40, listOf(childA, childB, childC))
3333

34-
val node = Mockito.mock(
35-
Owner::class.java
36-
)
37-
`when`(node.root).thenReturn(parent)
34+
val node = mock<Owner>()
35+
whenever(node.root).thenReturn(parent)
3836

3937
val exporter: ViewHierarchyExporter =
4038
ComposeViewHierarchyExporter(NoOpLogger.getInstance())
@@ -71,12 +69,12 @@ class ComposeViewHierarchyExporterTest {
7169
val nodeA = Mockito.mock(
7270
LayoutNode::class.java
7371
)
74-
`when`(nodeA.isPlaced).thenReturn(isPlaced)
72+
whenever(nodeA.isPlaced).thenReturn(isPlaced)
7573

7674
val modifierInfo = Mockito.mock(
7775
ModifierInfo::class.java
7876
)
79-
`when`(modifierInfo.modifier)
77+
whenever(modifierInfo.modifier)
8078
.thenReturn(
8179
object : SemanticsModifier {
8280
override val semanticsConfiguration: SemanticsConfiguration
@@ -94,9 +92,9 @@ class ComposeViewHierarchyExporterTest {
9492
)
9593
val modifierInfoList: MutableList<ModifierInfo> = ArrayList()
9694
modifierInfoList.add(modifierInfo)
97-
`when`((nodeA.getModifierInfo())).thenReturn(modifierInfoList)
95+
whenever((nodeA.getModifierInfo())).thenReturn(modifierInfoList)
9896

99-
`when`((nodeA.zSortedChildren))
97+
whenever((nodeA.zSortedChildren))
10098
.thenReturn(mutableVectorOf<LayoutNode>().apply { addAll(children) })
10199

102100
val coordinates = Mockito.mock(
@@ -108,7 +106,7 @@ class ComposeViewHierarchyExporterTest {
108106
whenever(coordinates.parentLayoutCoordinates).thenReturn(parentCoordinates)
109107
whenever(parentCoordinates.localBoundingBoxOf(any(), any()))
110108
.thenReturn(Rect(0f, 0f, width.toFloat(), height.toFloat()))
111-
`when`(nodeA.coordinates).thenReturn(coordinates)
109+
whenever(nodeA.coordinates).thenReturn(coordinates)
112110
return nodeA
113111
}
114112
}

0 commit comments

Comments
 (0)