[Lombok] Fix behavior of ignoreNullCollections parameter of @Singular
^KT-53724 Fixed ^KT-53721 Fixed
This commit is contained in:
committed by
teamcity
parent
2aadaee69f
commit
4ab79ed97d
@@ -10,6 +10,7 @@ import lombok.Singular;
|
||||
@Data
|
||||
public class User {
|
||||
@Singular private java.util.List<String> names;
|
||||
@Singular private java.util.Map<Integer, Integer> pairs;
|
||||
}
|
||||
|
||||
// FILE: UserWithoutNull.java
|
||||
@@ -21,6 +22,7 @@ import lombok.Singular;
|
||||
@Data
|
||||
public class UserWithoutNull {
|
||||
@Singular(ignoreNullCollections = false) private java.util.List<String> names;
|
||||
@Singular(ignoreNullCollections = false) private java.util.Map<Integer, Integer> pairs;
|
||||
}
|
||||
|
||||
// FILE: UserWithNull.java
|
||||
@@ -32,19 +34,54 @@ import lombok.Singular;
|
||||
@Data
|
||||
public class UserWithNull {
|
||||
@Singular(ignoreNullCollections = true) private java.util.List<String> names;
|
||||
@Singular(ignoreNullCollections = true) private java.util.Map<Integer, Integer> pairs;
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
fun test() {
|
||||
fun test_1() {
|
||||
User.builder()
|
||||
.name("User")
|
||||
.name(<!NULL_FOR_NONNULL_TYPE!>null<!>) // error
|
||||
.name(null)
|
||||
.names(listOf("other"))
|
||||
.names(listOf(null))
|
||||
.names(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
.pair(null, 1)
|
||||
.pair(1, null)
|
||||
.pairs(mapOf(1 to 1))
|
||||
.pairs(mapOf(null to 1))
|
||||
.pairs(mapOf(1 to null))
|
||||
.pairs(mapOf(null to null))
|
||||
.pairs(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
}
|
||||
|
||||
fun test_2() {
|
||||
UserWithoutNull.builder()
|
||||
.name("User")
|
||||
.name(<!NULL_FOR_NONNULL_TYPE!>null<!>) // error
|
||||
.name(null)
|
||||
.names(listOf("other"))
|
||||
.names(listOf(null))
|
||||
.names(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
.pair(null, 1)
|
||||
.pair(1, null)
|
||||
.pairs(mapOf(1 to 1))
|
||||
.pairs(mapOf(null to 1))
|
||||
.pairs(mapOf(1 to null))
|
||||
.pairs(mapOf(null to null))
|
||||
.pairs(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
}
|
||||
|
||||
fun test_3() {
|
||||
UserWithNull.builder()
|
||||
.name("User")
|
||||
.name(null) // ok
|
||||
.name(null)
|
||||
.names(listOf("other"))
|
||||
.names(listOf(null))
|
||||
.names(null)
|
||||
.pair(null, 1)
|
||||
.pair(1, null)
|
||||
.pairs(mapOf(1 to 1))
|
||||
.pairs(mapOf(null to 1))
|
||||
.pairs(mapOf(1 to null))
|
||||
.pairs(mapOf(null to null))
|
||||
.pairs(null)
|
||||
}
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ T> assertEquals(/*0*/ a: T, /*1*/ b: T): kotlin.Unit
|
||||
public fun test(): kotlin.Unit
|
||||
public fun test_1(): kotlin.Unit
|
||||
public fun test_2(): kotlin.Unit
|
||||
public fun test_3(): kotlin.Unit
|
||||
|
||||
@lombok.Builder @lombok.Data public open class User {
|
||||
public constructor User()
|
||||
@lombok.Singular private final var names: kotlin.collections.(Mutable)List<kotlin.String!>!
|
||||
@lombok.Singular private final var pairs: kotlin.collections.(Mutable)Map<kotlin.Int!, kotlin.Int!>!
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open /*synthesized*/ fun getNames(): kotlin.collections.(Mutable)List<kotlin.String!>!
|
||||
public open /*synthesized*/ fun getPairs(): kotlin.collections.(Mutable)Map<kotlin.Int!, kotlin.Int!>!
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open /*synthesized*/ fun setNames(/*0*/ names: kotlin.collections.(Mutable)List<kotlin.String!>!): kotlin.Unit
|
||||
public open /*synthesized*/ fun setPairs(/*0*/ pairs: kotlin.collections.(Mutable)Map<kotlin.Int!, kotlin.Int!>!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
// Static members
|
||||
@@ -19,10 +24,13 @@ public fun test(): kotlin.Unit
|
||||
@lombok.Builder @lombok.Data public open class UserWithNull {
|
||||
public constructor UserWithNull()
|
||||
@lombok.Singular(ignoreNullCollections = true) private final var names: kotlin.collections.(Mutable)List<kotlin.String!>!
|
||||
@lombok.Singular(ignoreNullCollections = true) private final var pairs: kotlin.collections.(Mutable)Map<kotlin.Int!, kotlin.Int!>!
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open /*synthesized*/ fun getNames(): kotlin.collections.(Mutable)List<kotlin.String!>!
|
||||
public open /*synthesized*/ fun getPairs(): kotlin.collections.(Mutable)Map<kotlin.Int!, kotlin.Int!>!
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open /*synthesized*/ fun setNames(/*0*/ names: kotlin.collections.(Mutable)List<kotlin.String!>!): kotlin.Unit
|
||||
public open /*synthesized*/ fun setPairs(/*0*/ pairs: kotlin.collections.(Mutable)Map<kotlin.Int!, kotlin.Int!>!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
// Static members
|
||||
@@ -32,12 +40,16 @@ public fun test(): kotlin.Unit
|
||||
@lombok.Builder @lombok.Data public open class UserWithoutNull {
|
||||
public constructor UserWithoutNull()
|
||||
@lombok.Singular(ignoreNullCollections = false) private final var names: kotlin.collections.(Mutable)List<kotlin.String!>!
|
||||
@lombok.Singular(ignoreNullCollections = false) private final var pairs: kotlin.collections.(Mutable)Map<kotlin.Int!, kotlin.Int!>!
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open /*synthesized*/ fun getNames(): kotlin.collections.(Mutable)List<kotlin.String!>!
|
||||
public open /*synthesized*/ fun getPairs(): kotlin.collections.(Mutable)Map<kotlin.Int!, kotlin.Int!>!
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open /*synthesized*/ fun setNames(/*0*/ names: kotlin.collections.(Mutable)List<kotlin.String!>!): kotlin.Unit
|
||||
public open /*synthesized*/ fun setPairs(/*0*/ pairs: kotlin.collections.(Mutable)Map<kotlin.Int!, kotlin.Int!>!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ fun builder(): UserWithoutNull.UserWithoutNullBuilder
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user