Skip to content

Apply external contracts to inherited receiver methods - #387

Open
CatarinaGamboa wants to merge 1 commit into
mainfrom
fix/379-inherited-external-spec
Open

CatarinaGamboa wants to merge 1 commit into
mainfrom
fix/379-inherited-external-spec

Conversation

@CatarinaGamboa

Copy link
Copy Markdown
Collaborator

An external specification for JFrame could not name inherited pack() or setUndecorated(boolean). Both declarations produced warnings, and pack(); setUndecorated(true); incorrectly passed verification.

Validate external method signatures and overload suggestions against methods the target actually inherits. Exclude private ancestor methods, interface static methods, and package-private methods lost across package boundaries. Resolve invocation contracts against the receiver's static type first, using exact parameter types to prevent equal-arity overload collisions, then retain the existing declaring-type lookup. This applies to both library calls and resolved source method calls.

Add paired JFrame protocol, source inheritance, and JDK overload regressions, plus superclass fallback, subclass override, and inherited visibility coverage.

Validation: mvn -pl liquidjava-verifier test — 394 tests, zero failures/errors. Targeted checks also verified the exact JFrame state error, both overload paths, and exactly three visibility warnings while accepting inherited protected and default-package methods.

Adversarial and devil’s advocate review identified two implementation traps covered here: the existing typed context lookup falls back to arity, and Spoon’s complete method set includes non-inherited private/interface-static/package-private declarations. Receiver lookup uses a new exact API; inherited validation filters those declarations.

Closes #379.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An external spec cannot refine methods its class inherits

2 participants