You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by az...@apache.org on 2020/02/25 09:34:55 UTC
[flink] 01/02: [hotfix] Fix minor IDE warnings in MemoryUtils
This is an automated email from the ASF dual-hosted git repository.
azagrebin pushed a commit to branch release-1.10
in repository https://gitbox.apache.org/repos/asf/flink.git
commit 9ccbc1fb0584597f0775519ad87472f3667a95f0
Author: Andrey Zagrebin <az...@apache.org>
AuthorDate: Thu Feb 20 09:56:01 2020 +0100
[hotfix] Fix minor IDE warnings in MemoryUtils
---
.../src/main/java/org/apache/flink/core/memory/MemoryUtils.java | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/flink-core/src/main/java/org/apache/flink/core/memory/MemoryUtils.java b/flink-core/src/main/java/org/apache/flink/core/memory/MemoryUtils.java
index fcdf427..c807145 100644
--- a/flink-core/src/main/java/org/apache/flink/core/memory/MemoryUtils.java
+++ b/flink-core/src/main/java/org/apache/flink/core/memory/MemoryUtils.java
@@ -33,7 +33,7 @@ import java.nio.ByteOrder;
public class MemoryUtils {
/** The "unsafe", which can be used to perform native memory accesses. */
- @SuppressWarnings("restriction")
+ @SuppressWarnings({"restriction", "UseOfSunClasses"})
public static final sun.misc.Unsafe UNSAFE = getUnsafe();
/** The native byte order of the platform on which the system currently runs. */
@@ -50,7 +50,7 @@ public class MemoryUtils {
} catch (SecurityException e) {
throw new Error("Could not access the sun.misc.Unsafe handle, permission denied by security manager.", e);
} catch (NoSuchFieldException e) {
- throw new Error("The static handle field in sun.misc.Unsafe was not found.");
+ throw new Error("The static handle field in sun.misc.Unsafe was not found.", e);
} catch (IllegalArgumentException e) {
throw new Error("Bug: Illegal argument reflection access for static field.", e);
} catch (IllegalAccessException e) {
@@ -64,7 +64,6 @@ public class MemoryUtils {
private MemoryUtils() {}
private static Constructor<? extends ByteBuffer> getDirectBufferPrivateConstructor() {
- //noinspection OverlyBroadCatchBlock
try {
Constructor<? extends ByteBuffer> constructor =
ByteBuffer.allocateDirect(1).getClass().getDeclaredConstructor(long.class, int.class);
@@ -107,7 +106,6 @@ public class MemoryUtils {
* @param address address of the unsafe memory to release
* @return action to run to release the unsafe memory manually
*/
- @SuppressWarnings("UseOfSunClasses")
static Runnable createMemoryGcCleaner(Object owner, long address) {
return JavaGcCleanerWrapper.create(owner, () -> releaseUnsafe(address));
}