Alexey Belkov [JB]
01/26/2019, 12:40 PM)
(which is common in test code) you might encounter a compiler crash with a stack trace that ends in something like IllegalArgumentException at getAbstractTypeFromDescriptor
. Here's the issue: https://youtrack.jetbrains.com/issue/KT-29475 . To avoid the crash just remove the )
from the offending function name. We'll try to come up with a way to fix this.Dalinar
01/26/2019, 8:11 PMvarargs args
to another fun accepting a varargs
then I must pass it as *args
.. but what about java, if I'm calling a kotlin fun expecting to be passed a varargs
from java then I should just send it as kotlinfun(args)
?Vishal
08/07/2019, 5:40 AMVishal
08/07/2019, 5:43 AMtschuchort
08/07/2019, 9:25 PMClassElement
is implemented as AClassElement
if it was converted from source langauge A or BClassElement
if it was converted from source language B and the conversion happens mostly in the constructors). They are essentially data classes but many properties have to be computed lazily.
My problem is how to reuse the construction code for related AST elements. For example, ClassElement
and InterfaceElement
both extend ClassLikeElement
and share a lot of properties. Usually I could put the shared logic into ClassLikeElement
and inherit it, but here it doesn't work because the implementations for ClassLikeElement
need to be different for source languages A
and B
. My options are:
1. Put the shared logic into delegate objects and make two implementations of every AST element for the source languages A
and B
2. Make the AST classes pure data classes and do all the conversion in a factory.
3. Mix both options?
Which approach is preferable?karelpeeters
08/08/2019, 7:53 AMjermainedilao
08/08/2019, 7:53 AMbhavin
08/08/2019, 8:59 AMMarc Reichelt
08/08/2019, 2:10 PMthana
08/08/2019, 2:19 PMgradle assemble
somehow? during the compilation the the kotlinx.serialization plugin generates bad bytecode and throws an exception. i'd like to break excactly there so find out what excactly is bad, but im clueless how to do that (breakpoint on all exceptions didn;t do the trick)Adam Spofford
08/08/2019, 5:14 PMAdam Spofford
08/08/2019, 5:15 PMAdam Spofford
08/08/2019, 5:15 PMrrader
08/08/2019, 8:53 PMbostonmacosx
08/10/2019, 4:07 AMjkbbwr
08/11/2019, 1:10 AMjkbbwr
08/11/2019, 1:10 AMe: /home/jakob/projects/personal/reactor/src/main/kotlin/dev/kibb/reactor/main.kt: (11, 19): Unresolved reference: UraniumBaseListener
e: /home/jakob/projects/personal/reactor/src/main/kotlin/dev/kibb/reactor/main.kt: (17, 17): Unresolved reference: UraniumLexer
e: /home/jakob/projects/personal/reactor/src/main/kotlin/dev/kibb/reactor/main.kt: (18, 18): Unresolved reference: UraniumParser
jkbbwr
08/11/2019, 1:10 AMjkbbwr
08/11/2019, 1:10 AMjkbbwr
08/11/2019, 1:11 AMimport org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.3.41"
antlr
}
group = "dev.kibb"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
maven(url = "<https://dl.bintray.com/hotkeytlt/maven>")
}
dependencies {
antlr("org.antlr:antlr4:+")
implementation(kotlin("stdlib-jdk8"))
testImplementation(kotlin("test"))
testImplementation(kotlin("test-junit"))
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
tasks.generateGrammarSource {
arguments.addAll(listOf(
"-package", "dev.kibb.reactor"
))
}
jkbbwr
08/11/2019, 1:11 AMjkbbwr
08/11/2019, 1:52 AMIaroslav Postovalov
08/11/2019, 9:35 AMDaniel
08/11/2019, 12:48 PMandroidExtensions {
experimental = true
}
?
I IDE cant resolve `@Parcelize`even through it should with the experimental = trueDaniel
08/11/2019, 12:58 PMJust apply the kotlin-android plugin before the
kotlin-android-extensions and it should work...
haroldadmin
08/12/2019, 5:56 AM@GET("/")
suspend fun getSomething(): MySealedClass<SuccessType, ErrorType>
On a Reddit discussion thread, Jake left some instructions on how this could be done: https://www.reddit.com/r/androiddev/comments/c6m3yv/network_request_wrapper_extension_for_retrofit_26
Here's the relevant part:
I am unable to figure out how to do the delegation part. I have a call of the typewill ask Retrofit for a CallAdapter to handlesuspend fun whatever(): Whatever
. Knowing this, you can register aCall<Whatever>
which looks forCallAdapter.Factory
, delegates to the built-in factory forCall<YourSealedClass<BodyType>>
, and then wraps the value inCall<BodyType>
. This will allowYourSealedClass
to work–no extension needed.suspend fun whatever(): YourSealedClass<Whatever>
Call<MySealedClass<SuccessType, E>>
, and need to find a delegate which can adapt Call<SuccessType>
. More specifically, I can not figure out how to create a Parameterized Type Token for Call<SuccessType>
so that I can pass it to retrofit to find the delegated adapter for me.
I would really appreciate some help with this.haroldadmin
08/12/2019, 6:38 AMCall
to another Future-like type. I don't know how to add a call adapter that can convert from Call<Type1>
to Call<Type2>
Kavin
08/12/2019, 11:43 AMforEachIndexed
loop in Kotlin? While iterating the array, I want to break it based on a specific condition is met. I have tried break
but getting compile time error break and continue are only allowed inside a loop. Using return
just skips that specific index but continues the loop. Does it mean we cannot break
forEach
or forEachIndexed
?Big Chungus
08/12/2019, 11:55 AMcorneil
08/12/2019, 12:03 PMfilter
or find
before the forEach