NativeScript / NativeScript/android
If you create a custom activity more than once an exception should be thrown
Open
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 563
- Forks
- 144
- Avg merge
- 10h 46m
- Merged PRs (30d)
- 14
Description
- Create new project
- Try to extend the
com.tns.NativeScriptActivity, which is create by tns-core-modules
Code:
var MyCustomActivityClass = (function (_super) {
__extends(MyCustomActivityClass, _super);
function MyCustomActivityClass() {
_super.call(this);
return global.__native(this);
}
MyCustomActivityClass.prototype.onCreate = function (savedInstanceState) {
_super.prototype.onCreate.call(this, false ? savedInstanceState : null);
android.util.Log.d("Sbg.Test","we got called from onCreate of custom-activity.js");
};
MyCustomActivityClass = __decorate([
JavaProxy("com.tns.NativeScriptActivity")
], MyCustomActivityClass);
return MyCustomActivityClass;
}(android.app.Activity));
- Build the app for android
tns build android
Actual: A warning will be logged "Warning: there already is an extend called com.tns.NativeScriptActivity."
Expected: An exception to be thrown https://github.com/NativeScript/android-runtime/blob/2ab7271d12d56a03e57880a2b1783b08206363ae/test-app/build-tools/static-binding-generator/src/main/java/org/nativescript/staticbindinggenerator/Generator.java#L82
P.S. In some cases the exception is thrown, but this situations are very rare.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the linked Generator.java location around line 82 and trace how duplicate extends for com.tns.NativeScriptActivity are handled. Run the reported custom-activity reproduction with tns build android; done means the duplicate extension produces the expected exception rather than only logging a warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java, javascript
- Domain
- build-system, mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100