Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why would IntelliJ IDEA give an 'Expression statement is not an assignment or call' error for System.out.println?

Here is the code:

public class TryStuffOutHere
{
    public static void main(String[] args)
        {
            System.out.println("Set the customer's name: ");
        }

}

When I type this, IntelliJ IDEA stops highlighting the string "Set the customer's name: " in all one color like it does for other string literals, and puts the red squiggly line between the words and displays "Expression statement is not an assignment or call." But, if I change the line to:

System.out.print("Set the customer's name: ");

The string again looks like a normal string assignment (all one color, no inspection flagging).

Even declaring the string separately and outputting the variable still produces the issue.

I've attached three images illustrating what I am talking about. Does anyone have any ideas about what is going on? Apparently, I am not allowed to post images yet. If you want/need screenshots, let me know. I'd be glad to sent them your way.

UPDATE (April 28th, 2013): Well, I now have enough points to add screenshots. So, here they are:

Image 1
enter image description here

Image 2
enter image description here

Image 3
enter image description here

Image 4
enter image description here

I've also discovered that the 10-12 second delay after invalidating the caches and restarting the IDE is because the IDE is still "updating the indices". After it does, the issue immediately pops up...sometimes. Further complicating it is that invalidating the caches and restarting has worked twice, until I quit and open the IDE again, at which point it resurfaces.

like image 512
nihilon Avatar asked Apr 28 '13 07:04

nihilon


1 Answers

It looks like it tries to interpret the code as some other language than java.

Do yo have some extra plugins active? Try to disable as many as possible just to make sure that none of them are interfering

like image 162
Andreas Wederbrand Avatar answered Oct 08 '22 00:10

Andreas Wederbrand