java-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/TypeHelper.java
public static Pair<ResolvedType, Boolean> groundTargetTypeOfLambda(LambdaExpr lambdaExpr, ResolvedType T, TypeSolver typeSolver) {
        // The ground target type is derived from T as follows:
        //
        boolean used18_5_3 = false;

        boolean wildcardParameterized = T.asReferenceType().typeParametersValues().stream()
                .anyMatch(tp -> tp.isWildcard());
        if (wildcardParameterized) {
            // - If T is a wildcard-parameterized functional interface type and the lambda expression is explicitly typed,
            //   then the ground target type is inferred as described in §18.5.3.

            if (ExpressionHelper.isExplicitlyTyped(lambdaExpr)) {
                used18_5_3 = true;
                throw new UnsupportedOperationException();
            }

            // - If T is a wildcard-parameterized functional interface type and the lambda expression is implicitly typed,
            //   then the ground target type is the non-wildcard parameterization (§9.9) of T.

            else {
                return new Pair<>(nonWildcardParameterizationOf(T.asReferenceType(), typeSolver), used18_5_3);
            }
        }

        // - Otherwise, the ground target type is T.
        return new Pair<>(T, used18_5_3);
    }
public static Pair<ResolvedType, Boolean> groundTargetTypeOfLambda(LambdaExpr lambdaExpr, ResolvedType T, TypeSolver typeSolver) {
        // The ground target type is derived from T as follows:
        //
        boolean used18_5_3 = false;

        boolean wildcardParameterized = T.asReferenceType().typeParametersValues().stream()
                .anyMatch(tp -> tp.isWildcard());
        if (wildcardParameterized) {
            // - If T is a wildcard-parameterized functional interface type and the lambda expression is explicitly typed,
            //   then the ground target type is inferred as described in §18.5.3.

            if (ExpressionHelper.isExplicitlyTyped(lambdaExpr)) {
                used18_5_3 = true;
                throw new UnsupportedOperationException();
            }

            // - If T is a wildcard-parameterized functional interface type and the lambda expression is implicitly typed,
            //   then the ground target type is the non-wildcard parameterization (§9.9) of T.

            else {
                return new Pair<>(nonWildcardParameterizationOf(T.asReferenceType(), typeSolver), used18_5_3);
            }
        }

        // - Otherwise, the ground target type is T.
        return new Pair<>(T, used18_5_3);
    }
public static Pair < ResolvedType , Boolean > groundTargetTypeOfLambda ( LambdaExpr lambdaExpr , ResolvedType T , TypeSolver typeSolver ) { // The ground target type is derived from T as follows: // boolean used18_5_3 = false ; boolean wildcardParameterized = T . asReferenceType ( ) . typeParametersValues ( ) . stream ( ) . anyMatch ( tp -> tp . isWildcard ( ) ) ; if ( wildcardParameterized ) { // - If T is a wildcard-parameterized functional interface type and the lambda expression is explicitly typed, //   then the ground target type is inferred as described in §18.5.3. if ( ExpressionHelper . isExplicitlyTyped ( lambdaExpr ) ) { used18_5_3 = true ; throw new UnsupportedOperationException ( ) ; } // - If T is a wildcard-parameterized functional interface type and the lambda expression is implicitly typed, //   then the ground target type is the non-wildcard parameterization (§9.9) of T. else { return new Pair <> ( nonWildcardParameterizationOf ( T . asReferenceType ( ) , typeSolver ) , used18_5_3 ) ; } } // - Otherwise, the ground target type is T. return new Pair <> ( T , used18_5_3 ) ; }
See JLS 15.27.3. Type of a Lambda Expression
@return
See JLS 15 . 27 . 3 . Type of a Lambda Expression