Kotlin – 混淆的属性名称

我正在开发一个Kotlin Android应用程序,我遇到了集成Google Sign In的问题,当我获取GoogleSignInAccount以提取属性时,属性名称似乎被混淆了(或以其他方式混淆),下面是在AS 2.3调试器上查看属性的方式:

调试器

以下是试图访问这些属性的代码片段:

private fun googleSignInResult(data : GoogleSignInResult) { if (data.isSuccess) { if (data.signInAccount != null) { val account = data.signInAccount val authData = HashMap<String, String>() authData["id_token"] = account?.idToken.let { it } ?: return authData["id"] = account?.id.let { it } ?: return val task = ParseUser.logInWithInBackground("google", authData) task.continueWith { user -> if (task.isCancelled) { Log.d(TAG, "User cancelled Google login") } else if (task.isFaulted) { Log.d(TAG, "Failed: " + task.error) } else { this.user = task.result this.user?.put("email", account?.email) this.user?.put("name", account?.displayName) this.user?.put("firstName", account?.displayName) this.user?.saveInBackground({ error -> if(error != null) { Log.d(TAG, "Error: " + error.message) this.user?.deleteInBackground() ParseUser.logOutInBackground() } else { //Logged in successfully } }) } } } } } 

任何人都可以揭示一下,为什么它的属性看起来像这样呢?当我试图访问idToken或id时,它们总是为空,但是,被“模糊化”的属性名称不能被访问,这是一个kotlin错误还是我的错误?

任何帮助将不胜感激!

以下内容最初由@EugenPechanec发布,作为对问题主体的评论。 一些修改被应用来促进阅读体验。


字段 ,来自JVM的术语不是属性 ,这是Kotlin术语。 你在JVM上,你在调试器中看到的是支持Kotlin属性的混淆字段。 获得者是公开的并保留原来的名字。 Java .getDisplayName()是Kotlin中的.displayName