apache / apache/lucenenet

Null pointers/nullable

Open
#737 7 comments 0 reactions 0 assignees View on GitHub
design is:enhancement is:feature pri:normal
Dominant language
C#
Stars
2.4k
Forks
658
Avg merge
3d 5h
Merged PRs (30d)
9

Description

I can see that most of the issues marked as "bugs" in SonarCloud are `Null pointers should not be dereferenced` which risks throwing a `NullReferenceException`

Issues:
https://sonarcloud.io/project/issues?resolved=false&rules=csharpsquid%3AS2259&types=BUG&id=apache_lucenenet

As an example I looked into this issue:
https://sonarcloud.io/project/issues?issues=AYRH0TRT_qq9ReJdi4pi&open=AYRH0TRT_qq9ReJdi4pi&id=apache_lucenenet

Here I tracked the newest version of the code down here:
https://github.com/apache/lucene/blob/7c130d2f07e00fd8725cf7e22cc268dd4331fbbe/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/ConvTable.java#L59

Which is similar to the version we have which should therefore mean that the same issue is still present in the Java version too? Therefore I'm wondering what's the best approach for fixing these errors or if they should be fixed at all. It's very possible that it's next to impossible to encounter this error in a real world scenario. (I haven't looked too much into how it's used).

And related to this, would it make sense to enable the Nullable feature across the project to give a informative public API for the developers using Lucene.NET? Here we could mark variables and parameters that can be null at some point. This should be possible to do step by step by adding the `#nullable enable` that I can see you've used in some files.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the SonarCloud S2259 issue list and the referenced ConvTable implementation, then inspect existing files that use #nullable enable. Determine whether the reported nullability findings are reachable and agree on whether project-wide nullable annotations are in scope. Done requires a defined approach and scope for addressing the findings and nullable API annotations.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.