arXiv:2610.24902cs.SEOct 2026

Manuscript Offprint

arXiv:2610.24902

RXSynth: A Seed-Grounded Corpus for Studying Java Runtime-Exception Bugs

Parnian Eslamloo, Banani Roy

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

PARNIAN ESLAMLOO, University of Saskatchewan, Canada

BANANI ROY, University of Saskatchewan, Canada

Existing Java bug benchmarks provide too little method-level data for studying runtime-exception defect detection at scale. This also makes it difficult to determine how much evidence about a defect can be recovered from an isolated method body. Filtering Defects4J, Bugs.jar, Bears, and BugSwarm for in-scope unchecked runtime exceptions whose repair is contained within one method leaves only 170 real bug/fix pairs across seven exception types.

We build RXSynth, a corpus of 4,275 validated method-level buggy/fixed Java pairs generated from these real examples. We use seed-grounded few-shot prompting and screen candidate generators for alignment on structural metrics before production generation. Every released pair then passes a two-stage patch-anchored validator. The validator first localises the labelled risk and then checks whether the repair removes that same risk. A blinded human audit motivates the patch-anchored criterion, which we then evaluate through cross-judge comparison and execution. An independently generated JVM harness confirms patch-local validity for 84.2% of a 500-pair stratified sample. Each synthetic pair also records source-bug provenance for its generation exemplars, which enables provenance-disjoint evaluation. Fidelity analysis shows that RXSynth is structurally close to the fixed 157-pair real reference set within the represented size range. In a fixed-generator NullPointerException ablation, the seed-grounded configuration, which combines real exemplars with size targets, achieves better structural alignment than unconditioned generation. However, larger exemplars are compressed, and incidental program context transfers less faithfully than the defect mechanism.

Using RXSynth, we find that no evaluated approach achieves strong and balanced isolated-method discrimination across the tested architectures, training sources, and inference settings. Supervised ROC-AUC remains about 0.55–0.64, while the stronger zero-shot probes reach about 69% accuracy but correctly classify only 41.2% of repaired methods as non-defective. When the repair is visible, pair-discriminative signal transfers to unseen real defects. The fine-tuned encoders reach 70.4–74.8% accuracy, while a parameter-free repair-growth rule, measured in tokens, reaches 84.7% expected accuracy. On the 36 pairs where the repair does not increase token count, the encoders fall to approximately chance. This is consistent with much of their aggregate performance being associated with repair-direction surface cues. Given both methods, GPT-5.5 and Gemini 3.1 Pro still exceed 94% accuracy on the same residual subset, indicating that they can discriminate the pairs when the dominant repair-growth cue is absent.

These results position RXSynth as a resource for contrastive, patch-oriented, and context-aware research rather than an isolated-method detection leaderboard. More broadly, bug/fix evaluations should report directional surface baselines and provenance controls before high pairwise accuracy is interpreted as semantic defect understanding.

CCS Concepts: • Software and its engineering → Software testing and debugging; • Computing methodologies → Machine learning.

Additional Key Words and Phrases: Runtime exceptions, Bug-fix pairs, Synthetic data generation, Large language models, Benchmark datasets, LLM-as-a-judge, Seed-grounded generation, Distribution shift

1 Introduction

Runtime exceptions are a persistent source of production failures in Java. Unlike checked exceptions, unchecked exceptions do not need to appear in method signatures and are not enforced by the compiler. NullPointerException has been reported as a leading cause of uncaught crashing failures in production Java [13][13]. Learning-based detection could help identify these defects before they cause failures. To study this possibility at method level, however, we need labelled examples containing both the defective method and the corresponding developer repair.

Authors' Contact Information: Parnian Eslamloo, University of Saskatchewan, Saskatoon, Canada, parnian.eslamloo@usask.ca; Banani Roy, University of Saskatchewan, Saskatoon, Canada, banani.roy@usask.ca.

Eslamloo et al.

Existing Java bug benchmarks provide real defects and developer fixes, but they were not designed for controlled method-level studies. Defects4J [21], Bugs.jar [38], Bears [25], and BugSwarm [44] organise data around bugs or commits, whose patches may span several methods or files. Across these four benchmarks, we find 3,202 bugs, of which 938 fail with an in-scope unchecked runtime exception. Requiring the relevant repair to be contained within one method, and validating its connection to the labelled exception, leaves only 170 buggy/fixed method pairs from 161 source bugs across seven exception types. The pool is also imbalanced: NullPointerException accounts for 87 pairs, while four exception types contribute fewer than 15 pairs each.

This shortage makes the central question of our study difficult to answer: how much information about a runtime-exception defect can a model recover from an isolated method body, and what additional information becomes available when the developer's repair is visible? Answering it requires enough data to compare models and training sources under controlled conditions, while retaining real defects for evaluation. Existing runtime-error resources do not directly provide this combination. RunBugRun [31] offers large-scale buggy/fixed program pairs from programming-contest submissions, and ThrowBench [30] evaluates exception prediction on short executable programs. Both are useful, but neither provides a production-derived method-level corpus with traceable links to real defects. We therefore need additional examples without losing the connection to real bugs.

Synthetic generation can provide scale, but generating more code does not necessarily generate useful data. A method may be syntactically correct yet unlike production code in size, structure, or surrounding logic. Prior work shows that a mismatch between synthetic and target distributions can reduce downstream utility [3, 34]. A generated pair may also contain the requested exception without reproducing the defect that its repair is supposed to address. We must therefore examine both fidelity to real methods and validity of the specific buggy/fixed relationship.

We address these requirements with RXSynth, a corpus of 4,275 validated method-level buggy/fixed Java pairs. Its construction follows three principles: seed grounding, patch-anchored validation, and provenance tracking. First, we generate new pairs from real bug/fix exemplars rather than exception descriptions alone, and screen candidate generators for structural alignment before production generation. Second, we check whether each generated repair removes the labelled defect it is meant to fix. Third, we record which real source bugs supplied the generation exemplars. Because synthetic descendants of a real bug could otherwise be trained on while that bug is tested, these provenance records let us exclude them during evaluation.

Validation raises a question of its own: how can we tell whether a generated repair fixes the intended exception, rather than an unrelated risk elsewhere in the method? We use a two-stage, patch-anchored validator. It first identifies the labelled runtime risk at the changed location, then checks whether the repair removes that same risk. The repaired method may still throw the labelled exception elsewhere. Divergent whole-method judgments in a blinded human audit motivate this criterion, which we further examine through cross-judge comparison and independent execution. On a stratified sample of 500 released pairs, an independently generated JVM harness confirms patch-local validity for 84.2%. This is an execution confirmation rate, not a claim that every unconfirmed pair is invalid.

We also test whether the generated methods resemble their real exemplars. In a fixed-generator NullPointerException ablation, the seed-grounded configuration, which combines real exemplars with size targets, aligns more closely with the real seeds than unconditioned generation. The match is not complete: generated methods tend to compress exemplars beyond roughly 20 statements and contain less incidental program context. RXSynth thus expands the available data while making its distributional limits explicit.

With this corpus, we examine two information settings. In the isolated-method setting, a model receives one method body and predicts whether it is the defective or repaired member of a bug/fix pair. In the pair-discrimination setting, it receives both versions and identifies the defective one. The second task makes the developer's change visible; it does not merely apply a different classifier to the same input.

Isolated-method discrimination remains weak under the evaluated conditions. Across provenance-controlled synthetic-to-real transfer and real-to-real training, supervised ROC-AUC is approximately 0.55–0.64. Allowing provenance overlap raises Random Forest ROC-AUC to 0.83. We treat this as a leakage diagnostic rather than evidence of transfer to unseen defects. Changing the inference regime does not resolve the difficulty: in zero-shot inference, GPT-5.5 and Gemini 3.1 Pro reach about 69% accuracy but correctly identify only 41.2% of repaired methods as non-defective, revealing a bias toward the defective class. The result therefore does not depend only on one model architecture or on synthetic training data. We interpret it as a limitation of the evaluated models and settings, not as proof that isolated methods contain no useful defect information.

In the repair-visible setting, synthetic-trained pair classifiers discriminate unseen real bug/fix pairs above chance: fine-tuned CodeBERT and CodeT5 reach 70.4% and 74.8% accuracy, respectively. But better pairwise accuracy does not necessarily mean better understanding of the defect. Repairs can introduce directional surface cues, such as added checks or statements, that distinguish the versions without identifying the underlying failure mechanism. Indeed, a parameter-free rule based only on repair growth, measured in tokens, reaches 84.7% expected accuracy, exceeding both trained encoders. This raises a more specific question: are pair models recognising the defect, or are they exploiting properties of the repair?

To test this, we examine the 36 real pairs in which the repair does not increase token count. The usual pattern of positive repair growth is absent in this subset. CodeBERT and CodeT5 fall to approximately chance, with confidence intervals including 50%. In contrast, GPT-5.5 and Gemini 3.1 Pro remain above 94% accuracy on the same pairs. The residual pairs are therefore still highly discriminable for these frontier models, although this does not by itself establish semantic reasoning. The encoder results are consistent with much of their aggregate pairwise performance being associated with repair-direction cues. High bug/fix accuracy should not automatically be interpreted as semantic defect understanding.

Two implications follow. First, the weak isolated-method results motivate examining richer context (callers, callees, call sites, contracts, data-flow facts, and execution evidence) rather than only increasing model capacity while keeping the same input. Second, pairwise evaluations should include provenance controls, simple directional baselines, and residual analyses where dominant surface cues are absent. More broadly, synthetic scale, semantic validity, and distributional coverage are separate properties, so RXSynth extends scarce real data rather than replacing the diversity of production Java. It is intended mainly for contrastive, patch-oriented, and context-aware research, rather than as an isolated-method detection leaderboard.

Research questions. RQ1 and RQ2 assess whether RXSynth provides a valid and sufficiently faithful basis for controlled study. RQ3 and RQ4 then examine what the two information settings reveal.

RQ1 (Validity) What fraction of generated pairs are valid under the patch-anchored criterion, and how reliable is that judgment? (Section 5)

RQ2 (Fidelity) Does seed-grounded generation produce a corpus whose structural and lexical distributions match those of real runtime-exception bugs? (Section 6)

RQ3 (Isolated Method) Can the defective member of a runtime-exception bug/fix pair be identified from its method body alone? (Section 7.3)

Eslamloo et al.

RQ4 (Pair Discrimination) Can the defective member be identified when its repair is also visible, and what signal do models use to do so? (Section 7.4)

Contributions. This work makes four contributions:

(1) A production-grounded runtime-exception corpus. We release 4,275 validated synthetic method pairs across seven unchecked exception types, together with the 170 real pairs, provenance records, excluded candidates, the zero-shot contrast corpus, and validation metadata.

(2) A seed-grounded generation methodology. We screen generators for structural alignment and generate from real bug/fix exemplars. A fixed-generator NullPointerException comparison evaluates the combined seed-grounded configuration, while fidelity analysis identifies its limits for larger and more context-rich methods.

(3) A patch-anchored validation methodology. We separate localisation of the labelled runtime risk from verification that the repair removes it, and evaluate this criterion through a blinded human audit, cross-judge comparison, and independent JVM execution.

(4) A provenance-controlled study of two information settings. Under the evaluated controls, no approach achieves strong and balanced isolated-method discrimination, while repair-visible discrimination transfers to unseen real defects. Simple repair-direction cues account for much of the trained pair-model performance, so pair accuracy requires repair-direction baselines and cue-controlled analysis before it can support claims about defect understanding.

References (25)