This is an automated email from the ASF dual-hosted git repository.

sewen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 7ee05e59355c36038a52f790196a098e040f3312
Author: Stephan Ewen <se...@apache.org>
AuthorDate: Thu Nov 7 16:11:17 2019 +0100

    [hotfix][core] Cleanups of compiler and inspection warnings for 
HybridMemorySegment and tests.
---
 .../java/org/apache/flink/core/memory/HybridMemorySegment.java |  3 ++-
 .../flink/core/memory/HybridOffHeapMemorySegmentTest.java      | 10 ++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git 
a/flink-core/src/main/java/org/apache/flink/core/memory/HybridMemorySegment.java
 
b/flink-core/src/main/java/org/apache/flink/core/memory/HybridMemorySegment.java
index 3404bc1..fbb9837 100644
--- 
a/flink-core/src/main/java/org/apache/flink/core/memory/HybridMemorySegment.java
+++ 
b/flink-core/src/main/java/org/apache/flink/core/memory/HybridMemorySegment.java
@@ -20,6 +20,7 @@ package org.apache.flink.core.memory;
 
 import org.apache.flink.annotation.Internal;
 
+import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
 import java.io.DataInput;
@@ -72,7 +73,7 @@ public final class HybridMemorySegment extends MemorySegment {
          * @param cleaner optional action to run upon freeing the segment.
          * @throws IllegalArgumentException Thrown, if the given ByteBuffer is 
not direct.
          */
-       HybridMemorySegment(ByteBuffer buffer, @Nullable Object owner, 
@Nullable Runnable cleaner) {
+       HybridMemorySegment(@Nonnull ByteBuffer buffer, @Nullable Object owner, 
@Nullable Runnable cleaner) {
                super(checkBufferAndGetAddress(buffer), buffer.capacity(), 
owner);
                this.offHeapBuffer = buffer;
                this.cleaner = cleaner;
diff --git 
a/flink-core/src/test/java/org/apache/flink/core/memory/HybridOffHeapMemorySegmentTest.java
 
b/flink-core/src/test/java/org/apache/flink/core/memory/HybridOffHeapMemorySegmentTest.java
index 67c05c3..b1199a2 100644
--- 
a/flink-core/src/test/java/org/apache/flink/core/memory/HybridOffHeapMemorySegmentTest.java
+++ 
b/flink-core/src/test/java/org/apache/flink/core/memory/HybridOffHeapMemorySegmentTest.java
@@ -24,6 +24,8 @@ import java.nio.ByteBuffer;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -44,7 +46,7 @@ public abstract class HybridOffHeapMemorySegmentTest extends 
MemorySegmentTestBa
                assertFalse(seg.isFreed());
                assertTrue(seg.isOffHeap());
                assertEquals(buffer.capacity(), seg.size());
-               assertTrue(buffer == seg.getOffHeapBuffer());
+               assertSame(buffer, seg.getOffHeapBuffer());
 
                try {
                        //noinspection ResultOfMethodCallIgnored
@@ -58,9 +60,9 @@ public abstract class HybridOffHeapMemorySegmentTest extends 
MemorySegmentTestBa
                ByteBuffer buf1 = seg.wrap(1, 2);
                ByteBuffer buf2 = seg.wrap(3, 4);
 
-               assertTrue(buf1 != buffer);
-               assertTrue(buf2 != buffer);
-               assertTrue(buf1 != buf2);
+               assertNotSame(buf1, buffer);
+               assertNotSame(buf2, buffer);
+               assertNotSame(buf1, buf2);
                assertEquals(1, buf1.position());
                assertEquals(3, buf1.limit());
                assertEquals(3, buf2.position());

Reply via email to