Questions tagged [java-14]

Reference Implementation of version 14 of the Java SE Platform, as specified by JSR 389 in the Java Community Process. Use this tag for questions specific to Java 14, which is version 14 of the Java platform, released on 17 March 2020. In most cases you should also specify the java tag.

Version 14 of the Java programming language.

The reference implementation of Java 14 reached General Availability on 17 March 2020.

The JDK/14 production-ready binaries for Linux and Windows.

New features and improvements:

  • Pattern Matching for instanceof (Preview)
  • Packaging Tool (Incubator)
  • NUMA-Aware Memory Allocation for G1
  • JFR Event Streaming
  • Non-Volatile Mapped Byte Buffers
  • Helpful NullPointerExceptions
  • Records (Preview)
  • Switch Expressions (Standard)
  • Deprecate the Solaris and SPARC Ports
  • Remove the Concurrent Mark Sweep (CMS) Garbage Collector
  • ZGC on macOS
  • ZGC on Windows
  • Deprecate the ParallelScavenge + SerialOld GC Combination
  • Remove the Pack200 Tools and API
  • Text Blocks (Second Preview)
  • Foreign-Memory Access API (Incubator)

Specified by JSR 389 in the Java Community Process.

192 questions
18
votes
4 answers

Java records with nullable components

I really like the addition of records in Java 14, at least as a preview feature, as it helps to reduce my need to use lombok for simple, immutable "data holders". But I'm having an issue with the implementation of nullable components. I'm trying to…
Leikingo
  • 890
  • 3
  • 10
  • 23
18
votes
4 answers

Unable to deserialize when using new Record classes

I am trying to see if I can replace my existing Pojos with the new Record classes in Java 14. But unable to do so. Getting following error: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of com.a.a.Post…
kar
  • 4,791
  • 12
  • 49
  • 74
18
votes
7 answers

What JRE to use for Java 14?

There is a message Project has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 52.0 I googled "JRE required for JDK 14" and there…
Thicc
  • 195
  • 1
  • 1
  • 5
16
votes
1 answer

Java, Failed to exec spawn helper error since moving to Java 14 on linux

Just moved from Java 11 to Java 14 The following code is now failing on a linux machine: String linux_exe = System.getProperty("user.dir") + '/' + "fpcalc_arm32"; List params = new…
Paul Taylor
  • 13,411
  • 42
  • 184
  • 351
15
votes
2 answers

Java records and field comments

When we use classes in Java it's very simple to add JavaDoc/comment for each class field/method: class Product { //Product unique identifier private int id; } If we migrate these classes to Java records then it's unclear what is the the…
Sergiy
  • 1,854
  • 4
  • 22
  • 34
15
votes
2 answers

Java Records and Null Object Pattern?

Is there any way to do Null Objects with Java Records? With classes I'd do it like that: public class Id { public static final Id NULL_ID = new Id(); private String id; public Id(String id) { this.id = Objects.requireNonNull(id); } …
atamanroman
  • 11,607
  • 7
  • 57
  • 81
13
votes
2 answers

JDK 14 doesn't have rt.jar with it. Where are bootstrap classes then?

The only jar file I could find inside JAVA-HOME/lib was a file called jrt-fs.jar which is only 105 KB in size. So where are Runtime (bootstrap) classes then?
Joseph_Marzbani
  • 1,796
  • 4
  • 22
  • 36
13
votes
4 answers

Code signing + notarization using jpackage utility isn't working on macOS

For some context, I'm using the jpackage utility to try to create a signed DMG file to deliver to my users. The reason I need to sign this DMG is because I would like to notarize the software. By the way, I'm not sure if notarization is possible…
Soham
  • 762
  • 1
  • 5
  • 14
12
votes
2 answers

How can I use Java records as DTO with ModelMapper?

I'm refactoring my code. I want to use java records instead of java class in my DTO. To convert DTO to Entity, I'm using ModelMapper (version 2.3.5). When I try to get info about user (call method co convert Entity to DTO) I get this error. Failed…
Pawel
  • 427
  • 2
  • 7
  • 15
12
votes
4 answers

Do Java Records actually save memory over a similar class declaration or are they more like syntactic sugar?

I’m hoping that Java 14 records actually use less memory than a similar data class. Do they or is the memory using the same?
Clancy Merrick
  • 855
  • 1
  • 8
  • 16
12
votes
2 answers

java 14 nullpointerexception no detailed message

Java 14 has many new features. One of them is showing detailed message in NullPointerException. I installed Java 14 and trying to compile and run below class but I am not getting any detailed message. Am I missing anything? please…
Pradeep
  • 419
  • 5
  • 14
12
votes
1 answer

Compatibility issues while converting Classes to Records

I have been working with the following class named City @ToString @AllArgsConstructor public class City { Integer id; String name; } and tried to convert it to a record called CityRecord as record CityRecord(Integer id, String name) {} //…
Naman
  • 27,789
  • 26
  • 218
  • 353
11
votes
1 answer

Jshell in intellij doesn't allow generic types

I just started using jshell in intellij idea community version. When I write the below code in jshell, it works. List list = List.of("a", "b", "c"); System.out.println(list); However the same code doesn't work in intellij. It says…
Need Help
  • 113
  • 5
11
votes
2 answers

how to set the use --enable-preview compile and run flags from gradle?

Looking to use records from Java 14 in a gradle build, but am getting: thufir@dur:~/NetBeansProjects/FileWatcherHandler$ thufir@dur:~/NetBeansProjects/FileWatcherHandler$ gradle clean build > Task :compileJava…
Thufir
  • 8,216
  • 28
  • 125
  • 273
10
votes
2 answers

How can I continue to use Javascript in Java 15 onwards

In my Java application a small put important feature is to be able to rename audio files based on their metadata (e.g album/artist -title) and the mask is specified using Javascript, this makes for a very flexible and powerful renaming feature. I…
Paul Taylor
  • 13,411
  • 42
  • 184
  • 351
1
2
3
12 13