Revert use of yield in switch expressions due to Eclipse compiler error

See gh-31531
This commit is contained in:
Sam Brannen
2023-12-04 16:43:15 +01:00
parent d71853f105
commit b69e5acfe3
2 changed files with 38 additions and 36 deletions

View File

@@ -720,20 +720,26 @@ public class MvcUriComponentsBuilder {
@Override
@Nullable
public Object intercept(@Nullable Object obj, Method method, Object[] args, @Nullable MethodProxy proxy) {
return switch (method.getName()) {
case "getControllerType" -> this.controllerType;
case "getControllerMethod" -> this.controllerMethod;
case "getArgumentValues" -> this.argumentValues;
switch (method.getName()) {
case "getControllerType" -> {
return this.controllerType;
}
case "getControllerMethod" -> {
return this.controllerMethod;
}
case "getArgumentValues" -> {
return this.argumentValues;
}
default -> {
if (ReflectionUtils.isObjectMethod(method)) {
yield ReflectionUtils.invokeMethod(method, obj, args);
return ReflectionUtils.invokeMethod(method, obj, args);
}
else {
this.controllerMethod = method;
this.argumentValues = args;
Class<?> returnType = method.getReturnType();
try {
yield (returnType == void.class ? null : returnType.cast(initProxy(returnType, this)));
return (returnType == void.class ? null : returnType.cast(initProxy(returnType, this)));
}
catch (Throwable ex) {
throw new IllegalStateException(
@@ -741,7 +747,7 @@ public class MvcUriComponentsBuilder {
}
}
}
};
}
}
@Override