Skip to content
Prev Previous commit
Next Next commit
more sonar warning fix
  • Loading branch information
hjgraca committed Oct 8, 2025
commit c8a32822c48244026f3f4958709995e63160bf10
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@
BatchEventType.DynamoDbStream => CreateTypedBatchProcessingAspectHandler(() => TypedDynamoDbStreamBatchProcessor.TypedInstance, args),
BatchEventType.KinesisDataStream => CreateTypedBatchProcessingAspectHandler(() => TypedKinesisEventBatchProcessor.TypedInstance, args),
BatchEventType.Sqs => CreateTypedBatchProcessingAspectHandler(() => TypedSqsBatchProcessor.TypedInstance, args),
_ => throw new ArgumentOutOfRangeException(nameof(eventType), eventType, "Unsupported event type.")
_ => throw new ArgumentOutOfRangeException($"{eventType}", eventType, "Unsupported event type.")
};
}

Expand All @@ -318,7 +318,7 @@
BatchEventType.DynamoDbStream => CreateBatchProcessingAspectHandler(() => DynamoDbStreamBatchProcessor.Instance),
BatchEventType.KinesisDataStream => CreateBatchProcessingAspectHandler(() => KinesisEventBatchProcessor.Instance),
BatchEventType.Sqs => CreateBatchProcessingAspectHandler(() => SqsBatchProcessor.Instance),
_ => throw new ArgumentOutOfRangeException(nameof(eventType), eventType, "Unsupported event type.")
_ => throw new ArgumentOutOfRangeException($"{eventType}", eventType, "Unsupported event type.")
};
}

Expand Down Expand Up @@ -481,7 +481,7 @@
{
var provider = Activator.CreateInstance(TypedRecordHandlerProvider)!;
// Assume the provider has a Create() method that returns the handler
var createMethod = TypedRecordHandlerProvider.GetMethod("Create");

Check warning on line 484 in libraries/src/AWS.Lambda.Powertools.BatchProcessing/BatchProcessorAttribute.cs

View workflow job for this annotation

GitHub Actions / build

'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in call to 'System.Type.GetMethod(String)'. The return value of method 'AWS.Lambda.Powertools.BatchProcessing.BatchProcessorAttribute.TypedRecordHandlerProvider.get' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
if (createMethod == null)
{
throw new InvalidOperationException($"TypedRecordHandlerProvider '{TypedRecordHandlerProvider.Name}' must have a 'Create()' method.");
Expand Down Expand Up @@ -512,7 +512,7 @@
{
var provider = Activator.CreateInstance(TypedRecordHandlerWithContextProvider)!;
// Assume the provider has a Create() method that returns the handler
var createMethod = TypedRecordHandlerWithContextProvider.GetMethod("Create");

Check warning on line 515 in libraries/src/AWS.Lambda.Powertools.BatchProcessing/BatchProcessorAttribute.cs

View workflow job for this annotation

GitHub Actions / build

'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in call to 'System.Type.GetMethod(String)'. The return value of method 'AWS.Lambda.Powertools.BatchProcessing.BatchProcessorAttribute.TypedRecordHandlerWithContextProvider.get' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
if (createMethod == null)
{
throw new InvalidOperationException($"TypedRecordHandlerWithContextProvider '{TypedRecordHandlerWithContextProvider.Name}' must have a 'Create()' method.");
Expand All @@ -533,7 +533,7 @@
return new TypedBatchProcessingAspectHandler<TEvent, TRecord>(typedBatchProcessor, typedHandler, hasContext, deserializationOptions, processingOptions);
}

private BatchEventType GetEventTypeFromArgs(IReadOnlyList<object> args)
private static BatchEventType GetEventTypeFromArgs(IReadOnlyList<object> args)
{
if (args == null || args.Count == 0 || !EventTypes.TryGetValue(args[0].GetType(), out var eventType))
{
Expand Down
Loading