Saturday, 22 August 2020

unchecked warnings - during compilation when used Safe Args to pass data

I use Navigation Component's Safe Args to pass data between destination

build.gradle apply plugin: "androidx.navigation.safeargs.kotlin"

MyType.kt

@Keep
@Parcelize
class MyType(
        val type: String,
        val name: String
) : Parcelable

nav_graph.xml

<action android:id="@+id/startMyFragment"
    app:destination="@+id/myFragment">
    <argument
        android:name="myArg"
        app:argType="com.myapp.MyType"
        app:nullable="false" />
</action>

Above navigation graph creates lot of warnings during compilation. Could someone suggest how to avoid those warnings

 where K,V are type-variables:
     K extends Object declared in class HashMap
     V extends Object declared in class HashMap
 /builds/my-app/app/build/generated/source/navigation-args/debug/com/myapp/MyType.java:19: warning: [unchecked] unchecked call to put(K,V) as a member of the raw type HashMap
       this.arguments.put("myArg", myArg);

Thanks in advance



from unchecked warnings - during compilation when used Safe Args to pass data

No comments:

Post a Comment