xenoterracide
01/10/2019, 8:01 PMxenoterracide
01/10/2019, 8:01 PMsingleton
wasn’t chosen)karelpeeters
01/10/2019, 8:03 PMkarelpeeters
01/10/2019, 8:05 PMinner object
doesn't compile, is there a reason for that or has there been any discussion on this? I came accross a use case when trying to get a DSL to be more readable, to provide a forced grouping of actions in a child-dsl:
Posted in #generalkarelpeeters
01/10/2019, 8:05 PMxenoterracide
01/10/2019, 8:06 PMcompanion object
isn’t a singleton? strange…karelpeeters
01/10/2019, 8:06 PMinner class
is something different though: https://kotlinlang.org/docs/reference/nested-classes.html#inner-classesxenoterracide
01/10/2019, 8:08 PMjerome moulin
11/21/2020, 3:48 PModay
11/21/2020, 7:59 PMNikky
11/22/2020, 3:48 AMList<@MyAnnotation String>
and there seems to be a target for that: AnnotationTarget.TYPE
but i am not entirely sure this is available at runtime or how to retrieve thisi n Lists and Maps
(the only way i can guess that this is the right target is because idea autofixes this for me)
there is also the target TYPE_PARAMETER
which is labeled as unsupported yet
if this is truly unsupported then the best option would be some wrapper annotations like @ListElement
, @MapKey
, @MapValue
but the limitations of no supertypes on annotations and cannot use Array<Annotation>
as parameter would force me to add a field for every annotation type i want to add
and then i cannot have default values on annotation classes.. leading the user to have to add 20+ (exaggerated) empty arays in the arguments
any suggestions for how to solve this.. cleanly ?Priyank Jain
11/22/2020, 11:00 AMAlexander Karkossa
11/23/2020, 1:00 AMAlexander Karkossa
11/23/2020, 1:00 AM> Task :app:compileDebugKotlin
e: java.lang.IllegalStateException: Backend Internal error: Exception during code generation
The root cause java.lang.RuntimeException was thrown at: org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate(FunctionCodegen.kt:50)
....
Caused by: java.lang.RuntimeException: Exception while generating code for:
FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:xx.xxxx.xxxx.xxxx.xx.xxxx.Xxxxx) returnType:kotlin.String
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:xx.xxxx.xxxx.xxxx.xx.xxxx.Xxxxx
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in xx.xxxx.xxxx.xxxx.xx.xxxx.Xxxxx'
CALL 'public final fun toString (): kotlin.String declared in java.lang.StringBuilder' type=kotlin.String origin=null
$this: CALL 'public final fun append (value: kotlin.String): java.lang.StringBuilder declared in java.lang.StringBuilder' type=java.lang.StringBuilder origin=null
$this: CALL 'public final fun append (value: kotlin.Any?): java.lang.StringBuilder declared in java.lang.StringBuilder' type=java.lang.StringBuilder origin=null
$this: CALL 'public final fun append (value: kotlin.String): java.lang.StringBuilder declared in java.lang.StringBuilder' type=java.lang.StringBuilder origin=null
$this: CALL 'public final fun append (value: kotlin.String): java.lang.StringBuilder declared in java.lang.StringBuilder' type=java.lang.StringBuilder origin=null
$this: CALL 'public final fun append (value: kotlin.Any?): java.lang.StringBuilder declared in java.lang.StringBuilder' type=java.lang.StringBuilder origin=null
$this: CALL 'public final fun append (value: kotlin.String): java.lang.StringBuilder declared in java.lang.StringBuilder' type=java.lang.StringBuilder origin=null
$this: CALL 'public final fun append (value: kotlin.String): java.lang.StringBuilder declared in java.lang.StringBuilder' type=java.lang.StringBuilder origin=null
....
Few 1000 lines
....
value: CALL 'public final fun String$583$str$fun-toString$class-Xxxxx (): kotlin.String declared in xx.xxxx.xxxx.xxxx.xx.xxxx.LiveLiterals$XxxxxKt' type=kotlin.String origin=null
$this: GET_FIELD 'FIELD FIELD_FOR_OBJECT_INSTANCE name:INSTANCE type:xx.xxxx.xxxx.xxxx.xx.xxxx.LiveLiterals$XxxxxKt visibility:public [final,static]' type=xx.xxxx.xxxx.xxxx.xx.xxxx.LiveLiterals$XxxxxKt origin=null
value: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:nopoxRezDosageEntry type:<http://kotlin.Int|kotlin.Int>? visibility:private [final]' type=<http://kotlin.Int|kotlin.Int>? origin=null
receiver: GET_VAR '<this>: xx.xxxx.xxxx.xxxx.xx.xxxx.Xxxxx declared in xx.xxxx.xxxx.xxxx.xx.xxxx.Xxxxx.toString' type=xx.xxxx.xxxx.xxxx.xx.xxxx.Xxxxx origin=null
value: CALL 'public final fun String$585$str$fun-toString$class-Xxxxx (): kotlin.String declared in xx.xxxx.xxxx.xxxx.xx.xxxx.LiveLiterals$XxxxxKt' type=kotlin.String origin=null
$this: GET_FIELD 'FIELD FIELD_FOR_OBJECT_INSTANCE name:INSTANCE type:xx.xxxx.xxxx.xxxx.xx.xxxx.LiveLiterals$XxxxxKt visibility:public [final,static]' type=xx.xxxx.xxxx.xxxx.xx.xxxx.LiveLiterals$XxxxxKt origin=null
at org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen.generateMethod(ClassCodegen.kt:285)
at org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen.generate(ClassCodegen.kt:123)
at org.jetbrains.kotlin.backend.jvm.JvmBackendFacade.doGenerateFilesInternal$backend_jvm(JvmBackendFacade.kt:139)
... 37 more
Caused by: java.lang.StackOverflowError
at org.jetbrains.kotlin.ir.declarations.impl.IrDeclarationBase.getParent(IrDeclarationBase.kt:39)
at org.jetbrains.kotlin.backend.jvm.intrinsics.IrIntrinsicMethods$Companion.toKey(IrIntrinsicMethods.kt:220)
at org.jetbrains.kotlin.backend.jvm.intrinsics.IrIntrinsicMethods$Companion.access$toKey(IrIntrinsicMethods.kt:211)
at org.jetbrains.kotlin.backend.jvm.intrinsics.IrIntrinsicMethods.getIntrinsic(IrIntrinsicMethods.kt:157)
user
11/23/2020, 1:24 PMBrian Dilley
11/23/2020, 10:36 PMList
is unmodifiableBrian Dilley
11/23/2020, 10:36 PMMutableList
is modifiableBrian Dilley
11/23/2020, 10:37 PMlistOf(….)
gives you an immutable (unmodifiable) List
Brian Dilley
11/23/2020, 10:37 PMMutableList
- just cast it as a List
and it’s no longer modifiableKirill Grouchnikov
11/23/2020, 10:40 PMModifiableList
unless I'm misunderstanding the compile time distinction of itBig Chungus
11/24/2020, 10:10 AMuser
11/24/2020, 12:25 PMuser
11/25/2020, 2:33 PMuser
11/25/2020, 2:50 PMuser
11/25/2020, 6:00 PMuser
11/26/2020, 8:28 AMJrichards1408
11/26/2020, 2:49 PMval (firsy, rest) = value.split(" ", limit = 2)
Jrichards1408
11/26/2020, 2:50 PMval first;
val rest;
??Jrichards1408
11/26/2020, 2:51 PMtrathschlag
11/26/2020, 10:08 PMclass MySingleMethodClass(dependency: Dependency) : (Int) -> String by { dependency.extractStringFromInt(it) }
Useful for:
fun stuff(printHello: () -> Unit, wipeDisk: () -> Unit) { ... }
...
val wipeDisk = getWipeDisk(dependency)
val printHello = getPrintHello(dependency)
stuff(wipeDisk, printHello) // ooops...
// now with types:
fun stuff(printHello: PrintHello, wipeDisk: WipeDisk) { ... }
...
val wipeDisk = WipeDisk(dependency)
val printHello = PrintHello(dependency)
stuff(wipeDisk, printHello) // does not compile