Status Update
Comments
mm...@commonsware.com <mm...@commonsware.com> #2
Ivan, since org.json is part of the platform APIs, should we automatically exclude it from the resolved dependencies ?
vi...@google.com <vi...@google.com>
mm...@commonsware.com <mm...@commonsware.com> #3
Thanks for filing the issue and for providing lots of info.
I was trying to follow instructions from #1 to reproduce, and this is what I came up with:
package com.example.myapplication
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import org.json.JSONObject
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val s = JSONObject("{'username': null}")
println("USERNAME = " + s.getString("username"))
println("JSON Object class loader is " + JSONObject::class.java.classLoader)
}
}
With and without implementation("com.pubnub:pubnub-kotlin:7.4.2")
I'm seeing:
System.out com.example.myapplication I USERNAME = null
System.out com.example.myapplication I JSON Object class loader is java.lang.BootClassLoader@ae0b505
in logcat (running on API 33 emulator).
This is also what I'd expect to see as BootClassLoader
is the application's parent classloader, so it should be providing JSONObject
.
Can you maybe share a snippet that reproduces the issue? Also, do you see issues in both debug and release variant?
wi...@outlook.com <wi...@outlook.com> #4
Thanks for this. I am trying to reproduce this issue on a minimal build and am actually seeing the same as what you're seeing in both debug
and release
variants.
I've attached a screenshot of
Non-fatal Exception: org.json.JSONException: JSONObject["payment_takeawayPayBalance"] is not a string (class org.json.b$b : null).
at org.json.JSONObject.wrongValueFormatException(JSONObject.java:2702)
at org.json.JSONObject.getString(JSONObject.java:861)
at com.justeat.webcheckout.common.AnalyticsWebInterface.logEvent(AnalyticsWebInterface.java:38)
at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
at android.os.MessageQueue.next(MessageQueue.java:362)
at android.os.Looper.loop(Looper.java:185)
at android.os.HandlerThread.run(HandlerThread.java:67)
org.json.JSONObject.wrongValueFormatException(JSONObject.java:2702)
simply doesn't exist in Android so it must have come from the external org.json
library.
Can you maybe share a snippet that reproduces the issue?
I will try and strip back as much as possible from our production app enough to reproduce the issue, sanitise the code, then post it in a repo somewhere accessible. Apologies, that may take a while.
Also, do you see issues in both debug and release variant?
Interestingly in release
builds only. A few of our engineers tried reproducing with no success on debug
builds but we were still seeing reports in Firebase from our release
.
Description
Studio Build:
4.0.0
6.1.1
Steps to Reproduce:
MainActivity
and notice that thegenerateWithoutContext()
function has no inspection warningsMainActivity
and itsgenerateWithContext()
functionExpected Results: no inspection warnings, as the two functions are equivalent, except that
generateWithContext()
uses a customCoroutineContext
along withDispatchers.IO
Actual Result: "Inappropriate blocking method call" inspection warning
Basically, this inspection does not appear to be able to handle
+
chains of coroutine contexts.Thanks for considering this!