On Tue, 1 Jul 2025 08:52:56 GMT, Kevin Walls <[email protected]> wrote:
>> The classes javax.management.AttributeList, and
>> javax.management.relation.RoleList and UnresolvedRoleList, have a historical
>> feature where they accept objects of the wrong type, and only check for
>> wrong objects when the "asList()" method is called.
>>
>> This feature should be removed, and these classes should never accept the
>> wrong kind of Object.
>
> Kevin Walls has updated the pull request incrementally with two additional
> commits since the last revision:
>
> - Further doc update
> - Test udpate (listIterator)
Changes requested by sspitsyn (Reviewer).
test/jdk/javax/management/generified/ListTypeCheckTest.java line 105:
> 103: ListIterator iter2 = al.listIterator();
> 104: Object x2 = iter2.next();
> 105: iter2.add("blah");
Nit: The case #6 is exactly the same as #5.
Q: Why is it needed?
I'd suggest to add a comment explaining this case.
The line 105 should have a comment as at the line 99.
In general, this test has a lack of comments explaining tests cases (was before
your fix).
test/jdk/javax/management/generified/ListTypeCheckTest.java line 110:
> 108: throw new Exception("test wrong");
> 109: }
> 110: throw new Exception("op " + i + " allowed but should
> fail on " + al.getClass());
Nit: This is confusing. If it is allowed then why should it fail.
At least, it needs to be explained somewhere in the tests.
-------------
PR Review: https://git.openjdk.org/jdk/pull/25856#pullrequestreview-3003366010
PR Review Comment: https://git.openjdk.org/jdk/pull/25856#discussion_r2196169023
PR Review Comment: https://git.openjdk.org/jdk/pull/25856#discussion_r2196171012