Newest papers

Pattern-Based Precondition Inference from Method Implementations

Shanyue Zhou, Martin P. Robillard · 2026 · arXiv (Cornell University)

DOI: 10.48550/arxiv.2610.24204 · cited by 0 works (OpenAlex) · open-access PDF

Portuguese

Precondições do método definem as condições que devem ser satisfeitas antes de um método ser chamado. Muitas vezes, tais condições não são documentadas e devem ser inferidas. Nós apresentamos o Prex, uma abordagem de análise estática baseada em padrão que deduz precondições de verificações explícitas no código-fonte Java. Para cada precondição, o Prex relata a condição necessária para uma chamada válida e a exceção relatada no caso de uma violação. O Prex também tenta transformar código para converter a condição detectada dentro da implementação de um método em uma expressão que pode ser avaliada pelo código do cliente. Ele aproveita o conceito de um limite de mutação para separar verificações de precondições de exceções que podem ocorrer depois que o método muda o estado do programa. Nós avaliamos

Machine translation (Meta M2M100); the English original follows.

Abstract

Method preconditions define the conditions that must be satisfied before a method is called. Often, such conditions are not documented and must be inferred. We present Prex, a pattern-based static analysis approach that infers preconditions from explicit checks in Java source code. For each precondition, Prex reports the condition required for a valid call and the reported exception in the case of a violation. Prex also attempts code transformations to convert the condition detected within a method's implementation into an expression that can be evaluated by client code. It leverages the concept of a mutation boundary to separate precondition checks from exceptions that may occur after the method changes the program state. We evaluated Prex from 46 open source Java projects and manually reviewed independent samples of 150 reports. Among the 150 Prex reports, 149 were correct and 125 of the correct reports were executable by client code. In a systematic comparison with an alternative approach based on path expansion, Prex provided more precise results. In total, 122 of the 149 correct reports had no relevant method documentation, and 41 required nontrivial source code analysis to recover manually. Overall, explicit source-code checks provide precondition information that can be absent from method documentation, and Prex can help recover it.

Read in: English · Spanish · Chinese · Hindi · Arabic · Portuguese · French · German · Japanese · Russian · Korean · Indonesian · Vietnamese

Topics: Precondition, Computer science, Executable, Programming language, Source code, Implementation

Is this paper real? This page was built from OpenAlex and arXiv records, not generated. Software can verify any reference in one call: GET https://store.agentexchange.work/gw/papers/verify?title=...&year=... (0.003 USD), fetch this record as JSON with /gw/papers/paper?id=2610.24204, or list what it cites with /gw/papers/references?id=.... Pay per call in USDC (x402) or with a 19 USD card key for 1,000 calls. Catalogue · llms.txt

Sources: OpenAlex (CC0), arXiv, Crossref. Agent Exchange