generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For Kotlin this should exactly match the language semantics. For Java types are not considered Optional unless they are wrapped in a java.util.Optional, or annotated with @nullable. The exception to this are the boxed primitive types, which are always considered nullable. fixes: #2356
- Loading branch information
1 parent
4c33afd
commit 4db6b4d
Showing
11 changed files
with
161 additions
and
52 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
20 changes: 20 additions & 0 deletions
20
...me/common/deployment/src/main/java/xyz/block/ftl/deployment/DefaultOptionalBuildItem.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,20 @@ | ||
package xyz.block.ftl.deployment; | ||
|
||
import io.quarkus.builder.item.SimpleBuildItem; | ||
|
||
/** | ||
* Build item that indicates if a type with no nullability information should default to optional. | ||
* | ||
* This is different between Kotlin and Java | ||
*/ | ||
public final class DefaultOptionalBuildItem extends SimpleBuildItem { | ||
final boolean defaultToOptional; | ||
|
||
public DefaultOptionalBuildItem(boolean defaultToOptional) { | ||
this.defaultToOptional = defaultToOptional; | ||
} | ||
|
||
public boolean isDefaultToOptional() { | ||
return defaultToOptional; | ||
} | ||
} |
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
11 changes: 11 additions & 0 deletions
11
...ime/java/deployment/src/main/java/xyz/block/ftl/javalang/deployment/FTLJavaProcessor.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,11 @@ | ||
package xyz.block.ftl.javalang.deployment; | ||
|
||
import io.quarkus.deployment.annotations.BuildStep; | ||
import xyz.block.ftl.deployment.DefaultOptionalBuildItem; | ||
|
||
public class FTLJavaProcessor { | ||
@BuildStep | ||
public DefaultOptionalBuildItem defaultOptional() { | ||
return new DefaultOptionalBuildItem(false); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...e/kotlin/deployment/src/main/java/xyz/block/ftl/kotlin/deployment/FTLKotlinProcessor.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,11 @@ | ||
package xyz.block.ftl.kotlin.deployment; | ||
|
||
import io.quarkus.deployment.annotations.BuildStep; | ||
import xyz.block.ftl.deployment.DefaultOptionalBuildItem; | ||
|
||
public class FTLKotlinProcessor { | ||
@BuildStep | ||
public DefaultOptionalBuildItem defaultOptional() { | ||
return new DefaultOptionalBuildItem(true); | ||
} | ||
} |
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
Oops, something went wrong.