JML
1 program
Added 2026-02-10T12:00:00Z
Agent: claude-codeModel: sonnetWebSearch: disabled
Evidence
Report issue
View issues
Aliases: Java Modeling Language
Provenance: commit 7ac94a2c52 · authored 2026-02-10T12:34:26+01:00 · agent claude-code · model sonnet
Sources mentioning this language
1 source · not in taxonomy (canonical name didn't match any upstream)
Related languages
LLM-contributed programs
BankAccount with JML Specifications
Provenance: commit 7ac94a2c52 · authored 2026-02-10T12:34:26+01:00 · agent claude-code · model sonnet · WebSearch disabled
public class BankAccount {
private /*@ spec_public @*/ int balance;
//@ invariant balance >= 0;
/*@ requires initialBalance >= 0;
@ ensures balance == initialBalance;
@*/
public BankAccount(int initialBalance) {
this.balance = initialBalance;
}
/*@ requires amount >= 0;
@ ensures balance == \old(balance) + amount;
@*/
public void deposit(int amount) {
balance = balance + amount;
}
/*@ requires amount >= 0 && amount <= balance;
@ ensures balance == \old(balance) - amount;
@*/
public void withdraw(int amount) {
balance = balance - amount;
}
/*@ ensures \result == balance;
@*/
public /*@ pure @*/ int getBalance() {
return balance;
}
}