-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Support nullable collections based on 'allowNullableCollections' and 'interpretNotNulls' options * nit & typos * Emit warning if allowNullableCollections is used in combination with non-specialized collections --------- Co-authored-by: Dominik Hoftych <[email protected]>
- Loading branch information
Showing
7 changed files
with
349 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...st/src/main/java/io/soabase/recordbuilder/test/NonspecializedNullabeCollectionRecord.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright 2019 The original author or authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.soabase.recordbuilder.test; | ||
|
||
import io.soabase.recordbuilder.core.RecordBuilder; | ||
|
||
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
/** | ||
* To test that the compilation warning is emitted for this combination of options | ||
*/ | ||
@RecordBuilder | ||
@RecordBuilder.Options(useImmutableCollections = false, useUnmodifiableCollections = false, allowNullableCollections = true) | ||
public record NonspecializedNullabeCollectionRecord<T, X extends Point>(List<T> l, Set<T> s, Map<T, X> m, | ||
Collection<X> c) implements CollectionRecordBuilder.With<T, X> { | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
...rd-builder-test/src/main/java/io/soabase/recordbuilder/test/NullableCollectionRecord.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright 2019 The original author or authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.soabase.recordbuilder.test; | ||
|
||
import io.soabase.recordbuilder.core.RecordBuilder; | ||
|
||
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
@RecordBuilder | ||
@RecordBuilder.Options(useImmutableCollections = true, allowNullableCollections = true) | ||
public record NullableCollectionRecord<T, X extends Point>(List<T> l, Set<T> s, Map<T, X> m, Collection<X> c) | ||
implements CollectionRecordBuilder.With<T, X> { | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
...main/java/io/soabase/recordbuilder/test/NullableCollectionRecordInterpretingNotNulls.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright 2019 The original author or authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.soabase.recordbuilder.test; | ||
|
||
import io.soabase.recordbuilder.core.RecordBuilder; | ||
|
||
import javax.validation.constraints.NotNull; | ||
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
@RecordBuilder | ||
@RecordBuilder.Options(useImmutableCollections = true, allowNullableCollections = true, interpretNotNulls = true) | ||
public record NullableCollectionRecordInterpretingNotNulls<T, X extends Point>(@NotNull List<T> l, Set<T> s, | ||
Map<T, X> m, @NotNull Collection<X> c) implements CollectionRecordBuilder.With<T, X> { | ||
|
||
} |
Oops, something went wrong.