{ "id": "175049", "key": "TIMOB-27915", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "21092", "name": "Release 9.2.1", "archived": false, "released": true, "releaseDate": "2020-10-06" }, { "id": "21126", "name": "hyperloop 6.0.2", "archived": false, "released": true, "releaseDate": "2020-10-03" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2020-10-06T18:26:17.000+0000", "created": "2020-05-29T16:40:59.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "android", "hyperloop" ], "versions": [], "issuelinks": [], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-10-06T18:26:17.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "When using the Android Stripe SDK and when I require CardInputWidget (no other code):\r\n\r\n{code:java}\r\nconst CardInputWidget = require(\"com.stripe.android.view.CardInputWidget\");\r\n{code}\r\n\r\n\r\n{code:java}\r\ndependencies {\r\n implementation 'com.stripe:stripe-android:14.4.1'\r\n}\r\n{code}\r\n\r\n\r\nI get this error:\r\n\r\n\r\n{code:java}\r\n[ERROR] TiExceptionHandler: (main) [91,18169] /hyperloop/com.stripe.android.view.CardInputWidget.js:169\r\n[ERROR] TiExceptionHandler: Object.defineProperty(CardInputWidget, 'Companion', {\r\n[ERROR] TiExceptionHandler: ^\r\n[ERROR] TiExceptionHandler: TypeError: Cannot redefine property: Companion\r\n[ERROR] TiExceptionHandler: at Function.defineProperty ()\r\n[ERROR] TiExceptionHandler: at /hyperloop/com.stripe.android.view.CardInputWidget.js:169:8\r\n[ERROR] TiExceptionHandler: at Module._runScript (ti:/module.js:587:9)\r\n[ERROR] TiExceptionHandler: at Module.load (ti:/module.js:106:7)\r\n[ERROR] TiExceptionHandler: at Module.loadJavascriptText (ti:/module.js:436:9)\r\n[ERROR] TiExceptionHandler: at Module.loadAsFile (ti:/module.js:488:15)\r\n[ERROR] TiExceptionHandler: at Module.loadAsFileOrDirectory (ti:/module.js:410:20)\r\n[ERROR] TiExceptionHandler: at Module.require (ti:/module.js:245:23)\r\n[ERROR] TiExceptionHandler: at Module.global.Module.require (:19311:34)\r\n[ERROR] TiExceptionHandler: at require (ti:/module.js:550:15)\r\n[ERROR] TiExceptionHandler:\r\n[ERROR] TiExceptionHandler: org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)\r\n[ERROR] TiExceptionHandler: org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:63)\r\n[ERROR] TiExceptionHandler: org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:975)\r\n[ERROR] TiExceptionHandler: org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1204)\r\n[ERROR] TiExceptionHandler: org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:267)\r\n[ERROR] TiExceptionHandler: android.os.Handler.dispatchMessage(Handler.java:102)\r\n[ERROR] TiExceptionHandler: android.os.Looper.loop(Looper.java:193)\r\n[ERROR] TiExceptionHandler: android.app.ActivityThread.main(ActivityThread.java:6718)\r\n[ERROR] TiExceptionHandler: java.lang.reflect.Method.invoke(Native Method)\r\n[ERROR] TiExceptionHandler: com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)\r\n[ERROR] V8Exception: Exception occurred at /hyperloop/com.stripe.android.view.CardInputWidget.js:169: Uncaught TypeError: Cannot redefine property: Companion\r\n{code}\r\n\r\nIn the com.stripe.android.view.CardMultilineWidget.js file that get's generated there are two:\r\n\r\nObject.defineProperty(CardMultilineWidget, 'Companion', {\r\n\r\nProperties that I think need a:\r\n\r\nconfigurable: true\r\n\r\nset after the \"enumerable: true,\" perhaps?\r\n\r\n", "attachment": [], "flagged": false, "summary": "Android: Hyperloop generated code can cause \"Cannot redefine property\" error", "creator": { "name": "kaypro@gmail.com", "key": "kaypro@gmail.com", "displayName": "kaypro", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "kaypro@gmail.com", "key": "kaypro@gmail.com", "displayName": "kaypro", "active": true, "timeZone": "America/New_York" }, "environment": "SDK: 9.0.1.GA\r\nHyperloop: 5.0.3", "comment": { "comments": [ { "id": "455587", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I'm able to reproduce this issue. Thanks for reporting it.", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-05-29T19:13:09.000+0000", "updated": "2020-05-29T19:13:09.000+0000" }, { "id": "457114", "author": { "name": "kaypro@gmail.com", "key": "kaypro@gmail.com", "displayName": "kaypro", "active": true, "timeZone": "America/New_York" }, "body": "Any temporary hacks / workaround for the interim until this get's patched up?\r\n\r\nThanks", "updateAuthor": { "name": "kaypro@gmail.com", "key": "kaypro@gmail.com", "displayName": "kaypro", "active": true, "timeZone": "America/New_York" }, "created": "2020-10-01T11:30:14.000+0000", "updated": "2020-10-01T11:30:14.000+0000" }, { "id": "457124", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I don't see any good work-around other than to do this via a native module.\r\n\r\nWe think this issue is happening in hyperloop because the [CardInputWidget|https://github.com/stripe/stripe-android/blob/master/stripe/src/main/java/com/stripe/android/view/CardInputWidget.kt] class and the [CardWidget|https://github.com/stripe/stripe-android/blob/master/stripe/src/main/java/com/stripe/android/view/CardWidget.kt] class it inherits from both define the same inner class {{Companion}}. Hyperloop may not be correctly handling the \"shadowing\" of the inner class and that may be the causes of the collision.", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-10-01T21:05:15.000+0000", "updated": "2020-10-01T21:05:15.000+0000" }, { "id": "457126", "author": { "name": "kaypro@gmail.com", "key": "kaypro@gmail.com", "displayName": "kaypro", "active": true, "timeZone": "America/New_York" }, "body": "Understood... make sense. Hope we can get hyperloop to accommodate... there's quite a few frameworks I've tried that I've come across the same issue. Fingers crossed... appreciate the insight!", "updateAuthor": { "name": "kaypro@gmail.com", "key": "kaypro@gmail.com", "displayName": "kaypro", "active": true, "timeZone": "America/New_York" }, "created": "2020-10-01T22:07:05.000+0000", "updated": "2020-10-01T22:07:05.000+0000" }, { "id": "457146", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I dug into this some more. I was partly mistaken.\r\n\r\nWhat's going on is that the [CardInputWidget|https://github.com/stripe/stripe-android/blob/master/stripe/src/main/java/com/stripe/android/view/CardInputWidget.kt] class uses a kotlin language feature called \"companion\", which when transpiled into Java, will create an inner class named \"Companion\" and a public static field instance named \"Companion\".\r\nhttps://kotlinlang.org/docs/tutorials/kotlin-for-py/objects-and-companion-objects.html#companion-objects\r\nhttps://kotlinlang.org/docs/reference/java-to-kotlin-interop.html#static-fields\r\n\r\nThis is legal when compiled to a JAR, but hyperloop needs to be changed to check for name collision and favor the field over the inner class with the same name. If anyone wants to access the inner class, then they would have to use {{require()}} to get a hold of it... although for the kotlin companion feature, this isn't practical.", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-10-03T02:34:08.000+0000", "updated": "2020-10-03T02:34:08.000+0000" }, { "id": "457148", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~kaypro@gmail.com], would you mind trying the zipped up pre-release version of hyperloop from the link below please? It should fix the issue. Note that this version of the module only works with Titanium 9.0.0 and higher.\r\nhttps://github.com/appcelerator-modules/hyperloop-builds/releases/tag/v6.0.2\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-10-03T05:31:05.000+0000", "updated": "2020-10-03T05:31:05.000+0000" }, { "id": "457150", "author": { "name": "kaypro@gmail.com", "key": "kaypro@gmail.com", "displayName": "kaypro", "active": true, "timeZone": "America/New_York" }, "body": "Confirmed!! Works like a charm. Nice find. Thanks for the efforts on this one... opens up a whole lot of options now on Android. Thank you!", "updateAuthor": { "name": "kaypro@gmail.com", "key": "kaypro@gmail.com", "displayName": "kaypro", "active": true, "timeZone": "America/New_York" }, "created": "2020-10-03T13:18:57.000+0000", "updated": "2020-10-03T13:18:57.000+0000" }, { "id": "457162", "author": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR Passed", "updateAuthor": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-10-05T17:24:13.000+0000", "updated": "2020-10-05T17:24:13.000+0000" }, { "id": "457163", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (hyperloop.next): https://github.com/appcelerator/hyperloop.next/pull/346\r\nPR (master): https://github.com/appcelerator/titanium_mobile/pull/12156", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-10-05T18:16:31.000+0000", "updated": "2020-10-05T18:16:31.000+0000" }, { "id": "457177", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix with SDK 9.2.1.v20201005155347.\r\nClosing.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-10-06T18:26:09.000+0000", "updated": "2020-10-06T18:26:09.000+0000" } ], "maxResults": 12, "total": 12, "startAt": 0 } } }