gemini back 4

This commit is contained in:
2026-06-27 05:56:23 +02:00
parent c35c75efa3
commit 0bda5a0aeb

View File

@@ -554,6 +554,27 @@ import java.util.*;
return !val.equals(val.toUpperCase()) || val.length() <= 1;
});
String targetMethod = path.get(path.size() - 1);
int eventParamIndex = getParameterIndex(targetMethod, event);
if (eventParamIndex < 0) {
eventParamIndex = 0;
}
String expectedType = getParameterType(targetMethod, eventParamIndex);
if (expectedType != null) {
final String expType = expectedType;
boolean isExpectedEnum = context.getEnumValues(expType) != null;
polymorphicEvents.removeIf(e -> {
if (e.contains(".")) {
String actualType = e.substring(0, e.lastIndexOf('.'));
boolean isActualEnum = context.getEnumValues(actualType) != null;
if (isExpectedEnum && isActualEnum) {
return !isTypeCompatible(actualType, expType);
}
}
return false;
});
}
polymorphicEvents = polymorphicEvents.stream().distinct().collect(java.util.stream.Collectors.toList());
if (!resolvedValue.equals(event) || !polymorphicEvents.isEmpty()) {
@@ -606,6 +627,8 @@ import java.util.*;
protected boolean isTypeCompatible(String actualType, String expectedType) {
if (actualType == null || expectedType == null) return true;
if (expectedType.equals("Object") || expectedType.equals("java.lang.Object")) return true;
if (actualType.equals("Object") || actualType.equals("java.lang.Object")) return true;
if (expectedType.length() == 1 && Character.isUpperCase(expectedType.charAt(0))) return true;
if (actualType.length() == 1 && Character.isUpperCase(actualType.charAt(0))) return true;