GH-1204 Polishing aftre refactoring of TypeTools

This commit is contained in:
Oleg Zhurakousky
2024-11-24 18:07:40 +01:00
parent 5e179a2052
commit a3b45f4aa7
4 changed files with 7 additions and 46 deletions

View File

@@ -121,7 +121,7 @@ public class FunctionRegistration<T> implements BeanNameAware {
if (KotlinDetector.isKotlinPresent() && this.target instanceof KotlinLambdaToFunctionAutoConfiguration.KotlinFunctionWrapper) {
return this;
}
Type discoveredFunctionType = FunctionTypeUtils.discoverFunctionTypeFromClass(this.target.getClass());
Type discoveredFunctionType = type; //FunctionTypeUtils.discoverFunctionTypeFromClass(this.target.getClass());
if (discoveredFunctionType == null) { // only valid for Kafka Stream KStream[] return type.
return null;
}
@@ -146,7 +146,6 @@ public class FunctionRegistration<T> implements BeanNameAware {
+ discoveredFunctionType + "; Provided: " + type);
}
return this;
}

View File

@@ -180,6 +180,10 @@ public class BeanFactoryAwareFunctionRegistry extends SimpleFunctionRegistry imp
else {
functionType = FunctionTypeUtils.discoverFunctionType(functionCandidate, functionName, this.applicationContext);
}
if (logger.isDebugEnabled()) {
logger.debug("Discovered function type for: " + functionDefinition + " - " + functionType);
}
if (functionRegistration == null) {
functionRegistration = new FunctionRegistration(functionCandidate, functionName).type(functionType);
}

View File

@@ -371,7 +371,7 @@ public final class FunctionTypeUtils {
else {
inputType = resolvableInputType.getType();
}
return inputType;
return inputType instanceof TypeVariable ? Object.class : inputType;
}
@SuppressWarnings("rawtypes")
@@ -465,7 +465,7 @@ public final class FunctionTypeUtils {
else {
outputType = resolvableOutputType.getType();
}
return outputType;
return outputType instanceof TypeVariable ? Object.class : outputType;
}
public static Type getImmediateGenericType(Type type, int index) {