Formatting issue for annotated type parameter
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 66/100
Research direction
Reproduce the issue with the nested Kotlin type-parameter example by running ./gradlew spotlessApply. Trace the Kotlin formatting path that handles @Serializable annotations inside nested Pair and List types. Done means the formatter respects the line-length limit and does not introduce the unnecessary expansion shown in the report.
Written by the indexing model from the issue text.
Description
Given
internal object IntSerializer : KSerializer<Int> {
override val descriptor: SerialDescriptor
get() = PrimitiveSerialDescriptor(IntSerializer::class.qualifiedName!!, PrimitiveKind.STRING)
override fun serialize(encoder: Encoder, value: Int) {
encoder.encodeString(value.toHexString())
}
override fun deserialize(decoder: Decoder): Int = 0
}
The following expression
internal data class Foo(val bar: List<Pair<@Serializable(IntSerializer::class) Int, String>>)
after running ./gradlew spotlessApply, it is reformatted to
internal data class Foo(
val bar: List<
Pair<
@Serializable(IntSerializer::class)
Int,
String,
>,
>,
)
even though line max len is not exceeded, no matter how I split this.
- Dominant language
- Java
- Stars
- 5.7k
- Forks
- 560
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 43
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from diffplug/spotless
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
All issues in diffplug/spotless
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
elastic/gradle-plugins#157 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
cryptomator/hub#497 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
johanhaleby/occurrent#1120 ·