Skip to content

Commit b407217

Browse files
Treiblesschorlectrueden
authored andcommitted
Switch order of equals comparison
The variable toTypeArg may be null, hence this may throw an NPE. Furthermore, fixes bug: for isAssignable(List<Number>, List<T>) with T extends Number, true was returned. However, this assignment is not allowed.
1 parent 0b1df59 commit b407217

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/main/java/org/scijava/util/Types.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1783,7 +1783,7 @@ private static boolean isAssignable(final Type type,
17831783
// parameters must either be absent from the subject type, within
17841784
// the bounds of the wildcard type, or be an exact match to the
17851785
// parameters of the target type.
1786-
if (fromTypeArg != null && !toTypeArg.equals(fromTypeArg) &&
1786+
if (fromTypeArg != null && !fromTypeArg.equals(toTypeArg) &&
17871787
!(toTypeArg instanceof WildcardType && isAssignable(fromTypeArg,
17881788
toTypeArg, typeVarAssigns)))
17891789
{

0 commit comments

Comments
 (0)