Details
-
User Story
-
Resolution: Unresolved
-
P1: Critical
-
6.9
-
None
-
-
2024wk42s3FOQtforAndroid, 2024wk44s3FOQtforAndroid
Description
Qt Android Java code is growing bigger and bigger while maintaining some legacy code, and it's becoming harder and harder to avoid code usage that might lead to cases of using null objects after being missed in reviews. So, we get some bugs related to exceptions of bad usage of null objects.
Java has annotations like @NonNull and @Nullable (or even @NotNull):
- javax.annotation.Nonnull or javax.validation.constraints.NotNull
- }}{{org.jetbrains.annotations.NotNull
- org.eclipse.jdt.annotation.NonNull{}
- android.support.annotation.NonNull
- and of course androidx.annotation.NonNull
And there are static analysis frameworks that help spot bad null-ness usage (with their own set of @NonNull and @Nullable annotations){}
- FindBugs https://findbugs.sourceforge.net/
- Checker Framework https://checkerframework.org/
- JSpecify https://jspecify.dev/
Build and linte
- Gradle handles dependencies by default if used, it might require internet access first time
- [!] Look into caching common dependencies?
- javac and custom linter setup
- A static analysis framework that handles linter under the hood
Which is the right one to use
Of course at the end we need to go with one option, that can also be integrated to the CI. Using some of the static analysis frameworks might offer more than null-ness checks, however, it would be foreign to Android, and might just brings our code away from Android style code.
On the other hand using anything other than a framework, would require us to provide our own linter to work with javac and fail on such cases.
Using Gradle, would be the most ideal option, which would also open the door to use more than androidx annotations, however, we need to figure out the case of offline builds.
**
Attachments
Issue Links
- covers
-
QTBUG-129704 Guard against potential NullPointerException for QtActivityDelegate
- Closed
-
QTBUG-129885 tst_drawingmodes is crashing on android
- Closed
- relates to
-
QTBUG-73904 Update Qt future release to use and support AndroidX libraries
- Reported
-
QTBUG-85232 Use Gradle for building Qt for Android
- Open