Skip to content

Commit 2c3bf6d

Browse files
authored
Merge pull request #47171 from geoand/#47166
Fail when a ContextResolver is registered on the client via a lambda
2 parents e68efc1 + a8df2a4 commit 2c3bf6d

File tree

1 file changed

+4
-0
lines changed
  • independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/jaxrs

1 file changed

+4
-0
lines changed

independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/jaxrs/ConfigurationImpl.java

+4
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,10 @@ private void register(Object component, Integer priority) {
321321
Class<?> componentClass = component.getClass();
322322
Type[] args = Types.findParameterizedTypes(componentClass, ContextResolver.class);
323323
Class<?> key = args != null && args.length == 1 ? Types.getRawType(args[0]) : Object.class;
324+
// in this case we are almost certain a lambda was used so we should fail
325+
if ((key == Object.class) && component.getClass().isSynthetic()) {
326+
throw new IllegalArgumentException("Registering a ContextResolver via a lambda is not supported");
327+
}
324328
int effectivePriority = priority != null ? priority : determinePriority(component);
325329
contextResolvers.computeIfAbsent(key, k -> new MultivaluedTreeMap<>())
326330
.add(effectivePriority, (ContextResolver<?>) component);

0 commit comments

Comments
 (0)