Skip to content

Commit 234bb6d

Browse files
authored
Allow single Object fields to accept any type in acceptChange (#19)
* allow single Object fields to accept any type in acceptChange * move Object check under the existing isAnyFieldSingle check
1 parent 8c5a1e3 commit 234bb6d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main/java/com/sovdee/oopsk/elements/expressions/ExprFieldAccess.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ protected Object[] get(Event event, Struct[] source) {
184184

185185
// if we have a single field, we can delegate to that type's changer, so get all the classes from the changers
186186
if (isAnyFieldSingle) {
187+
// if a field is single and object, it should accept all changers
188+
if (returnType == Object.class) {
189+
return new Class<?>[]{Object.class};
190+
}
191+
187192
Set<Class<?>> distinctClasses = Arrays.stream(returnTypes)
188193
.map(Classes::getSuperClassInfo)
189194
.filter(Objects::nonNull)

0 commit comments

Comments
 (0)