Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

7
  • If you are on Windows, is your environment variables properly setup? Can you double check which version of Java is being used to compile the project?
    – Konstantin
    Commented Aug 8, 2014 at 14:21
  • I am on Linux. Currently there's only one JRE/JDK installed on my system and it says "Java(TM) SE Runtime Environment (build 1.8.0_11-b12)" Commented Aug 8, 2014 at 14:54
  • Is your IntellJ version fairly recent? At least 13.1.x?
    – PM 77-1
    Commented Aug 8, 2014 at 17:32
  • Are you sure the Project SDK that is selected points to JDK 8, and that your modules Language level is also using the correct JDK?
    – mkobit
    Commented Dec 18, 2014 at 19:19
  • 1
    I just ran into this as well with 2017.1.3 My gradle project is definitely set to JDK 8 and it was even suggesting OptionalDouble and other classes from the same package. But it kept autocorrecting to the guava version of Optional and removing any manually added import for java.util.Optional. I fixed it by exiting, gradle cleaning, killing the IDE, editing the file manually outside of intellij, and then restarting intellij. The problem finally went away. It looks to me that the autocomplete data can get in a weird state sometimes. Commented Jun 6, 2017 at 12:22