kafka-streams: capture the ambiguous null tombstone compile error
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RjfyTgmERTWLqzafu34Cth
This commit is contained in:
@@ -39,5 +39,6 @@ Every file in `output/` is written by a test that also asserts it.
|
||||
| `04-blocklist-table-join.txt` | Join before blocking, after blocking, and after a tombstone |
|
||||
| `05-topology-description.txt` | `Topology.describe()` of the whole graph |
|
||||
| `06-spring-context.txt` | The Spring factory bean is wired and not running |
|
||||
| `07-ambiguous-null-tombstone.txt` | The real `javac` error for `pipeInput("c5", null)`; source in `src/broken/`, regenerated by `scripts/compile-broken.sh` |
|
||||
|
||||
The article carries the explanations; there is deliberately no `docs/` folder.
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
src/broken/AmbiguousNullTombstone.java:9: error: reference to pipeInput is ambiguous
|
||||
blocked.pipeInput("c5", null);
|
||||
^
|
||||
both method pipeInput(K,V) in TestInputTopic and method pipeInput(V,Instant) in TestInputTopic match
|
||||
where K,V are type-variables:
|
||||
K extends Object declared in class TestInputTopic
|
||||
V extends Object declared in class TestInputTopic
|
||||
1 error
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Captures the real javac error for the null-tombstone mistake into output/07-ambiguous-null-tombstone.txt
|
||||
set -uo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
mvn -B -q dependency:build-classpath -Dmdep.outputFile=target/cp.txt >/dev/null
|
||||
mkdir -p target/broken
|
||||
javac -d target/broken -cp "$(cat target/cp.txt)" src/broken/AmbiguousNullTombstone.java 2>&1 \
|
||||
| grep -v '^Picked up' > output/07-ambiguous-null-tombstone.txt
|
||||
cat output/07-ambiguous-null-tombstone.txt
|
||||
@@ -4,4 +4,5 @@ set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
rm -f output/*.txt
|
||||
mvn -B -q test
|
||||
scripts/compile-broken.sh >/dev/null || true
|
||||
ls output
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import org.apache.kafka.streams.TestInputTopic;
|
||||
|
||||
/**
|
||||
* Deliberately does not compile; it lives outside src/main and src/test so the build ignores it.
|
||||
* scripts/compile-broken.sh runs javac on it and captures the compiler's own message.
|
||||
*/
|
||||
public class AmbiguousNullTombstone {
|
||||
static void tombstone(TestInputTopic<String, String> blocked) {
|
||||
blocked.pipeInput("c5", null);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user