NativeScript / NativeScript/android

If you create a custom activity more than once an exception should be thrown

Offen
#1,320 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
C++
Sterne
563
Forks
144
Ø Merge
10 Std. 46 Min.
Gemergte PRs (30 T.)
14

Beschreibung

  1. Create new project
  2. 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));

  1. 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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne an der verlinkten Stelle in Generator.java bei etwa Zeile 82 und verfolge, wie doppelte extends für com.tns.NativeScriptActivity behandelt werden. Führe die gemeldete Reproduktion mit einer benutzerdefinierten Activity mit tns build android aus; erledigt ist die Aufgabe, wenn die doppelte Erweiterung die erwartete Exception erzeugt, statt nur eine Warnung zu protokollieren.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
android, java, javascript
Bereich
build-system, mobile-dev
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
52/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.