I believe one can adjust the various suggestions it makes, but IntelliJ often 
seems to suggest types where it thinks they would add value. The colorization 
it uses indicates that this is it's suggestions, not things actually in the 
text, and my eye has learned to read past these. There are times when it 
lengthens lines to where you have to scroll horizontally however, which does 
bug me.

In settings I did spot this, which may or may not be helpful:

[cid:929e2d72-79d9-49d2-8219-0da33aecf20f]

In your code, does peek() perhaps return type Int? If so it's flagging the 
inconsistency between Char and Int usage. If not I have no clue why it is 
suggesting Int type here.


________________________________
From: Larry Barber <larry.bar...@nteligen.com>
Sent: Friday, November 6, 2020 2:15 PM
To: dev@daffodil.apache.org <dev@daffodil.apache.org>
Subject: IntelliJ IDEA is flagging “errors”


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