RFR: 8359809: AttributeList, RoleList and UnresolvedRoleList should never accept other types of Object

Kevin Walls kevinw at openjdk.org
Wed Jun 25 17:09:45 UTC 2025


On Tue, 17 Jun 2025 16:54:15 GMT, Kevin Walls <kevinw at openjdk.org> 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.

I will update the CSR to clarify/answer the questions.

I've updated the PR to remove a few checkTypeSafe() calls: they are generally wanted when we add an Object or Collection, but not needed in e.g. an add(Role) method that specifically takes the type that we want.  This is why there are api doc additions for the overridden methods that take Object or Collection, and not for the non-overridden add methods that take a specific type (they don't check the type and throw).

-------------

PR Comment: https://git.openjdk.org/jdk/pull/25856#issuecomment-3005521578


More information about the serviceability-dev mailing list