Skip to content

HHH-18885 Introduce DelayedOperation.getAddedEntry() for maps #10230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -845,14 +845,14 @@ public final boolean hasQueuedOperations() {
}

@Override
public final Iterator<E> queuedAdditionIterator() {
public final Iterator<?> queuedAdditionIterator() {
if ( hasQueuedOperations() ) {
return new Iterator<>() {
private int index;

@Override
public E next() {
return operationQueue.get( index++ ).getAddedInstance();
public Object next() {
return operationQueue.get( index++ ).getAddedEntry();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change org.hibernate.collection.spi.PersistentCollection#queuedAdditionIterator to return an Iterator<?>, and this method to return Object.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made the change to return an Iterator<?>

}

@Override
Expand Down Expand Up @@ -1227,6 +1227,10 @@ protected interface DelayedOperation<E> {

E getAddedInstance();

default Object getAddedEntry() {
return getAddedInstance();
}

E getOrphan();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ default boolean needsUpdating(
*
* @return The iterator
*/
Iterator<E> queuedAdditionIterator();
Iterator<?> queuedAdditionIterator();

/**
* Get the "queued" orphans
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,11 @@ protected AbstractMapValueDelayedOperation(K index, E addedValue, E orphan) {
protected final K getIndex() {
return index;
}

@Override
public Object getAddedEntry() {
return Map.entry( getIndex(), getAddedInstance() );
}
}

final class Put extends AbstractMapValueDelayedOperation {
Expand Down
Loading