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

[homekit] some cleanups #8041

Merged
merged 5 commits into from
Jul 8, 2020
Merged

[homekit] some cleanups #8041

merged 5 commits into from
Jul 8, 2020

Conversation

yfre
Copy link
Contributor

@yfre yfre commented Jun 29, 2020

some cleanup and alignment of accessories implementations.
key changes

  • make consistent use of BooleanItemReader and some other helpers
  • annotate with @NonNullByDefault where possible
  • make final where possible
  • use import static
  • improve logging at few places

Signed-off-by: Eugen Freiter [email protected]

Eugen Freiter added 2 commits June 28, 2020 17:01
Signed-off-by: Eugen Freiter <[email protected]>
Signed-off-by: Eugen Freiter <[email protected]>
Copy link
Member

@Hilbrand Hilbrand left a comment

Choose a reason for hiding this comment

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

Thanks for the clean up. Just a general comment. Where possible can inline the null annotations on fields and variables: private @Nullable String something;.

Signed-off-by: Eugen Freiter <[email protected]>
@yfre
Copy link
Contributor Author

yfre commented Jun 30, 2020

@cpmeister @Hilbrand
what is your view on "final" for parameters? is there a guidance for openHAB?
e.g.
private static CurrentFanStateCharacteristic createCurrentFanStateCharacteristic(final HomekitTaggedItem taggedItem, HomekitAccessoryUpdater updater) {

should we make both "final" or remove "final" ? both parameters will not get new objects assigned in the method.
personally, i dont see much advantage of having "final" for parameters but it does not hurt either.

just want to make it consistent.

@openhab openhab deleted a comment from TravisBuddy Jun 30, 2020
@openhab openhab deleted a comment from TravisBuddy Jul 1, 2020
Signed-off-by: Eugen Freiter <[email protected]>
@yfre
Copy link
Contributor Author

yfre commented Jul 2, 2020

i have checked the usage of final in parameters in openHAB core and some mature extensions like hueemulation and it looks like in majority of cases final is not used for parameters.
so, i have removed final from parameters in homekit binding

@openhab openhab deleted a comment from TravisBuddy Jul 2, 2020
@Hilbrand
Copy link
Member

Hilbrand commented Jul 2, 2020

@yfre Seems fine. (I had this comment prepared, but somehow forgot to click comment): There is no definite preference on final parameters. I think most people do prefer not to make them final as it would make code more verbose and harder to read is the thought. I personally prefer to make them final. And for some reason some version of the Eclipse setup of openHAB will make all parameters final when you save a file, although I'm not sure if that is intentional or a bug somewhere that causes this setting to be enabled.

Signed-off-by: Eugen Freiter <[email protected]>
@cpmeister cpmeister merged commit 5785cad into openhab:2.5.x Jul 8, 2020
@cpmeister cpmeister added this to the 2.5.7 milestone Jul 8, 2020
knikhilwiz pushed a commit to knikhilwiz/openhab2-addons that referenced this pull request Jul 12, 2020
* some cleanups

Signed-off-by: Eugen Freiter <[email protected]>
CSchlipp pushed a commit to CSchlipp/openhab-addons that referenced this pull request Jul 26, 2020
* some cleanups

Signed-off-by: Eugen Freiter <[email protected]>
Signed-off-by: CSchlipp <[email protected]>
MPH80 pushed a commit to MPH80/openhab-addons that referenced this pull request Aug 3, 2020
* some cleanups

Signed-off-by: Eugen Freiter <[email protected]>
Signed-off-by: MPH80 <[email protected]>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
* some cleanups

Signed-off-by: Eugen Freiter <[email protected]>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
* some cleanups

Signed-off-by: Eugen Freiter <[email protected]>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
* some cleanups

Signed-off-by: Eugen Freiter <[email protected]>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
* some cleanups

Signed-off-by: Eugen Freiter <[email protected]>
DaanMeijer pushed a commit to DaanMeijer/openhab-addons that referenced this pull request Sep 1, 2020
* some cleanups

Signed-off-by: Eugen Freiter <[email protected]>
Signed-off-by: Daan Meijer <[email protected]>
markus7017 pushed a commit to markus7017/openhab-addons that referenced this pull request Sep 19, 2020
* some cleanups

Signed-off-by: Eugen Freiter <[email protected]>
@yfre yfre deleted the cleanups branch November 15, 2022 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants