JakeWharton / JakeWharton/timber

TimberArgTypes: wrong detection of measureTimeMillis() return type in Kotlin 1.5

Open
#412 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
10.9k
Forks
994
Avg merge
17h 16m
Merged PRs (30d)
17

Description

After updating to Kotlin 1.5 we receive this lint error, but actually being a false positive.
```
Error: Wrong argument type for formatting argument '#1' in connectingPlaces() took %d ms: conversion is 'd', received Object (argument #2 in method call) [TimberArgTypes]
Timber.d("connectingPlaces() took %d ms", connectingPlaces)
```

Relevant code:
```kotlin
val connectingPlaces = measureTimeMillis {
// ...
}
Timber.d("connectingPlaces() took %d ms", connectingPlaces)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the TimberArgTypes lint error with the Kotlin 1.5 measureTimeMillis example, then inspect the detector's handling of that return type. Done means the valid %d argument is recognized without a false positive while other formatting checks remain intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.