Skip to content

Verify static and default interface method bodies - #385

Open
CatarinaGamboa wants to merge 1 commit into
mainfrom
fix/343-interface-static
Open

CatarinaGamboa wants to merge 1 commit into
mainfrom
fix/343-interface-static

Conversation

@CatarinaGamboa

Copy link
Copy Markdown
Collaborator

Fixes #343.

The verifier assumed every return and this access belonged to a class, so static and default interface methods crashed before verification. Return checking now uses the nearest method and its declaring type, resolves overloads by parameter types, and keeps lambda returns separate from an enclosing method. Interface method invocations also use their registered contracts.

New passing cases cover the reported String.length() call, annotated static/default methods, return this, same-arity overloads, and lambda returns inside interface bodies. New failing cases require errors for invalid static/default returns and a bad interface method argument.

Validation: mvn test passed all 391 tests, and the four new fixtures produced their expected outcomes when run directly.

This change does not extend interface supertype contract inheritance.

Fix issue #343 by resolving return contracts from the nearest method and its declaring type, including interface static and default methods. Use exact parameter types and keep lambda returns separate from enclosing methods. Add passing and failing interface regressions.
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.

Verifier crashes on a method call inside a static method of an interface

2 participants