Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Records in JDK 14 #766

Merged
merged 24 commits into from
Mar 18, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/com/esotericsoftware/kryo/unsafe/UnsafeUtil.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* Copyright (c) 2008-2020, Nathan Sweet
* Copyright (C) 2020, Oracle and/or its affiliates.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
Expand Down Expand Up @@ -96,7 +97,7 @@ public class UnsafeUtil {
static {
ByteBuffer buffer = ByteBuffer.allocateDirect(1);
try {
directByteBufferConstructor = buffer.getClass().getDeclaredConstructor(long.class, int.class, Object.class);
directByteBufferConstructor = buffer.getClass().getDeclaredConstructor(long.class, int.class);
directByteBufferConstructor.setAccessible(true);
} catch (Exception ex) {
if (DEBUG) debug("kryo", "No direct ByteBuffer constructor is available.", ex);
Expand Down Expand Up @@ -124,7 +125,7 @@ public static ByteBuffer newDirectBuffer (long address, int size) {
if (directByteBufferConstructor == null)
throw new UnsupportedOperationException("No direct ByteBuffer constructor is available.");
try {
return directByteBufferConstructor.newInstance(address, size, null);
return directByteBufferConstructor.newInstance(address, size);
} catch (Exception ex) {
throw new KryoException("Error creating a ByteBuffer at address: " + address, ex);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is unrelated to records, but is clearly required to successfully run on JDK 14+, since the non-Public constructors of DirectByteBuffer has been refactored / changed.

}
Expand Down