You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by bu...@apache.org on 2019/06/04 19:57:02 UTC

[hbase] branch branch-2 updated: HBASE-22534 TestCellUtil fails when run on JDK11

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

busbey pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new 35d3612  HBASE-22534 TestCellUtil fails when run on JDK11
35d3612 is described below

commit 35d3612f668db6efbf59ab601065208263f93cf2
Author: Sakthi <sa...@gmail.com>
AuthorDate: Mon Jun 3 22:17:56 2019 -0700

    HBASE-22534 TestCellUtil fails when run on JDK11
    
    Signed-off-by: Sean Busbey <bu...@apache.org>
    (cherry picked from commit 9b23e1d00cbf65cb9f80a71cd6d2b9721c543991)
---
 .../src/test/java/org/apache/hadoop/hbase/TestCellUtil.java      | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestCellUtil.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestCellUtil.java
index 9d4d48f..6f477b8 100644
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestCellUtil.java
+++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestCellUtil.java
@@ -534,11 +534,16 @@ public class TestCellUtil {
     assertTrue(CellUtil.equals(kv, res));
   }
 
+  // Workaround for jdk 11 - reflective access to interface default methods for testGetType
+  private abstract class CellForMockito implements Cell {
+
+  }
+
   @Test
   public void testGetType() throws IOException {
-    Cell c = Mockito.mock(Cell.class);
+    CellForMockito c = Mockito.mock(CellForMockito.class);
     Mockito.when(c.getType()).thenCallRealMethod();
-    for (Cell.Type type : Cell.Type.values()) {
+    for (CellForMockito.Type type : CellForMockito.Type.values()) {
       Mockito.when(c.getTypeByte()).thenReturn(type.getCode());
       assertEquals(type, c.getType());
     }