Edited the answer based on Bastien Jansen comment.
Seems that there is another project setting that affects the compiler level. A subtle indication of this problem is when your compiler starts complaining of the source and target java version being different from the one you specified while you are compiling the code
Warning:java: source value 1.5 is obsolete and will be removed in a future release Warning:java: target value 1.5 is obsolete and will be removed in a future release Warning:java: To suppress warnings about obsolete options, use -Xlint:-options.
To get rid of this, you need to open up
File -> Project Structure -> Project Settings -> Modules -> "Your Module Name" -> Sources -> Language Level
and change that to the desired level i.e 1.8 or the Project Default language level
Related Posts:
- Java 8 Iterable.forEach() vs foreach loop
- What’s the difference between map() and flatMap() methods in Java 8?
- Lombok and Maven
- typeof in Java 8
- What does the arrow operator, ‘->’, do in Java?
- Error: Could not find or load main class in intelliJ IDE
- :: (double colon) operator in Java 8
- LocalDate to java.util.Date and vice versa simplest conversion?
- unused import statement for used ones in IntelliJ IDEA
- Error: JavaFX runtime components are missing, and are required to run this application with JDK 11
- Where to get the tools.jar to use with the Java 8 jdk early release
- How to fix “unsupported class file major version 60” in IntelliJ?
- intellij incorrectly saying no beans of type found for autowired repository
- JAVA_HOME should point to a JDK not a JRE
- Error:java: javacTask: source release 8 requires target release 1.8
- IDEA: javac: source release 1.7 requires target release 1.7
- IntelliJ – Can’t start – “JAVA_HOME does not point to a valid JVM installation”
- Tomcat 8 Maven Plugin for Java 8
- Correct way to add external jars (lib/*.jar) to an IntelliJ IDEA project
- How to convert an Instant to a date format?
- Error: Module not specified (IntelliJ IDEA)
- Invalid signature file digest for Manifest main attributes exception while trying to run jar file
- Using JavaFX in JRE 8, “Access restriction” error
- The target type of this expression must be a functional interface in MethodReferences
- Should I set a MaxMetaspaceSize?
- “Cannot start compilation: the output path is not specified for module…”
- What is the purpose of the default keyword in Java?
- intellij idea – Error: java: invalid source release 1.9
- String index out of bounds exception java
- Java “lambda expressions not supported at this language level”
- Issue installing Netbeans in Windows 10: Java SE Development Kit (JDK) was not found on this computer
- Class JavaLaunchHelper is implemented in two places
- IntelliJ IDEA “The selected directory is not a valid home for JDK”
- What is the best way to implement constants in Java?
- What is the reason behind “non-static method cannot be referenced from a static context”?
- What does ” || ” mean in Java? [duplicate]
- “Error occurred during initialization of VM; Could not reserve enough space for object heap” using -Xmx3G
- “int cannot be dereferenced” in Java
- What is a Key-Value Pair?
- Create ArrayList from array
- What is null in Java?
- What is a serialVersionUID and why should I use it?
- SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”
- The difference between += and =+
- exception in initializer error in java when using Netbeans
- MacOS Catalina(v 10.15.3): Error: “chromedriver” cannot be opened because the developer cannot be verified. Unable to launch the chrome browser
- Can I catch multiple Java exceptions in the same catch clause?
- What is the use of printStackTrace() method in Java?
- How do I limit the number of decimals printed for a double?
- Please initialize the log4j system properly warning
- what does Dead Code mean under Eclipse IDE Problems Section
- Java compressing Strings
- Can an abstract class have a constructor?
- org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when ‘hibernate.dialect’ not set
- “NoClassDefFoundError: Could not initialize class” error
- Recursive print Factorial
- Recompile with -Xlint:unchecked for detail error in java
- Convert array of strings into a string in Java
- What is Serialization?
- SSL and cert keystore
- Generate a random double in a range
- Eclipse “Error: Could not find or load main class”
- How to get locator of current web element?
- javax.naming.NameNotFoundException
- How to print out all the elements of a List in Java?
- If Java is Strongly typed then why does this code compile?
- Error: cannot find symbol ArrayList
- Choosing the best concurrency list in Java
- Why nextLine() and not nextString() ?
- Very Basic Java
- What does it mean: JavaFX application class must extend javafx.application.Application?
- Using Math.round to round to one decimal place?
- How to replace a substring of a string
- accessing a variable from another class
- “Javac” doesn’t work correctly on Windows 10
- How to convert a byte array to a hex string in Java?
- How to get the last value of an ArrayList
- ArithmeticException: “Non-terminating decimal expansion; no exact representable decimal result”
- How to extract a substring using regex
- .class vs .java
- Case expressions must be constant expressions for static final int?
- try catch ArrayIndexOutOfBoundsException?
- Response has aready been committed
- How do I test a class that has private methods, fields or inner classes?
- how to make jni.h be found?
- difference between System.out.println() and System.err.println()
- “Source folder is not a Java project” error in eclipse
- How to memory profile in Java?
- java.lang.IllegalThreadStateException
- What is an
method in Java? Can it be overridden? - The sum of all squares between 1 and 100 inclusive?
- How do I initialize a byte array in Java?
- How to map a composite key with JPA and Hibernate?
- Javac “cannot find symbol”
- Any shortcut to initialize all array elements to zero?
- How to specify filepath in java?
- dequeue and enqueue methods in queue implementation
- How to specify the default error page in web.xml?
- Exception is never thrown in body of corresponding try statement
- Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.7.1 from/to central (http://repo1.maven.org/maven2)