Repository navigation
Verify static and default interface method bodies - #385
Open
CatarinaGamboa wants to merge 1 commit into
Open
CatarinaGamboa wants to merge 1 commit into
CatarinaGamboa wants to merge 1 commit into
Conversation
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.
rcosta358
approved these changes
Oct 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #343.
The verifier assumed every return and
thisaccess 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 testpassed all 391 tests, and the four new fixtures produced their expected outcomes when run directly.This change does not extend interface supertype contract inheritance.