Skip to content
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

Use correct types in EnumMapCodec to avoid red highlighting in IntelliJ #24492

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 @@ -81,7 +81,7 @@ public EnumMap deserializeAsync(AsyncDeserializationContext context, CodedInputS

MapBuffer buffer = new MapBuffer(result, size);

Object[] enums = clazz.getEnumConstants();
Enum[] enums = (Enum[]) clazz.getEnumConstants();
for (int i = 0; i < size; i++) {
int ordinal = codedIn.readInt32();
buffer.setEnum(i, enums[ordinal]);
Expand All @@ -97,14 +97,14 @@ public EnumMap deserializeAsync(AsyncDeserializationContext context, CodedInputS
/** Buffers the entry elements and populates the map once all values are done. */
private static class MapBuffer implements Runnable {
private final EnumMap result;
private final Object[] enums;
private final Enum[] enums;
private final Object[] values;

private final AtomicInteger remaining;

private MapBuffer(EnumMap result, int size) {
this.result = result;
this.enums = new Object[size];
this.enums = new Enum[size];
this.values = new Object[size];
this.remaining = new AtomicInteger(size);
}
Expand All @@ -118,7 +118,7 @@ public void run() {
}
}

private void setEnum(int index, Object enumKey) {
private void setEnum(int index, Enum enumKey) {
enums[index] = enumKey;
}
}
Expand Down