Skip to content

Commit 3dfe6f3

Browse files
committed
Fix default output type conversion check
As a great man once said, "this behavior is fundamentally wrong." By default, a converter should match if its known output type is compatible with the requested output type - not the other way around. That is, it's OK to return a subclass of the requested type. Returning a superclass is not guaranteed to be OK.
1 parent 31c38bd commit 3dfe6f3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/org/scijava/convert/AbstractConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public boolean canConvert(final Object src, final Class<?> dest) {
100100
@Override
101101
public boolean canConvert(final Class<?> src, final Class<?> dest) {
102102
return ConversionUtils.canCast(src, getInputType()) &&
103-
ConversionUtils.canCast(dest, getOutputType());
103+
ConversionUtils.canCast(getOutputType(), dest);
104104
}
105105

106106
@Override

0 commit comments

Comments
 (0)