byte resultByte = decoder.readByte();
if (resultByte == SUCCESSFUL) {
ModuleVersionIdentifier selected = moduleVersionIdentifierSerializer.read(decoder);
return new DefaultInternalDependencyResult(requested, selected, null, null);
} else if (resultByte == FAILED) {
ComponentSelectionReason reason = componentSelectionReasonSerializer.read(decoder);
ModuleVersionResolveException failure = failures.get(requested);
return new DefaultInternalDependencyResult(requested, null, reason, failure);
} else {
throw new IllegalArgumentException("Unknown result byte: " + resultByte);
}