Repository navigation
Create strict number refusals and located failures without a stack trace - #683
Conversation
…ace (#679) A value refused by strict numbers used to fill two stack traces: one for the AwkNumberFormatException thrown by JRT.requireNumber(), one for the copy that AVM.atLine() ties to the source line. Any other failure, an exception thrown stackless by an extension function included, was wrapped in an AwkRuntimeException that filled one more. AwkNumberFormatException is now created without a stack trace, and so is the located exception of atLine(), through the new AwkRuntimeException(lineno, msg, cause, writableStackTrace) constructor. Types, messages, line numbers and the refused value are unchanged, and the cause keeps the trace of the original failure when it has one. Claude-Session: https://claude.ai/code/session_012oN69BbMXD8VrEn4aCbj5M
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7a8ea3a3db
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The constructor of Throwable that disables the stack trace also marks the cause as initialized, even when it is null, so initCause() threw an IllegalStateException on an exception created without a cause. The exception now stays stackless by overriding fillInStackTrace() instead, and the constructors without a cause leave it uninitialized as before. Claude-Session: https://claude.ai/code/session_012oN69BbMXD8VrEn4aCbj5M
|
@codex please review again Generated by Claude Code |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Fixes #679
Problem
A value refused by strict numbers filled two stack traces: one for the
AwkNumberFormatExceptionthrown byJRT.requireNumber(), one for the copy thatAVM.atLine()ties to the source line. Any other failure, including an exception that an extension function throws without a stack trace to mean "no value", was wrapped in anAwkRuntimeExceptionthat filled one more.Change
AwkNumberFormatExceptionnever fills a stack trace: it overridesfillInStackTrace(). The existing constructors still leave the cause uninitialized, soinitCause()works as before. New constructorAwkNumberFormatException(int lineno, String value, Throwable cause).AwkRuntimeException(int lineno, String msg, Throwable cause, boolean writableStackTrace).AVM.atLine()creates the located exception without a stack trace. Its cause is the original exception, with its own stack trace when it has one, so a bug in Jawk or in an extension is still traceable throughgetCause().Types, messages, line numbers and
getValue()are unchanged. The command-line output is unchanged too:Cli.mainprints the type, the line and the message, never a stack trace.Not done
The optional part of the issue (set the line on an existing
AwkRuntimeExceptioninstead of creating a new one):lineNumberisfinal, and an extension may throw the same exception instance several times, so mutating it would not be safe. The located exception is now a plain allocation, without a stack walk.Scope
The diff of
AVM.javais limited toatLine(), to avoid conflicts with the pull requests for #677, #678 and #680.Tests and documentation
StrictNumbersTest: a refusal keeps its type, message, line and value, and neither the located exception nor its cause has a stack trace; the new constructors, andinitCause()on the existing ones; an extension that fails is still reported as anAwkRuntimeExceptionwith the same message and line, stackless, with the original exception (and its trace) as cause; an extension that throws a stackless exception gets it back as cause, as it is.java-advanced.md(Strict Numbers) and anUnreleasedbullet inbehavior-changes.md.mvn verify: 1023 unit tests pass; checkstyle, PMD and SpotBugs report nothing; the compatibility suite fails on the same tests asmain.🤖 Generated with Claude Code
https://claude.ai/code/session_012oN69BbMXD8VrEn4aCbj5M