david-wg2
08/01/2019, 10:32 AMobject Config {
val port = System.getenv("PORT") ?: 8080
}
tjohnn
08/01/2019, 10:51 AMMutableList.map{ ... }
to return MutableList
instead of List
tjohnn
08/01/2019, 10:53 AMtoMutableList()
again after mapping?oday
08/01/2019, 9:18 PMRodrigo Silva
08/02/2019, 4:37 PMMike R
08/04/2019, 11:21 PMval queue: Queue<() -> Unit> = LinkedList()
, but I don't think the Queue type will do what I need as I described above. Any recommendations?Mike R
08/05/2019, 3:05 AMannotation class Queueable
with a Target of AnnotationTarget.FUNCTION
.
I'm not finding any documentation anywhere on how I can accomplish the rest of what I'd like to do though...
In Python, for example, I can annotate a function and access it's arguments and other properties about it since the annotation wraps the function. Am I thinking about annotations incorrectly in Kotlin?Jérémy Touati
08/05/2019, 5:36 AMopen class SuperClass {
override operator fun equals(other: Any?): Boolean {
return super.equals(other)
}
}
class ExtendedClass : SuperClass() {
override operator fun equals(other: Any?): Boolean {
return super.equals(other)
}
}
Error:(9, 14) Kotlin: 'operator' modifier is inapplicable on this function: must override ''equals()'' in Anyso apparently this doesn't compile unless I remove the
operator
keyword from `ExtendedClass`' implementation
is this intended behavior? this seems... a bit weird and unintuitive to medharrigan
08/06/2019, 8:10 AMPagoda 5b
08/07/2019, 12:02 PMfun OtherType.myFunc(...)
, what's the syntax to choose the right super extension function for my override?mathew murphy
08/07/2019, 8:32 PMabstract class AbstractClass (
val a : String? = null,
val b : String? = null,
val c : String? = null,
val d : String? = null,
val e : String? = null,
val f : String? = null,
val g : String? = null
)
class MyClass (
a, b, c, d, e, f, g,
val h : String? = null,
val i : String? = null
) : AbstractClass(
a, b, c, d, e, f, g
)
Is there any kind of shorthand to avoid having to repeat a,b,c,d,e,f,g twice when defining the class?Mani
08/10/2019, 3:27 PMtipsy
08/10/2019, 8:44 PMvar initialized = false
if (!initialized) {
...
initialized = true
}
Mike R
08/11/2019, 12:44 AMTony Blundell
08/12/2019, 10:03 AMfun doSomething() {
// return instance of whatever is between the angle brackets below
}
val x = <MyType>doSomething()
val y = <MyOtherType>doSomething()
How should the signature of doSomething look?Esa
08/12/2019, 12:10 PMtjohnn
08/15/2019, 10:06 AMscottiedog45
08/15/2019, 2:59 PMandym
08/15/2019, 3:45 PMclass Foo {
fun bar(p1: Int)
fun bar(p2: String)
}
Is it possible to reference one of the bar()
overloads as a function argument?bloder
08/16/2019, 3:11 AM@TestAnnotation("bar") fun foo() {}
And my plugin would change its bytecode to something like:
fun foo_bar() {}
And by doing that, compiler would support many functions with the same name? like:
@TestAnnotation("bar") fun foo() {}
@TestAnnotation("bar2") fun foo() {}
@TestAnnotation("bar3") fun foo() {}
Jérémy Touati
08/17/2019, 11:36 AMList#toMutableList()
(it seems a bit overkill to mark the resulting variable as a MutableList
then), so i ended up going for the 3rd approach (aka, only for overridable stuff), but i was curious if there was some kind of consensus on thisbjonnh
08/19/2019, 8:00 PMMarcin Wisniowski
08/22/2019, 12:38 AMfun main() {}
without the args array (works with it), why is that?Florian
08/22/2019, 10:23 AMVictor Pineda
08/22/2019, 10:34 AMType mismatch: inferred type is Cursor? but Cursor was expected
I can ignore it safely but de IDE does not provide me any suggestion to add a @SupressWarning`
Arian Stolwijk
08/22/2019, 12:21 PMSlackbot
08/23/2019, 4:29 AMJack Englund
08/24/2019, 12:45 AMfun System.currentTimeSeconds(): Long {
return System.currentTimeMillis()/1000
}
and yet I can't do System.currentTimeSeconds(). Am I missing a concept or can you not do extension functions on System?chris.chen
08/24/2019, 2:37 PMand
&&
for example:
val a = 3
val b = 4
val c = 5
val d = 3
val result1 = b == c && a == d
val result2 = (b == c) and (a == d)
1) the result2 if we write val result2 = b == c and a == d
will not work. not sure why
2) For result1 because the b==c is false. so will not run a==d case. but result2 will get false false so finally will be false. which means result1 only perform one time check and result2 perform 2 times check.
Is my understanding correct?Jack Englund
08/25/2019, 3:26 AMclass Car: Vehicle()
...
getObjectChildClass(Car())
...
fun getObjectChildClass(obj: Vehicle) {
// From here I want the to know if it's a Car or some other class that extends vehicle, like Truck.
}
Jack Englund
08/25/2019, 3:26 AMclass Car: Vehicle()
...
getObjectChildClass(Car())
...
fun getObjectChildClass(obj: Vehicle) {
// From here I want the to know if it's a Car or some other class that extends vehicle, like Truck.
}
Luca Nicoletti
08/25/2019, 5:51 AMobj::class.java.name
Jack Englund
08/25/2019, 6:25 AMLuca Nicoletti
08/25/2019, 6:28 AMJack Englund
08/25/2019, 6:54 AMThomas
08/25/2019, 8:25 AMJack Englund
08/26/2019, 12:09 AMHashMap<DataType, Packet>
. I'm using the DataType enum beacuse I have X amount of classes that might be stored as a Packet. Originally I had a helper method, classToDataType()
, which I wanted to give a class, and then have it return the data type.
I could've done type check but then I would have to make a list of possible classes and check every one. Given that it's part of caching I dont want to have to loop a potentially large list every time.Thomas
08/26/2019, 6:55 AM