-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
add @NonNull, @Nullable annotations to native interfaces, classes #19973
Conversation
@@ -139,6 +139,7 @@ android { | |||
dependencies { | |||
compile fileTree(dir: "libs", include: ["*.jar"]) | |||
compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" | |||
compile "com.android.support:support-annotations:${rootProject.ext.supportLibVersion}" |
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.
I think add this dependency to template is unnecessary.
@gengjiawen thank for the suggestion 👍 |
:) |
@dulmandakh & @gengjiawen thank you both for all the android improvements lately! |
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.
We don't really use the @nonnull annotation through the code base but I assume this is needed for better kotlin support? Seems fine to me.
RNTester/android/app/build.gradle
Outdated
@@ -142,6 +142,7 @@ android { | |||
dependencies { | |||
compile fileTree(dir: 'libs', include: ['*.jar']) | |||
compile 'com.android.support:appcompat-v7:26.1.0' | |||
compile 'com.android.support:support-annotations:26.1.0' |
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.
Is that needed?
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.
it's redundant, I'll remove it tomorrow
@janicduplessis yep, nullable and nonnull annotations are for Kotlin support, so that Android Studio knows if a value is nullable or not. |
Alright, I removed the extra dep. Thanks for working on this! @facebook-github-bot shipit |
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.
@janicduplessis is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
@janicduplessis thank you. Could you please review #19950 |
@hramos please review and merge. This will improve development experience of native module using Kotlin. |
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.
hramos is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
This one also saw some internal test failures, but they might be unrelated. Rerunning, will check again in a few hours. |
@hramos any updates? Maybe you need to add react_native_dep("third-party/android/support-annotations:android-support-annotations") as a dependency? |
This PR adds null annotations to interfaces and classes used to write native modules, that would make linting easier especially for Kotlin developers.
Test Plan:
Everything will build and run as usual.