Studio incorrectly flags error for view parameter

Not sure if this is a bug or not, but when I’m using the datamanager.reload function, it flags the view parameter as an error, even though the view name is valid.

Screenshot 2020-04-28 at 16.10.35

Hi,

CUBA Studio is based on the IntelliJ platform and inherits THOUSANDS of background checks, inspections etc from it.
Not all of highlights, not all of underlines in the CUBA Studio come from the Studio team :slight_smile:

Knowing the reason of the highlighting isn’t hard. You just have to bring mouse over the highlighted peace of code.

I bet that in your case it is the spellchecker. You can configure spellchecker in the File -> Settings dialog (search by “spell”). Also if you press Alt+Enter, you can add a word to the project-level dictionary.
image

Hi there.

No, it’s not a typo error.

val refreshedManuscript = dataManager.reload(manuscript, "manuscript-assignment-view")

As you can see, ‘manuscript’ is correctly spelled. The error that appears is manuscript unexpected.

Now what makes me think the problem is with with Studio, is this piece of code I use elsewhere:

 dataManager.load(Manuscript::class.java)
                    .query(FIND_MANUSCRIPT_BY_REFERENCE_JPQL)
                    .parameter("manuscriptReference", manuscriptReference)
                    .view("manuscript-assignment-view")
                    .one()

In this case, the view call is happy and with the word ‘manuscript’ and it will allow me to ctrl-space on the view parameter and give me a list of alternative views for the Manuscript class. In the case of the reload call this doesn’t happen. Now I assumed that it was some function of Studio that was finding the correct list of possible views in view call, but was unable to find them in the reload call. Why? Not sure, but I suspected it was because it was able to check the type because the load at the top of the call chain included the name of the class with the view I was interested in.

I am not aware of any warning issued by the Studio with such (obscure) message. Probably it is the warning from one of the plugins installed to your IDE.

It’s called a “reference” in IntelliJ terms. I’ve checked, and it looks like a bug in the Kotlin support. In identical Java code construct in the DataManager#reload argument reference works fine.
I’ve created a ticket for this case: https://youtrack.cuba-platform.com/issue/STUDIO-8381