Skip to content

Data.isNull return invalid true after proguard #2603

Description

@miguelangellv

Environment details

  1. Kotlin Multiplatform Project
  2. Compose Multiplatform
  3. Youtube API

Steps to reproduce

  1. Configure Youtube API
  2. Create request a videos list using setMine(true)
  3. Apply proguard/r8
  4. Get error

Code example

// example

Stack trace


Field: mine , value: true, isNull: true
Field: part, value [contentDetails], isNull: false

Generated URL: https://youtube.googleapis.com/youtube/v3/channels?part=contentDetails


Exception in thread "AWT-EventQueue-0" com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
GET https://youtube.googleapis.com/youtube/v3/channels?part=contentDetails
{
  "code": 400,
  "errors": [
    {
      "domain": "youtube.parameter",
      "location": "parameters.",
      "locationType": "other",
      "message": "No filter selected. Expected one of: mySubscribers, forUsername, forHandle, categoryId, id, mine, managedByMe",
      "reason": "missingRequiredParameter"
    }
  ],
  "message": "No filter selected. Expected one of: mySubscribers, forUsername, forHandle, categoryId, id, mine, managedByMe"
}
	at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:145)
	at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:118)
	at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:37)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$3.interceptResponse(AbstractGoogleClientRequest.java:479)
	at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1111)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:565)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:506)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:616)
	at org.malv.youtube.services.YoutubeService$getVideos$2.invokeSuspend(YoutubeService.kt:49)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:124)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:586)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:1820)
	Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@38fc853c, Dispatchers.Main.immediate]


External references such as API reference guides

isNull method

public static boolean isNull(Object object) { // don't call nullOf because will throw IllegalArgumentException if cannot create instance 
   return object != null && object == NULL_CACHE.get(object.getClass()); 
}

Any additional information below

I think the problem is that, after ProGuard, Boolean object is converted to primitives, so, "true" are the same object in NULL_CACHE and it return isNull. If the value is "false" return that is not null.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p3Desirable enhancement or fix. May not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions