Skip to content

Refactor code in method checker#247

Merged
CatarinaGamboa merged 2 commits into
mainfrom
refactor-method-checker
Jun 9, 2026
Merged

Refactor code in method checker#247
CatarinaGamboa merged 2 commits into
mainfrom
refactor-method-checker

Conversation

@CatarinaGamboa

Copy link
Copy Markdown
Collaborator

Description

Improve the code in method checker by:

  • joining several similar code sections into a method
  • reducing ifs (e.g., if ( a != null ) { huge code chunk } -> if( a == null ) { return }
  • remove dead code

Type of change

  • Bug fix
  • New feature
  • Documentation update
  • Code refactoring

Checklist

  • Added/updated tests under liquidjava-example/src/main/java/testSuite/ (Correct* / Error*)
  • mvn test passes locally
  • Updated docs/README if behavior or API changed

@rcosta358 rcosta358 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. Minor nits.

String constructorName = "<init>";
String k = Utils.getSimpleName(prefix);
boolean isConstructor = Utils.getSimpleName(prefix).equals(method.getSimpleName());
String functionName = isConstructor ? constructorName : String.format("%s.%s", prefix, method.getSimpleName());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We can replace the repeated String.format("%s.%s", prefix, name) with Utils.qualifyName(prefix, name).

Comment on lines +114 to +115
* Creates a {@link RefinedFunction} with the shared boilerplate (sanitized name, type, empty return refinement,
* placement, optional owning class and signature), registers it in the context, and processes its parameter/return

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* Creates a {@link RefinedFunction} with the shared boilerplate (sanitized name, type, empty return refinement,
* placement, optional owning class and signature), registers it in the context, and processes its parameter/return
* Creates a {@link RefinedFunction} with the sanitized name, type, empty return refinement,
* placement, optional owning class and signature, and registers it in the context, and processes its parameter/return

@CatarinaGamboa CatarinaGamboa force-pushed the refactor-method-checker branch from cab0b30 to df05abb Compare June 9, 2026 13:54
@CatarinaGamboa CatarinaGamboa merged commit c05f3fd into main Jun 9, 2026
1 check passed
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.

2 participants