Skip to content

Crash when invoking a second (different) signature of an overloaded method (meta generator cache?) #555

@EddyVerbruggen

Description

@EddyVerbruggen

Tell us about the problem

I'm trying to extend the Firebase plugin with the ability to remove listeners. On Android the Firebase SDK offers the following method signatures (found here):

screen shot 2016-09-10 at 20 49 36

So these methods either expect an implementation of the ChildEventListener or ValueEventListener Interface.

Whichever is called first succeeds!, so when first calling removeEventListener(myValueEventListener) all is fine, but if I then call removeEventListener(myChildEventListener) the app will crash (and vice versa!) with the following stacktrace:

JNI ERROR (app bug): attempt to pass an instance of com.tns.gen.com.google.firebase.database.ChildEventListener as argument 1 to void com.google.firebase.database.Query.removeEventListener(com.google.firebase.database.ValueEventListener)

My guess is something is cached and the runtime expects the same signature for the same method the next time.. which is not what the Firebase SDK wants me to pass in..

Please provide the following version numbers that your issue occurs with:

  • CLI: 2.2.1
  • Runtime(s): 2.1.1 as well as 2.4.0-next-2016-09-10-1135 (exactly the same behaviour)
  • Firebase Android SDK: 9.4.0

Please tell us how to recreate the issue in as much detail as possible.

  • Clone the Firebase plugin demo repo.
  • Important: Instead of using the plugin from npm (as the demo app does), grab it from https://github.com/EddyVerbruggen/nativescript-plugin-firebase, just use the master branch, that's where I've added the code that will reproduce the crash (the 'remove listener' feature is new and undocumented so it won't bother others).
  • Follow the instructions on how to configure Firebase from the demo app's readme.
  • Open the app, go to the second tab, click 'init' at the top.
  • Now hit the yellow 'add child listener' button (see below), then 'remove childlistener' (should be OK)
  • Then hit the red 'add valuelistener' button, then 'remove valuelistener' (crash!)

Those last two steps can be reversed with the same outcome.

screen shot 2016-09-10 at 21 28 07

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions