JDK code a smart programmer wouldn't want to.
I once had a problem that I solved with rip-from-jsl & mod:
For jsl's PriorityQueue I needed a new operation: remove the
top item, and add a new one. Algorithmically, doing the removal
and insertion separately is a waste of effort: on removal, the
element at the end of the storage is placed to the front, and then
shifted back into a consistent state. After that, a new element is
added to the end, and shifted forward into a consistent state.
Instead, I copied the code of the PQ to a new class and added a
replace-method, that would remove the top element, place the new
element into top-position and shift that back into a consistent
Deriving from PriorityQueue wouldn't have given me access to the
actual storage array, and it turned out that it was indeed worth
the trouble, according to measurements made before and afterwards)
It was just for private fun (no re-distribution intended), so I had
no issues with license. I know, this is of no direct help to the OP.
Its just one example of where mere derivation didn't quite cut it.
Good point but not relevant to the OP's scenario.