{"record":{"id":"28d7d8bce87fab85","repo":"apache/kafka","slug":"found-d-public-api-violations-see-report-s","errorCode":null,"errorMessage":"Found %d public API violations. See report: %s","messagePattern":"Found (.+?) public API violations\\. See report: (.+?)","errorType":"validation","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"api-checker/gradle-plugins/src/main/java/org/apache/kafka/gradle/KafkaPublicApiCheckerTask.java","lineNumber":122,"sourceCode":"\n            // Print summary to console\n            reporter.printToConsole(violations, suppressions);\n\n            getLogger().info(\"Public API check completed. Report written to: {}\", report.getAbsolutePath());\n\n            if (!suppressions.isEmpty()) {\n                getLogger().lifecycle(\"{} suppression(s) honoured — see report for justifications.\", suppressions.size());\n                long unjustified = suppressions.stream().filter(PublicApiViolation::lacksReason).count();\n                if (unjustified > 0) {\n                    getLogger().warn(\"{} suppression(s) carry no reason — KIP-1265 requires a justification on every @SuppressKafkaInternalApiUsage\", unjustified);\n                }\n            }\n            if (!violations.isEmpty()) {\n                String message = String.format(\"Found %d public API violations. See report: %s\",\n                    violations.size(), report.getAbsolutePath());\n\n                if (failOnViolation.get()) {\n                    throw new GradleException(message);\n                } else {\n                    getLogger().warn(message);\n                }\n            } else {\n                getLogger().info(\"No public API violations found.\");\n            }\n\n        } catch (IOException e) {\n            throw new GradleException(\"Failed to check public API: \" + e.getMessage(), e);\n        }\n    }\n\n    private File getJavadocJarFile() {\n        if (!javadocJarPath.isPresent()) {\n            throw new GradleException(\"kafkaPublicApiChecker.javadocJarPath is not set. \"\n                    + \"Either configure it explicitly on the extension, or apply this plugin to a \"\n                    + \"project that defines a 'javadocJar' Jar task whose output the plugin can \"\n                    + \"wire automatically.\");","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/apache/kafka/blob/996fb4585aa1bcc8980b0e1b8d6b168b986cd979/api-checker/gradle-plugins/src/main/java/org/apache/kafka/gradle/KafkaPublicApiCheckerTask.java#L104-L140","documentation":"GradleException (or warning) from KafkaPublicApiCheckerTask.checkPublicApi when the public-API consistency check detects violations and failOnViolation is true. The message reports the violation count and the report path. This is the checker signalling that the published API differs from the reference/javadoc surface.","triggerScenarios":"violations list non-empty after checker.checkPublicApiConsistency(jarFile) at line 100-ish and failOnViolation.get() true. Triggered when symbols present in the javadoc jar are missing/changed in the project jars, or vice versa, relative to the configured reference jars.","commonSituations":"Adding/removing a public method without updating docs; binary-incompatible change between releases; reference jar out of date; javadoc generated from a different source state than the compiled jar.","solutions":["Read the report at the path in the message — each PublicApiViolation names the missing/changed symbol.","Restore the removed/changed public API, or update the reference jars if the change is intended and reviewed.","Regenerate javadoc from the same source the jar was built from (dependsOn javadocJar + jar).","For intended breakage, annotate with @SuppressKafkaInternalApiUsage(reason=...) per KIP-1265; otherwise set failOnViolation=false only temporarily."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Triage run with failOnViolation=false, then read the report\nkafkaPublicApiChecker.failOnViolation = false","typeGuard":null,"tryCatchPattern":"try { tasks.kafkaPublicApiChecker() } catch (GradleException e) { if (e.message.contains('public API violations')) { /* inspect report, restore API or update reference jars */ } else throw e }","preventionTips":["Regenerate javadoc and project jars from the same source state.","Keep reference jars aligned with the module version under check.","Review binary-compatibility before removing/renaming public symbols."],"tags":["gradle","api-checker","violation","public-api"],"backgroundTag":null,"analyzedSha":"996fb4585aa1bcc8980b0e1b8d6b168b986cd979","analyzedAt":"2026-08-11T22:03:28.655Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}