{"record":{"id":"2ce02122cd9110d2","repo":"quarkusio/quarkus","slug":"using-kotlin-default-methods-on-interfaces-that-ar","errorCode":null,"errorMessage":"Using Kotlin default methods on interfaces that are not backed by Java 8 default interface methods is not supported. See https://kotlinlang.org/docs/java-to-kotlin-interop.html#default-methods-in-interfaces for more details. Offending interface is '${interface}'.","messagePattern":"Using Kotlin default methods on interfaces that are not backed by Java 8 default interface methods is not supported\\. See https://kotlinlang\\.org/docs/java-to-kotlin-interop\\.html#default-methods-in-interfaces for more details\\. Offending interface is '(.+?)'\\.","errorType":"exception","errorClass":"RestClientDefinitionException","httpStatus":null,"severity":"error","filePath":"extensions/resteasy-reactive/rest-client/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/RestClientReactiveProcessor.java","lineNumber":964,"sourceCode":"                    defaultPriority);\n        } else {\n            AnnotationInstance priorityAnnoOnProvider = providerClass.declaredAnnotation(ResteasyReactiveDotNames.PRIORITY);\n            if (priorityAnnoOnProvider != null) {\n                priority = priorityAnnoOnProvider.value().asInt();\n            }\n        }\n        return priority;\n    }\n\n    // By default, Kotlin does not use Java interface default methods, but generates a helper class that contains the implementation.\n    // In order to avoid the extra complexity of having to deal with this mode, we simply fail the build when this situation is encountered\n    // and provide an actionable error message on how to remedy the situation.\n    private void validateKotlinDefaultMethods(ClassInfo jaxrsInterface, IndexView index) {\n        if (jaxrsInterface.declaredAnnotation(KOTLIN_METADATA_ANNOTATION) != null) {\n            var potentialDefaultImplClass = DotName\n                    .createSimple(jaxrsInterface.name().toString() + KOTLIN_INTERFACE_DEFAULT_IMPL_SUFFIX);\n            if (index.getClassByName(potentialDefaultImplClass) != null) {\n                throw new RestClientDefinitionException(String.format(\n                        \"Using Kotlin default methods on interfaces that are not backed by Java 8 default interface methods is not supported. See %s for more details. Offending interface is '%s'.\",\n                        \"https://kotlinlang.org/docs/java-to-kotlin-interop.html#default-methods-in-interfaces\",\n                        jaxrsInterface.name().toString()));\n            }\n        }\n    }\n\n    private boolean isRestMethod(MethodInfo method) {\n        if (!Modifier.isAbstract(method.flags())) {\n            return false;\n        }\n        for (AnnotationInstance annotation : method.annotations()) {\n            if (annotation.target().kind() == AnnotationTarget.Kind.METHOD\n                    && BUILTIN_HTTP_ANNOTATIONS_TO_METHOD.containsKey(annotation.name())) {\n                return true;\n            } else if (annotation.name().equals(ResteasyReactiveDotNames.PATH)) {\n                return true;\n            }","sourceCodeStart":946,"sourceCodeEnd":982,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/resteasy-reactive/rest-client/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/RestClientReactiveProcessor.java#L946-L982","documentation":"Kotlin interfaces compile default methods into a synthetic `DefaultImpls` class instead of Java 8 default interface methods unless the Kotlin compiler flag `-Xjvm-default=all` (or `all-compatibility`) is used. The REST Client runtime proxy cannot invoke these, so Quarkus detects `...DefaultImpls` in the index for an annotated Kotlin interface and throws RestClientDefinitionException.","triggerScenarios":"Declaring a REST Client interface in Kotlin with default method bodies (or @JvmDefault-less compilation) and building without `-Xjvm-default=all`.","commonSituations":"Kotlin projects created with old Kotlin versions before jvm-default defaults; adding a default method to a client interface for convenience; shared Kotlin library compiled without the flag.","solutions":["Add `kotlinOptions.freeCompilerArgs += \"-Xjvm-default=all\"` to the Kotlin compile task in build.gradle(.kts) (or `<compilerArgs><arg>-Xjvm-default=all</arg></compilerArgs>` in Maven)","Enable `jvmDefault = \"all\"` in the Kotlin toolchain","Move default implementations out of the client interface into an abstract class or helper"],"exampleFix":"// before (build.gradle.kts)\ntasks.withType<KotlinCompile> { kotlinOptions.jvmTarget = \"17\" }\n// after\ntasks.withType<KotlinCompile> {\n    kotlinOptions.jvmTarget = \"17\"\n    kotlinOptions.freeCompilerArgs += \"-Xjvm-default=all\"\n}","handlingStrategy":"validation","validationCode":"// build.gradle.kts check\nval usesJvmDefaultAll = kotlin {\n  compilerOptions { freeCompilerArgs.add(\"-Xjvm-default=all\") }\n}\n// Quick pre-check: ensure DefaultImpls classes are absent for client interfaces\nval bad = listOf(\"MyClient\")\n    .map { Class.forName(it + \"$DefaultImpls\") }\nif (bad.isNotEmpty()) error(\"Enable -Xjvm-default=all; DefaultImpls found\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set -Xjvm-default=all (or all-compatibility) in every Kotlin module containing REST Client interfaces","Avoid default method bodies in client interfaces; use overloads or helper functions","Check third-party Kotlin libraries for DefaultImpls classes before using them as clients"],"tags":["kotlin","rest-client","default-methods","build-time"],"backgroundTag":"kotlin-default-interface-methods","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}