Does microstream already support JDK 15 - Problem with record
Solution 1:
thank you for your interest in microstream. Unfortunately, I can't come to the place where the problem is from the description of the problem. The code that is in the description comes from the jdk class Unsafe.java. Since I can't reproduce your problem yet, I quickly did a small test project in github, where the basic test for Records is in Java. https://github.com/johny2000uwb/microstream-records
public record PersonRecord(String firstName, String lastName) {
}
@Test
public void saveRecordTest() {
PersonRecord personRecord = new PersonRecord("Maria", "Lukasova");
EmbeddedStorageManager storage = EmbeddedStorage.start(personRecord, location);
storage.shutdown();
PersonRecord secondRecord = new PersonRecord("Kamila", "Pazourkova");
storage = EmbeddedStorage.start(secondRecord, location);
Assertions.assertEquals("Maria", secondRecord.firstName());
}
Records are still only preview function, so it is necessary to enable it. For example in Maven:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>14</release> <!-- <release>13/14/15</release> -->
<compilerArgs>--enable-preview</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<argLine>--enable-preview</argLine>
</configuration>
</plugin>
</plugins>
</build>