Files
kotlin-fork/plugins/lombok/testData/box/withBooleanField.kt
T
Dmitriy Novozhilov 70da19bd22 [Lombok K2] Fix name convention for @With on boolean fields
^KT-53451 Fixed
^KT-53370
2022-08-03 13:46:24 +03:00

42 lines
937 B
Kotlin
Vendored

// ISSUE: KT-53451, KT-53370
// FILE: UserData.java
import lombok.*;
public class UserData {
@With @Getter
private final String name;
@With @Getter
private final boolean isSome;
@With @Getter
private final boolean hasFlag;
@With @Getter
private final boolean justAnother;
public UserData(String name, boolean isSome, boolean hasFlag, boolean justAnother) {
this.name = name;
this.isSome = isSome;
this.hasFlag = hasFlag;
this.justAnother = justAnother;
}
}
// FILE: main.kt
fun box(): String {
val user = UserData("Bob", false, false, false)
val modifiedUser = user
.withName("Alex")
.withSome(true)
.withHasFlag(true)
.withJustAnother(true)
return if (modifiedUser.name == "Alex" && modifiedUser.isSome && modifiedUser.isHasFlag && modifiedUser.isJustAnother) {
"OK"
} else {
"Error"
}
}