Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check recursion limit in VisitorLevelSpecification #991

Merged
merged 1 commit into from
May 23, 2024

Conversation

tranleduy2000
Copy link
Sponsor Collaborator

Check recursion limit in VisitorLevelSpecification instead of relying on Java's StackOverflowError.

The current implementation may not work, JVM may kill the process when StackOverflowError occurs.

interface IAST {
  default IExpr acceptChecked(IVisitor visitor) {
    try {
      return accept(visitor);
    } catch (StackOverflowError soe) {
      RecursionLimitExceeded.throwIt(Integer.MAX_VALUE, this);
    }
    return F.NIL;
  }
}

…ng on Java's StackOverflowError.

The current implementation may not work, JVM may kill the process when StackOverflowError occurs.
```
  default IExpr acceptChecked(IVisitor visitor) {
    try {
      return accept(visitor);
    } catch (StackOverflowError soe) {
      RecursionLimitExceeded.throwIt(Integer.MAX_VALUE, this);
    }
    return F.NIL;
  }
```
@tranleduy2000 tranleduy2000 requested a review from axkr May 23, 2024 19:26
@axkr axkr merged commit a0002b6 into master May 23, 2024
3 of 4 checks passed
@tranleduy2000 tranleduy2000 deleted the recursion_limit_check branch May 23, 2024 20:37
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.

None yet

2 participants