def _final_is_string_literal(line, index_of_final):
    """Checks whether the `final` modifier is inside a string literal.

    Args:
        line: the line to check.
        index_of_final: the index where the `final` keyword is located in the line.

    Returns:
        bool: `True` if the `final` modifier is inside a literal and `False` otherwise.
    """
    if index_of_final <= 0:
        return False

    preceding_line = line[:index_of_final]
    quotes_count = preceding_line.count('"')
    there_is_unclosed_quote = quotes_count % 2 > 0
    return there_is_unclosed_quote