I am trying to use the JEP 359: Records (Preview) feature in Java with IntelliJ 2020.1.1 RC.
I defined a class like this:
package work.basil.example;
import java.time.LocalTime;
public record LocalTimeRange(LocalTime start , LocalTime stop)
{
}
When I run a main method in another class using this LocalTimeRange
class, no problem.
When I do a Maven install
I get this error:
Error:(6,8) java: records are a preview feature and are disabled by default.
➥ How can I help Maven complete its install
operation?
I used the Maven Quickstart Archetype, version 1.4. I then edited the POM to use all the latest versions of its various dependencies.
I have "Project Structure" settings:
Project Settings > Project > Project SDK > 14
Project Settings > Project > Project language level > 14 (Preview) - Records, patterns, text blocks
Project Settings > Modules > Project language level > 14 (Preview) - Records, patterns, text blocks
I have "Preferences" settings:
Build, Execution, Deployment > Compiler > Java Compiler > Per-module bytecode version > Target bytecode version > 14
Running this Java: openjdk 14.0.1 2020-04-14 OpenJDK Runtime Environment AdoptOpenJDK (build 14.0.1+7) OpenJDK 64-Bit Server VM AdoptOpenJDK (build 14.0.1+7, mixed mode, sharing)
Using:
IntelliJ IDEA 2020.1.1 (Ultimate Edition)
Build #IU-201.7223.58, built on April 26, 2020
Subscription is active until August 28, 2020
Runtime version: 11.0.6+8-b765.40 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o macOS 10.14.6
GC: ParNew, ConcurrentMarkSweep
Memory: 2200M
Cores: 6
Non-Bundled Plugins: com.github.leomillon.uuidgenerator