-
Notifications
You must be signed in to change notification settings - Fork 782
Clarify reasons for null annotations in coding guidelines #5360
Clarify reasons for null annotations in coding guidelines #5360
Conversation
Signed-off-by: Stefan Triller <stefan.triller@telekom.de>
@maggu2810 In the light of #4321 (comment) can you please have a look on my explanation? |
Thus for publicly exposed methods that belong to our API and are (potentially) called by external callers, we cannot omit a `null` check although a method parameter is marked to be not `null` via an annotation. | ||
We will get a warning in the IDE for this check, but we decided to live with that. | ||
For private methods or methods in an internal package we agreed to respect the annotations and omit an additional `null` check. | ||
To use the annotaions, every bundle should have an **optional** `Import-Package` dependency to `org.eclipse.jdt.annotation`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spotted little typo: annotaions -> annotations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IOOOTAlan Thanks, I have fixed it in #5363
Few comments on this
|
We have decided to not use About your point (2). As we are a community projects with multiple committers it is unlikely that all that ones leave the projects at the same time. 😉 |
Note: my perspective is more from the openhab addon writer (which these guidelines are being applied to).
|
So, if you would like to discuss the nullness annotations on openHAB addons you should perhaps discuss it on the respective board. This one is about the ESH code. |
ah - @triller-telekom asked me to post over and I thought this was this was also being applied to the openhab guidelines as well. Sorry about that - my misunderstanding. Parting comment - the .001% was meant in a general sense. I only mentioned it because you gave it as one of the reasons why null checks shouldn't be included. I'm hoping the initial guideline reasoning didn't even include that comment because it's simply not true nor is reasonable driver for the guideline - especially considering the tradeoff that will occur in maintenance issues that will occur because of it (seen this type of stuff happen waaay too many times over the decades to know). At any rate, good luck and you guys are doing a great job on the smarthome side! |
Perhaps openHAB applies the ESH guidelines to their project. @kaikreuzer can answer that in more details. As some of the openHAB addons has been migrated to ESH and the projects are pretty similar it would perhaps make sense to not force something impossible for OH in the ESH guidelines, but e.g. the point "an addon (which is typically owned by a singular person)" should not be true for addons that has been migrated to ESH. |
Signed-off-by: Stefan Triller stefan.triller@telekom.de