Skip to content
Merged
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 @@ -391,6 +391,14 @@ static boolean decodeModuleHasTargetSystemOverrides(byte flags) {
}

static short encodeTargetSystems(Set<InstrumenterModule.TargetSystem> targetSystems) {
final int allTargetSystemsCount = InstrumenterModule.TargetSystem.values().length;
// Safety check to ensure we don’t overflow the index if additional TargetSystem enums are added
if (allTargetSystemsCount > 16) {
throw new IllegalStateException(
"Using a short will only allow encoding 16 different target systems, but found "
+ allTargetSystemsCount
+ ". Please use a larger data type for encoding/decoding this field.");
}
short ret = 0;
for (InstrumenterModule.TargetSystem ts : targetSystems) {
ret |= (short) (1 << ts.ordinal());
Expand Down