-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix WritableArray, WritableMap nullable annotations (#23397)
Summary: Recently, I added nullable annotations to ReadableArray, ReadableMap, WritableArray, WritableMap and subclasses to improve Kotlin developer experience. But found that I made mistake with pushArray, pushMap, pushString method of WritableArray, and putArray, putMap, putString methods of WritableMap. This PR fixes previous mistake. Excerpt from WritableNativeArray.cpp. ```cpp void WritableNativeArray::pushString(jstring value) { if (value == NULL) { pushNull(); return; } throwIfConsumed(); array_.push_back(wrap_alias(value)->toStdString()); } void WritableNativeArray::pushNativeArray(WritableNativeArray* otherArray) { if (otherArray == NULL) { pushNull(); return; } throwIfConsumed(); array_.push_back(otherArray->consume()); } void WritableNativeArray::pushNativeMap(WritableNativeMap* map) { if (map == NULL) { pushNull(); return; } throwIfConsumed(); array_.push_back(map->consume()); } ``` Excerpt from WritableNativeMap.cpp ```cpp void WritableNativeMap::putString(std::string key, alias_ref<jstring> val) { if (!val) { putNull(std::move(key)); return; } throwIfConsumed(); map_.insert(std::move(key), val->toString()); } void WritableNativeMap::putNativeArray(std::string key, WritableNativeArray* otherArray) { if (!otherArray) { putNull(std::move(key)); return; } throwIfConsumed(); map_.insert(key, otherArray->consume()); } void WritableNativeMap::putNativeMap(std::string key, WritableNativeMap *otherMap) { if (!otherMap) { putNull(std::move(key)); return; } throwIfConsumed(); map_.insert(std::move(key), otherMap->consume()); } ``` [Android] [Changed] - fix nullable annotations in WritableArray, WritableMap Pull Request resolved: #23397 Differential Revision: D14044014 Pulled By: cpojer fbshipit-source-id: c44ea2e097e7b1156223b516aa640a181f0d4a9b
- Loading branch information
1 parent
77300ca
commit 7b33d6b
Showing
6 changed files
with
20 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters