PatchDiagnostics

internal object PatchDiagnostics

How a failed or ambiguous patch target is described back to the caller.

Split out of Patch because the audience is different: Patch decides what to weave, this decides what to SAY when it can't. The caller is an execute_code snippet written by a model, so every rejection here lists the real candidates — turning "installed, never fires, why?" into one corrected retry rather than several rounds of guessing.

Properties

Link copied to clipboard
private const val NAME_PREVIEW: Int = 8

How many method names noSuchMethod lists before truncating.

Functions

Link copied to clipboard
fun ambiguous(cls: String, methodName: String, params: List<String>, distinct: List<Method>): IllegalArgumentException
Link copied to clipboard
private fun editDistance(query: String, candidate: String): Int

Case-insensitive Levenshtein distance, two-row DP.

Link copied to clipboard
fun inheritedElsewhere(cls: String, methodName: String, owner: String, matches: List<Method>): IllegalArgumentException

The name resolved, but on an ancestor: this class carries no bytecode for it. Redirecting silently would widen the patch to every subclass, so the caller is told and re-aims.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun noSuchMethod(cls: String, methodName: String, declared: List<Method>): IllegalArgumentException

The name resolved to nothing. Naming the near misses is what lets a model spot the typo or the wrong-class mistake without another round trip.

Link copied to clipboard
fun noSuchSignature(cls: String, methodName: String, params: List<String>, weavable: List<Method>): IllegalArgumentException
Link copied to clipboard
fun notWeavable(cls: String, methodName: String, byName: List<Method>): IllegalArgumentException

The name resolved, but every match is abstract or native. Naming an abstract base instead of the concrete implementation is an easy mistake, so say exactly that rather than "not found".

Link copied to clipboard
private fun preview(names: List<String>): String

First NAME_PREVIEW names, plus what was left out. Callers order the list; this only trims it.

Link copied to clipboard

A method's mojmap signature — the dedup key for the one-signature rule and one line of a candidate list, deliberately the same function for both. See Signatures.render.