-
Notifications
You must be signed in to change notification settings - Fork 273
Lazy methods: mark JVM-generated exceptions as always available #1467
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
Lazy methods: mark JVM-generated exceptions as always available #1467
Conversation
java.lang.NullPointerException et al are producable from Java ops other than throw, and therefore weren't previously noticed. This adds the exceptions that can be introduced by java_bytecode/java_bytecode_instrument.cpp into the lazy methods loader's list of always-available classes.
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.
I approve of course, but then I wrote it :)
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.
It would be helpful if this PR included an example of what it's fixing.
An example of why this PR is/will be needed:
With the current platform options, the |
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.
I agree with @LAJW - could you take your example and create regression or unit tests exhibiting the problem this will fix (pref ably one for each type of exception). Or if there are already tests for each exception (they're should be...), extend them to use lazy-methods
and the models library so that they would catch this in future.
lazy_methods.add_needed_class( | ||
"java::java.lang.ArrayIndexOutOfBoundsException"); | ||
lazy_methods.add_needed_class("java::java.lang.ClassCastException"); | ||
lazy_methods.add_needed_class("java::java.lang.NegativeArraySizeException"); |
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.
Consider adding a comment to java_bytecode_instrument::instrument_expr
to say that new runtime thrown exceptions need to be added to ci_lazy_methods.cpp
test-gen doesn't build with the version of cbmc that this is based on, so I'll rebase the changes on my fork and create a new PR. I'll close this one and link the new one here. Sorry about that. |
java.lang.NullPointerException et al are producable from Java ops
other than throw, and therefore weren't previously noticed. This adds
the exceptions that can be introduced by java_bytecode/java_bytecode_instrument.cpp
into the lazy methods loader's list of always-available classes.