Skip to content

Conversation

@rcosta358
Copy link
Collaborator

@rcosta358 rcosta358 commented Oct 23, 2025

Added validation to ensure that classes and methods in external refinements actually exist. Also added a test for each case.
For now we'll just return an error, but in the future we'll turn these into warnings (because of dynamic generated classes).

@ExternalRefinementsFor("non.existent.Class")
public interface ErrorExtRefNonExistentClass {
    public void NonExistentClass(); 
}

Found Error: Could not find class 'non.existent.Class'

@ExternalRefinementsFor("java.util.ArrayList")
public interface ErrorExtRefNonExistentMethod<E> {

    // ...

    @StateRefinement(to = "size(this) == (size(old(this)) + 1)")
    public void adddd(E e);
}

Found Error: Could not find method 'adddd(java.lang.Object)' in class 'java.util.ArrayList'

@rcosta358 rcosta358 self-assigned this Oct 23, 2025
@rcosta358 rcosta358 added the enhancement New feature or request label Oct 23, 2025
@rcosta358 rcosta358 linked an issue Oct 23, 2025 that may be closed by this pull request
@rcosta358 rcosta358 requested a review from alcides October 23, 2025 13:23
public int min(int a, int b);

@Refinement(" _ > 0.0 && _ < 1.0")
public long random(long a, long b);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This method does not exist in java.lang.Math.

@rcosta358 rcosta358 merged commit b57ae7d into liquid-java:main Oct 29, 2025
1 check passed
@rcosta358 rcosta358 deleted the ext-ref-existence-checking branch October 29, 2025 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not Found Warnings

2 participants