java-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/TypeHelper.java
public static boolean isCompatibleInALooseInvocationContext(ResolvedType s, ResolvedType t) {
        // Loose invocation contexts allow a more permissive set of conversions, because they are only used for a
        // particular invocation if no applicable declaration can be found using strict invocation contexts. Loose
        // invocation contexts allow the use of one of the following:
        //
        // - an identity conversion (§5.1.1)

        if (s.equals(t)) {
            return true;
        }

        // - a widening primitive conversion (§5.1.2)

        if (s.isPrimitive() && t.isPrimitive() && areCompatibleThroughWideningPrimitiveConversion(s, t)) {
            return true;
        }

        // - a widening reference conversion (§5.1.5)

        if (s.isReferenceType() && t.isReferenceType() && areCompatibleThroughWideningReferenceConversion(s, t)) {
            return true;
        }

        // - a boxing conversion (§5.1.7) optionally followed by widening reference conversion

        if (s.isPrimitive() && t.isReferenceType() &&
                areCompatibleThroughWideningReferenceConversion(toBoxedType(s.asPrimitive()), t)) {
            return true;
        }

        // - an unboxing conversion (§5.1.8) optionally followed by a widening primitive conversion

        if (isUnboxable(s) && s.isReferenceType() && t.isPrimitive() &&
                areCompatibleThroughWideningPrimitiveConversion(toUnboxedType(s.asReferenceType()), t)) {
            return true;
        }

        // If, after the conversions listed for an invocation context have been applied, the resulting type is a raw
        // type (§4.8), an unchecked conversion (§5.1.9) may then be applied.
        //
        // A value of the null type (the null reference is the only such value) may be assigned to any reference type
        if (s.isNull() && t.isReferenceType()) {
            return true;
        }

        //throw new UnsupportedOperationException("isCompatibleInALooseInvocationContext unable to decide on s=" + s + ", t=" + t);
        // TODO FIXME
        return t.isAssignableBy(s);
    }
public static boolean isCompatibleInALooseInvocationContext(ResolvedType s, ResolvedType t) {
        // Loose invocation contexts allow a more permissive set of conversions, because they are only used for a
        // particular invocation if no applicable declaration can be found using strict invocation contexts. Loose
        // invocation contexts allow the use of one of the following:
        //
        // - an identity conversion (§5.1.1)

        if (s.equals(t)) {
            return true;
        }

        // - a widening primitive conversion (§5.1.2)

        if (s.isPrimitive() && t.isPrimitive() && areCompatibleThroughWideningPrimitiveConversion(s, t)) {
            return true;
        }

        // - a widening reference conversion (§5.1.5)

        if (s.isReferenceType() && t.isReferenceType() && areCompatibleThroughWideningReferenceConversion(s, t)) {
            return true;
        }

        // - a boxing conversion (§5.1.7) optionally followed by widening reference conversion

        if (s.isPrimitive() && t.isReferenceType() &&
                areCompatibleThroughWideningReferenceConversion(toBoxedType(s.asPrimitive()), t)) {
            return true;
        }

        // - an unboxing conversion (§5.1.8) optionally followed by a widening primitive conversion

        if (isUnboxable(s) && s.isReferenceType() && t.isPrimitive() &&
                areCompatibleThroughWideningPrimitiveConversion(toUnboxedType(s.asReferenceType()), t)) {
            return true;
        }

        // If, after the conversions listed for an invocation context have been applied, the resulting type is a raw
        // type (§4.8), an unchecked conversion (§5.1.9) may then be applied.
        //
        // A value of the null type (the null reference is the only such value) may be assigned to any reference type
        if (s.isNull() && t.isReferenceType()) {
            return true;
        }

        //throw new UnsupportedOperationException("isCompatibleInALooseInvocationContext unable to decide on s=" + s + ", t=" + t);
        // TODO FIXME
        return t.isAssignableBy(s);
    }
public static boolean isCompatibleInALooseInvocationContext ( ResolvedType s , ResolvedType t ) { // Loose invocation contexts allow a more permissive set of conversions, because they are only used for a // particular invocation if no applicable declaration can be found using strict invocation contexts. Loose // invocation contexts allow the use of one of the following: // // - an identity conversion (§5.1.1) if ( s . equals ( t ) ) { return true ; } // - a widening primitive conversion (§5.1.2) if ( s . isPrimitive ( ) && t . isPrimitive ( ) && areCompatibleThroughWideningPrimitiveConversion ( s , t ) ) { return true ; } // - a widening reference conversion (§5.1.5) if ( s . isReferenceType ( ) && t . isReferenceType ( ) && areCompatibleThroughWideningReferenceConversion ( s , t ) ) { return true ; } // - a boxing conversion (§5.1.7) optionally followed by widening reference conversion if ( s . isPrimitive ( ) && t . isReferenceType ( ) && areCompatibleThroughWideningReferenceConversion ( toBoxedType ( s . asPrimitive ( ) ) , t ) ) { return true ; } // - an unboxing conversion (§5.1.8) optionally followed by a widening primitive conversion if ( isUnboxable ( s ) && s . isReferenceType ( ) && t . isPrimitive ( ) && areCompatibleThroughWideningPrimitiveConversion ( toUnboxedType ( s . asReferenceType ( ) ) , t ) ) { return true ; } // If, after the conversions listed for an invocation context have been applied, the resulting type is a raw // type (§4.8), an unchecked conversion (§5.1.9) may then be applied. // // A value of the null type (the null reference is the only such value) may be assigned to any reference type if ( s . isNull ( ) && t . isReferenceType ( ) ) { return true ; } //throw new UnsupportedOperationException("isCompatibleInALooseInvocationContext unable to decide on s=" + s + ", t=" + t); // TODO FIXME return t . isAssignableBy ( s ) ; }
see https://docs.oracle.com/javase/specs/jls/se8/html/jls-5.html#jls-5.3
@param s
@param t
@return
see https : // docs . oracle . com / javase / specs / jls / se8 / html / jls - 5 . html#jls - 5 . 3