zsmartsystems / com.zsmartsystems.zigbee

ZigBee Cluster Library Java framework supporting multiple dongles
Eclipse Public License 1.0
138 stars 87 forks source link

Replace runnable wrappers by lambda expressions/method references #1380

Open ViToni opened 1 year ago

ViToni commented 1 year ago

By switching to Java8 (#408) Runnable wrappers can be replaced be Lambda expression or even method references as done in this PR.

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

ViToni commented 1 year ago

TODO:

ViToni commented 1 year ago

@cdjackson Would you mind taking a look at this one?

cdjackson commented 1 year ago

@ViToni my concern here is that on some Android versions I understand that lambda expressions are not available, so we have for that reason avoided them. Now that concern is possibly no longer an issue - I'm not sure, but I'm just a bit wary to make this change and find it breaks compatibility.

ViToni commented 1 year ago

@cdjackson Thanks for the feedback. Didn't know about restrictions regarding Android / Lambda expressions (but I have to admit I'm not deep into Android regarding development). But indeed I remember that some early versions of Java 8 had some issues regarding Lambda expressions but AFAIK these have been fixed for some time now.

Regarding the first Android version supporting Java 8, from what I found, it seems to be Android Nougat from August 2016 or respective Android Studio 3.0.0 from October 2017. The final release of Nougat was October 2019. The Java 8 support page mentions only serialization of Lambdas not being supported, not sure if serialization has been used anywhere in project on Runnables.

Don't know if this information helps on the decision though...

cdjackson commented 1 year ago

I found that animal sniffer throws an error with your recent addition of a lambda in the queue management PR, so i guess that answers the compatibility question ;)