Does anyone know why IntelliJ IDEA is flagging “errors” that don’t really exist?
Here’s an example of what I’m seeing:

In InputSrourceDataInputStrream.scala, the following code viewed in Notepad++:

  def peek(): Char = {
    checkNeedsRefetch()

    val decodedChars = dis.cst.charIteratorState.decodedChars
    if (decodedChars.remaining >= 1) {
      decodedChars.get(decodedChars.position())
    } else if (dis.cst.charIteratorState.moreDataAvailable) {
      fetch()
      peek()
    } else {
      -1.toChar
    }
  }

However, the IntelliJ IDEA adds “ : Int” to as highlighted below:

  def peek(): Char = {
    checkNeedsRefetch()

    val decodedChars = dis.cst.charIteratorState.decodedChars
    if (decodedChars.remaining >= 1) {
      decodedChars.get(decodedChars.position())
    } else if (dis.cst.charIteratorState.moreDataAvailable) {
      fetch()
      peek()
    } else {
      -1.toChar
    } : Int
  }

It furthermore, flags this as an error: “Type mismatch. Required: Char, found: 
Int”
The “ :Int” seems to be added as a display indicator only and IS NOT COPIED if 
you try to copy and paste it.

The code is unmodified from GitHub and seems to build cleanly.

I would really like to eliminate these erroneous and distracting error 
indications.

Reply via email to