I am attempting to build a nested constraint mapping for a container using the containerElementType method and I noticed that I am only able to create constraints at 1 nested parameter of a typed container.
Tracing through the code I think the hashmap put at line 137 of CascadableConstraintMappingContextImplBase is allowing only 1 nested constraint value to be kept because it is keying on index which is 1 in both cases.
I was able to reproduce the issue with a small modification to the canDeclareDeeplyNestedContainerElementConstraintsForFieldProgrammatically method of ProgrammaticContainerElementConstraintsForFieldTest that adds a size constraint to the list of fish. I noticed that if i flip the order i declare the constraints it affects which violation makes it through and which is thrown out.
Here is a test case to reproduce this issue. It leverages the FishTank type from ProgrammaticContainerElementConstraintsForFieldTest
java 8 66