rednifre
05/29/2016, 4:11 PMuntwisted
05/29/2016, 4:29 PMgson.fromJson<Map<String, Any>>(jsonString)
this worked all day yesterday. Now today I am seeing java.lang.IllegalArgumentException: Either none or all type parameters can be wildcard in java.util.Map<java.lang.String, ?>
. I am pretty sure nothing changed, so I have no idea why it's suddenly broken. Is a Map<String, Any>
unacceptable?untwisted
05/29/2016, 4:31 PMrednifre
05/29/2016, 4:34 PMuntwisted
05/29/2016, 4:50 PMrednifre
05/29/2016, 5:37 PMuntwisted
05/29/2016, 6:11 PMbsideup
05/29/2016, 7:08 PMrednifre
05/29/2016, 7:28 PMuntwisted
05/29/2016, 7:29 PMJsonObject
. I guess I'm just confused why the Map<String, Any>
doesn't work sometimes.danijoo
05/29/2016, 7:33 PMuntwisted
05/29/2016, 7:35 PMAndreas Sinz
05/29/2016, 7:45 PMorangy
mikegehard
05/29/2016, 9:15 PMval foo: String?
Is the only way to run some code if foo is not null this:
if (foo != null) {
bar(foo)
}
where:
fun bar(x: String)
mikegehard
05/29/2016, 9:16 PMmap
operation on foo
like an optional.Ruckus
05/29/2016, 9:20 PMfoo?.let { bar(it) }
?mikegehard
05/29/2016, 9:23 PMRuckus
05/29/2016, 9:30 PMRuckus
05/29/2016, 9:31 PMmikegehard
05/29/2016, 9:31 PMRuckus
05/29/2016, 9:33 PMorangy
mikegehard
05/29/2016, 10:03 PMmikegehard
05/29/2016, 10:04 PMpasssy
05/29/2016, 10:09 PM// automatically non-null
val handler = Thread.getDefaultUncaughtExceptionHandler()
// no warning, everything compiles, crashes at runtime
handler.uncaughtException(thread, throwable)
// alt + enter -> "specify type explicitly" suggests nullable type
val handler: Thread.UncaughtExceptionHandler? = Thread.getDefaultUncaughtExceptionHandler()
// Error: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Thread.UncaughtExceptionHandler?
handler.uncaughtException(thread, throwable)
passsy
05/29/2016, 10:10 PMspecify type explicitly
change the type?passsy
05/29/2016, 10:11 PMorangy
passsy
05/29/2016, 10:21 PMval handler: Thread.UncaughtExceptionHandler? = Thread.getDefaultUncaughtExceptionHandler()
// shorter
val handler = Thread.getDefaultUncaughtExceptionHandler() ?: null