Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ repositories {

dependencies {
implementation(plugin(libs.plugins.errorprone))
implementation(plugin(libs.plugins.kotlin.jvm))
}

fun plugin(plugin: Provider<PluginDependency>): Provider<String> = plugin.map {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
plugins {
id("org.jetbrains.kotlin.jvm")
}

kotlin {
compilerOptions {
javaParameters = true
}
}
4 changes: 4 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
jspecify = "1.0.0"
errorprone = "2.48.0"
errorprone-plugin = "5.1.0"
kotlin = "2.3.10"
nmcp = "1.4.4"
nullaway = "0.13.1"
problem4j-core = "1.4.3"
Expand All @@ -12,6 +13,7 @@ spring-boot = "4.0.3"

[plugins]
errorprone = { id = "net.ltgt.errorprone", version.ref = "errorprone-plugin" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
nmcp = { id = "com.gradleup.nmcp", version.ref = "nmcp" }
nmcp-aggregation = { id = "com.gradleup.nmcp.aggregation", version.ref = "nmcp" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
Expand All @@ -23,6 +25,7 @@ spring-boot-dependencies = { module = "org.springframework.boot:spring-boot-depe
# direct versions
errorprone-core = { module = "com.google.errorprone:error_prone_core", version.ref = "errorprone" }
jspecify = { module = "org.jspecify:jspecify", version.ref = "jspecify" }
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
nullaway = { module = "com.uber.nullaway:nullaway", version.ref = "nullaway" }
problem4j-core = { module = "io.github.problem4j:problem4j-core", version.ref = "problem4j-core" }
problem4j-jackson2 = { module = "io.github.problem4j:problem4j-jackson2", version.ref = "problem4j-jackson2" }
Expand All @@ -45,6 +48,7 @@ spring-boot-starter-webmvc-test = { module = "org.springframework.boot:spring-bo
spring-web = { module = "org.springframework:spring-web" }
jackson2-databind = { module = "com.fasterxml.jackson.core:jackson-databind" }
jackson3-dataformat-xml = { module = "tools.jackson.dataformat:jackson-dataformat-xml" }
jackson3-module-kotlin = { module = "tools.jackson.module:jackson-module-kotlin" }
jakarta-servlet-api = { module = "jakarta.servlet:jakarta.servlet-api" }
jakarta-validation-api = { module = "jakarta.validation:jakarta.validation-api" }
junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher" }
Expand Down
3 changes: 3 additions & 0 deletions problem4j-spring-webflux/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id("internal.errorprone-convention")
id("internal.jacoco-convention")
id("internal.java-library-convention")
id("internal.kotlin-interop-convention")
id("internal.publishing-convention")
alias(libs.plugins.nmcp)
}
Expand All @@ -25,6 +26,8 @@ dependencies {
testImplementation(libs.spring.boot.starter.webflux)
testImplementation(libs.spring.boot.starter.webflux.test)
testImplementation(libs.spring.boot.validation)
testImplementation(libs.jackson3.module.kotlin)
testImplementation(libs.kotlin.reflect)

testRuntimeOnly(libs.junit.platform.launcher)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
/*
* Copyright (c) 2025-2026 The Problem4J Authors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package io.github.problem4j.spring.webflux.app.rest;

import io.github.problem4j.spring.webflux.app.model.KotlinModel;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/binding-kotlin")
public class BindingKotlinController {

@PostMapping(path = "/int", consumes = MediaType.APPLICATION_JSON_VALUE)
public String intValue(@RequestBody KotlinModel.KotlinIntRequest request) {
return "OK";
}

@PostMapping(path = "/long", consumes = MediaType.APPLICATION_JSON_VALUE)
public String longValue(@RequestBody KotlinModel.KotlinLongRequest request) {
return "OK";
}

@PostMapping(path = "/short", consumes = MediaType.APPLICATION_JSON_VALUE)
public String shortValue(@RequestBody KotlinModel.KotlinShortRequest request) {
return "OK";
}

@PostMapping(path = "/byte", consumes = MediaType.APPLICATION_JSON_VALUE)
public String byteValue(@RequestBody KotlinModel.KotlinByteRequest request) {
return "OK";
}

@PostMapping(path = "/float", consumes = MediaType.APPLICATION_JSON_VALUE)
public String floatValue(@RequestBody KotlinModel.KotlinFloatRequest request) {
return "OK";
}

@PostMapping(path = "/double", consumes = MediaType.APPLICATION_JSON_VALUE)
public String doubleValue(@RequestBody KotlinModel.KotlinDoubleRequest request) {
return "OK";
}

@PostMapping(path = "/boolean", consumes = MediaType.APPLICATION_JSON_VALUE)
public String booleanValue(@RequestBody KotlinModel.KotlinBooleanRequest request) {
return "OK";
}

@PostMapping(path = "/nested/int", consumes = MediaType.APPLICATION_JSON_VALUE)
public String nestedInt(@RequestBody KotlinModel.KotlinNestedIntRequest request) {
return "OK";
}

@PostMapping(path = "/nested/long", consumes = MediaType.APPLICATION_JSON_VALUE)
public String nestedLong(@RequestBody KotlinModel.KotlinNestedLongRequest request) {
return "OK";
}

@PostMapping(path = "/nested/short", consumes = MediaType.APPLICATION_JSON_VALUE)
public String nestedShort(@RequestBody KotlinModel.KotlinNestedShortRequest request) {
return "OK";
}

@PostMapping(path = "/nested/byte", consumes = MediaType.APPLICATION_JSON_VALUE)
public String nestedByte(@RequestBody KotlinModel.KotlinNestedByteRequest request) {
return "OK";
}

@PostMapping(path = "/nested/float", consumes = MediaType.APPLICATION_JSON_VALUE)
public String nestedFloat(@RequestBody KotlinModel.KotlinNestedFloatRequest request) {
return "OK";
}

@PostMapping(path = "/nested/double", consumes = MediaType.APPLICATION_JSON_VALUE)
public String nestedDouble(@RequestBody KotlinModel.KotlinNestedDoubleRequest request) {
return "OK";
}

@PostMapping(path = "/nested/boolean", consumes = MediaType.APPLICATION_JSON_VALUE)
public String nestedBoolean(@RequestBody KotlinModel.KotlinNestedBooleanRequest request) {
return "OK";
}

@PostMapping(path = "/complex", consumes = MediaType.APPLICATION_JSON_VALUE)
public String complex(@RequestBody KotlinModel.KotlinComplexRequest request) {
return "OK";
}

@PostMapping(path = "/nullable", consumes = MediaType.APPLICATION_JSON_VALUE)
public String nullable(@RequestBody KotlinModel.KotlinNullableRequest request) {
return "OK";
}

@PostMapping(path = "/default", consumes = MediaType.APPLICATION_JSON_VALUE)
public String defaultValue(@RequestBody KotlinModel.KotlinDefaultRequest request) {
return "OK";
}

@PostMapping(path = "/list/non-null-elements", consumes = MediaType.APPLICATION_JSON_VALUE)
public String listNonNull(@RequestBody KotlinModel.KotlinListNonNullRequest request) {
return "OK";
}

@PostMapping(path = "/list/nullable-elements", consumes = MediaType.APPLICATION_JSON_VALUE)
public String listNullableElements(
@RequestBody KotlinModel.KotlinListNullableElementsRequest request) {
return "OK";
}

@PostMapping(path = "/map/non-null-values", consumes = MediaType.APPLICATION_JSON_VALUE)
public String mapNonNull(@RequestBody KotlinModel.KotlinMapValueNonNullRequest request) {
return "OK";
}

@PostMapping(path = "/map/nullable-values", consumes = MediaType.APPLICATION_JSON_VALUE)
public String mapNullable(@RequestBody KotlinModel.KotlinMapValueNullableRequest request) {
return "OK";
}
}
Loading