unbox(newParameter.getParameterType()) );
/** * Determines the numeric conversion type, taking lossiness into consideration. * Returns {@link ConversionType#NONE} if a determination could not be made. */ private ConversionType getNumericConversion( @NotNull final TypeReference target, @NotNull final TypeReference source, @Nullable final Expression value) { final TypeReference unboxedTarget = unbox(target); final TypeReference unboxedSource = unbox(source); final JvmType jvmSource = unboxedSource.getSimpleType(); final JvmType jvmTarget = unboxedTarget.getSimpleType(); if (jvmSource == JvmType.Boolean || !jvmSource.isNumeric() || jvmTarget == JvmType.Boolean || !jvmTarget.isNumeric()) { return ConversionType.NONE; } final ResolveResult resolveResult = value != null ? _resolver.apply(value) : null; final Object constantValue = resolveResult != null ? resolveResult.getConstantValue() : null; if (constantValue != null && isValidPrimitiveLiteralAssignment(unboxedTarget, constantValue) && isValidPrimitiveLiteralAssignment(unboxedSource, constantValue)) { return ConversionType.IDENTITY; } return MetadataHelper.getNumericConversionType(target, source); }
/** * Determines the conversion type, taking lossiness into consideration for numeric conversions. * Returns {@link ConversionType#NONE} if a determination could not be made. */ private ConversionType getConversion( @NotNull final TypeReference target, @NotNull final TypeReference source, @Nullable final Expression value) { final TypeReference unboxedTarget = unbox(target); final TypeReference unboxedSource = unbox(source); if (unboxedTarget.getSimpleType().isNumeric() && unboxedSource.getSimpleType().isNumeric()) { return getNumericConversion(target, source, value); } return MetadataHelper.getConversionType(target, source); }