GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix NullPointerException in `MethodsFunctionsChecker` by rcosta358 · Pull Request #150 · liquid-java/liquidjava

Conversation

@rcosta358

@rcosta358 rcosta358 commented Feb 14, 2026

Copy link
Copy Markdown
Collaborator

This PR fixes an issue where when a class had multiple methods and one method would throw an error related to a parametric refinement (e.g., InvalidRefinementError), the exception would abort the visitation of sibling methods during the first pass. Then, in second pass, when trying to get the function that should have been added to the context in the first pass, it is not there, and would throw a NullPointerException. This was because there were missing try-catch blocks in the getMethodRefinements and getConstructorRefinements (in this case, the first one).

Example Reproduction

public class SimpleTest {

    void testParam(@Refinement("y + 1") int y) {}

    int test() {
        return -1;
    }
}
// Cannot invoke "liquidjava.processor.context.RefinedFunction.getArguments()" because "fi" is null

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rcosta358
Fix NullPointerException
6ac6ff7
@rcosta358 rcosta358 self-assigned this Feb 14, 2026
@rcosta358 rcosta358 added the bug Something isn't working label Feb 14, 2026
@rcosta358
Add Tests
cb59601
rcosta358
rcosta358 commented Feb 14, 2026
View reviewed changes
Comment thread ...n/java/liquidjava/processor/refinement_checker/general_checkers/MethodsFunctionsChecker.java
Comment on lines +184 to +185
if (fi == null)
return;

@rcosta358 rcosta358 Feb 14, 2026

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just in case.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

CatarinaGamboa reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
rcosta358
rcosta358 commented Feb 14, 2026
View reviewed changes
Comment thread ...n/java/liquidjava/processor/refinement_checker/general_checkers/MethodsFunctionsChecker.java
Comment on lines -414 to -417
} else {
assert false;
// Method should already be in context. Should not arrive this point in
// refinement checker.

@rcosta358 rcosta358 Feb 14, 2026

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot assume this anymore because a method that throws InvalidRefinementError on a parametric refinement will not be added to the context.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rcosta358
rcosta358 requested a review from CatarinaGamboa February 14, 2026 16:58
@rcosta358 rcosta358 mentioned this pull request Feb 14, 2026
Add #result for Return Refinements #145
Open
CatarinaGamboa
CatarinaGamboa approved these changes Feb 23, 2026
View reviewed changes

@CatarinaGamboa CatarinaGamboa left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice fix! I dont even know why we had the assert false in the first place seems problematic

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rcosta358 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@rcosta358
rcosta358 merged commit 70ccc2f into main Feb 23, 2026
1 check passed

Uh oh!

There was an error while loading. Please reload this page.

@rcosta358
rcosta358 deleted the fix-npe branch February 23, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@CatarinaGamboa CatarinaGamboa CatarinaGamboa approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@rcosta358 rcosta358

Labels

bug Something isn't working

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@rcosta358 @CatarinaGamboa
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.