From a172a1fd4475bb7f58b704ae40bd6744349765ac Mon Sep 17 00:00:00 2001 From: Daniel Fangl Date: Wed, 3 Nov 2021 13:03:54 +0100 Subject: [PATCH 1/2] Filter bridge methods to circumvent multiple matching methods error on override of generic interfaces --- src/main/java/cloud/localstack/LambdaExecutor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/cloud/localstack/LambdaExecutor.java b/src/main/java/cloud/localstack/LambdaExecutor.java index 95290fb..dfd9fb6 100644 --- a/src/main/java/cloud/localstack/LambdaExecutor.java +++ b/src/main/java/cloud/localstack/LambdaExecutor.java @@ -143,10 +143,10 @@ public static void main(String[] args) throws Exception { */ private static Method getHandlerMethodByName(Object handler, String handlerMethodName) throws MultipleMatchingHandlersException, NoMatchingHandlerException { List handlerMethods = Arrays.stream(handler.getClass().getMethods()) - .filter(method -> method.getName().equals(handlerMethodName)) + .filter(method -> method.getName().equals(handlerMethodName) && !method.isBridge()) // we do not want bridge methods here .collect(Collectors.toList()); if (handlerMethods.size() > 1) { - throw new MultipleMatchingHandlersException("Multiple matching headers: " + handlerMethods); + throw new MultipleMatchingHandlersException("Multiple matching handlers: " + handlerMethods); } else if (handlerMethods.isEmpty()) { throw new NoMatchingHandlerException("No matching handlers for method name: " + handlerMethodName); From fc7dd1c385da743ce9a5dfaf2cb4cd506ee043a6 Mon Sep 17 00:00:00 2001 From: Daniel Fangl Date: Wed, 3 Nov 2021 15:54:47 +0100 Subject: [PATCH 2/2] bump version, add changelog --- README.md | 3 ++- pom.xml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7bea640..b5bc66d 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ Simply add the following dependency to your `pom.xml` file: cloud.localstack localstack-utils - 0.2.16 + 0.2.17 ``` @@ -108,6 +108,7 @@ make build ## Change Log +* v0.2.17: Fix issue with using :: to specify lambda handler which implements the RequestHandler interface, revert removal of EC2HostNameResolver annotation * v0.2.16: Add support for :: notation for Java Lambda handler specification, fix failing QLDB tests, fix failing tests with Jexter rules/extensions * v0.2.15: Fix Kinesis CBOR tests; fix project setup and classpath for SDK v1/v2 utils; fix awaiting results in tests using async clients; refactor classpath setup for v1/v2 SDKs; fall back to using edge port if port mapping cannot be determined from container * v0.2.14: Add ability to get handler class name through `_HANDLER` environment variable like on real AWS and Lambci environment diff --git a/pom.xml b/pom.xml index 7177a94..07e4015 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ cloud.localstack localstack-utils jar - 0.2.16 + 0.2.17 localstack-utils Java utilities for the LocalStack platform.