gemini back 4
This commit is contained in:
@@ -553,6 +553,27 @@ import java.util.*;
|
|||||||
String val = e;
|
String val = e;
|
||||||
return !val.equals(val.toUpperCase()) || val.length() <= 1;
|
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());
|
polymorphicEvents = polymorphicEvents.stream().distinct().collect(java.util.stream.Collectors.toList());
|
||||||
|
|
||||||
@@ -606,6 +627,8 @@ import java.util.*;
|
|||||||
|
|
||||||
protected boolean isTypeCompatible(String actualType, String expectedType) {
|
protected boolean isTypeCompatible(String actualType, String expectedType) {
|
||||||
if (actualType == null || expectedType == null) return true;
|
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 (expectedType.length() == 1 && Character.isUpperCase(expectedType.charAt(0))) return true;
|
||||||
if (actualType.length() == 1 && Character.isUpperCase(actualType.charAt(0))) return true;
|
if (actualType.length() == 1 && Character.isUpperCase(actualType.charAt(0))) return true;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user