Skip to content
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

Closed
wants to merge 6 commits into from

Conversation

dulmandakh
Copy link
Contributor

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.

@react-native-bot react-native-bot added ✅Test Plan Missing Changelog This PR appears to be missing a changelog, or they are incorrectly formatted. labels Jun 29, 2018
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 29, 2018
@@ -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}"
Copy link
Contributor

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.

@dulmandakh
Copy link
Contributor Author

@gengjiawen thank for the suggestion 👍

@gengjiawen
Copy link
Contributor

:)

@patrickkempff
Copy link
Contributor

@dulmandakh & @gengjiawen thank you both for all the android improvements lately!

Copy link
Contributor

@janicduplessis janicduplessis left a 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.

@@ -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'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that needed?

Copy link
Contributor Author

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

@dulmandakh
Copy link
Contributor Author

dulmandakh commented Jul 15, 2018

@janicduplessis yep, nullable and nonnull annotations are for Kotlin support, so that Android Studio knows if a value is nullable or not.

@janicduplessis
Copy link
Contributor

Alright, I removed the extra dep. Thanks for working on this!

@facebook-github-bot shipit

@facebook-github-bot facebook-github-bot added the Import Started This pull request has been imported. This does not imply the PR has been approved. label Jul 16, 2018
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a 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.

@dulmandakh
Copy link
Contributor Author

@janicduplessis thank you. Could you please review #19950

@dulmandakh
Copy link
Contributor Author

@hramos please review and merge. This will improve development experience of native module using Kotlin.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a 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.

@hramos
Copy link
Contributor

hramos commented Aug 17, 2018

This one also saw some internal test failures, but they might be unrelated. Rerunning, will check again in a few hours.

@dulmandakh
Copy link
Contributor Author

@hramos any updates? Maybe you need to add react_native_dep("third-party/android/support-annotations:android-support-annotations") as a dependency?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Import Started This pull request has been imported. This does not imply the PR has been approved. Missing Changelog This PR appears to be missing a changelog, or they are incorrectly formatted. Needs: Imported Diff Waiting on Meta
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants