Add negative verifier tests for remaining array load/store component type checks#524
Merged
garydgregory merged 1 commit intoJul 15, 2026
Conversation
TestArrayAccess05 and TestArrayAccess06 only cover iaload and caload, so the component type checks for the remaining array load/store instructions in InstConstraintVisitor have no negative tests. Add a parameterized TestArrayAccess07Creator that applies a given array access instruction to an array whose component type does not match (castore on an int[], iastore on a char[], and so on) and assert that structural verification rejects each of aaload, aastore, baload, bastore, castore, daload, dastore, faload, fastore, iastore, laload, lastore, saload and sastore. Make TestCreator.getClassName protected so the creator can name the generated class per instruction instead of adding fourteen creator subclasses. Follow-up to apache#522.
7 tasks
garydgregory
added a commit
that referenced
this pull request
Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #522, adding the negative tests discussed there.
TestArrayAccess05andTestArrayAccess06only coverialoadandcaload, so the component-type checks for the remaining array load/store instructions inInstConstraintVisitorhad no negative coverage.Adds a parameterized
TestArrayAccess07Creatorthat applies a given array access instruction to an array whose component type does not match (castoreon anint[],iastoreon achar[],aaloadon anint[], and so on), plus a parameterized test asserting structural verification rejects each ofaaload,aastore,baload,bastore,castore,daload,dastore,faload,fastore,iastore,laload,lastore,saloadandsastore. Theaastorecase storesnullinto anint[], which hits the element-type branch rather than the value-type branch already covered by theTestArrayAccess04*family. I checked each case fails in Pass3b on the component-type constraint specifically, not in an earlier pass.One creator handles all fourteen cases instead of fourteen creator subclasses;
TestCreator.getClassNamebecomes protected so the creator can name the generated class after the instruction.mvn; that'smvnon the command line by itself.