You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Appy (JIRA)" <ji...@apache.org> on 2017/02/17 02:01:41 UTC

[jira] [Comment Edited] (HBASE-17312) [JDK8] Use default method for Observer Coprocessors

    [ https://issues.apache.org/jira/browse/HBASE-17312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15871048#comment-15871048 ] 

Appy edited comment on HBASE-17312 at 2/17/17 2:00 AM:
-------------------------------------------------------

So answering [~stack]'s question above:
Right now we have
{noformat}
public interface Foo {
  void getBar1();
  void getBar2();
}

public class BaseFoo {
  void getBar1() { }
  void getBar2() { }
}
-------

class ThirdParty extends BaseFoo {
    void getBar1() { // override }
}
{noformat}

That's changes to:
{noformat}
public interface Foo {
  void getBar1() {}
  void getBar2() {}
}
------
class ThirdParty implement Foo {   // Only one line fix
    void getBar1() { // override }
}
{noformat}

One weird case which i saw in tests was, overrides calling base class' functions. It doesn't make sense because our base classes have no functionality. They are there to just prevent redundant empty implementations (or returning default values when hooks have non-void return type).
But that's just our tests, and we should remove these calls ([~zghaobac]).


was (Author: appy):
So answering [~stack]'s question above:
Right now we have
{noformat}
public interface Foo {
  void getBar1();
  void getBar2();
}

public class BaseFoo {
  void getBar1() { }
  void getBar2() { }
}
-------

class ThirdParty extends BaseFoo {
    void getBar1() { // override }
}
{noformat}

That's changes to:
{noformat}
public interface Foo {
  void getBar1() {}
  void getBar2() {}
}
------
class ThirdParty implement Foo {   // Only one line fix
    void getBar1() { // override }
}
{noformat}

One weird case which i saw in tests was, overrides calling base class' functions. It doesn't make sense because our base classes have no functionality. They are there to just prevent redundant empty implementations (or returning default values when hooks have non-void return type).

> [JDK8] Use default method for Observer Coprocessors
> ---------------------------------------------------
>
>                 Key: HBASE-17312
>                 URL: https://issues.apache.org/jira/browse/HBASE-17312
>             Project: HBase
>          Issue Type: Sub-task
>          Components: Coprocessors
>    Affects Versions: 2.0.0
>            Reporter: Guanghao Zhang
>            Assignee: Guanghao Zhang
>         Attachments: HBASE-17312.master.001.patch, HBASE-17312.master.001.patch
>
>
> Use default method in MasterObserver, RegionObserver, RegionServerObserver and WALObserver. And mark the BaseRegionObserver, BaseMasterAndRegionObserver, BaseRegionServerObserver and BaseWALObserver. User can implement the interface directly and will not break compatibility when add new default methods.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)