thana
06/03/2019, 10:12 AMwhen(someSealedClass)
? I just came across a piece of code where it was very natural to use then when
without any assignment, hence the compiler would never complain when a branch was missing 🤔Maksim Vlasov
06/03/2019, 11:53 AMRedCross
06/03/2019, 12:11 PMthana
06/03/2019, 2:52 PMU75957
06/03/2019, 3:14 PMShawn A
06/03/2019, 3:15 PMProcessor<K,V>
public interface ProcessorSupplier<K, V> {
Processor<K, V> get();
}
Given I have a class:
class EventNotifier : Processor<String, SomeEvent>`
I thought I'd be able to
call the Kstream#process(ProcessorSupplier<? super K, ? super V> var1, String... var2)
method, but I am getting
a type mismatch error for:
stream.process({ EventNotifier() })
orangy
Marian Schubert
06/03/2019, 6:53 PMjava.io.File.listFiles
returns null sometimes?sxtanna
06/04/2019, 2:09 AMTuan Kiet
06/04/2019, 2:21 AMResult<T>
shouldn’t be a return type although runCatching
does?Sean Massie
06/04/2019, 4:34 AMvlad.minaev
06/04/2019, 5:54 AMEric Obermuhlner
06/04/2019, 6:30 AMabstract class A<T> {
abstract fun broken(vararg values: T): T
}
// Error: Class 'B' is not abstract and does not implement abstract base class member public abstract fun broken(vararg values: Int): Int defined in A
// Error: 'broken' overrides nothing
class B : A<Int>() {
override fun broken(vararg values: Int): Int {
return 5
}
}
The same code works fine if the subclass is with a "normal" object and not a primitive type.
Actually the IntelliJ IDE also thinks it should work, at least it generates the code for it but the compiler then complains about it.
Tested with kotlin 1.3.31Kulwinder Singh
06/04/2019, 8:55 AMjaspersmit
06/04/2019, 9:41 AMval varArgsFunction = createVarArgsFunction("foo")
varArgsFunction(1, 2, 3)
Kroppeb
06/04/2019, 10:05 AMsulemankhan447
06/04/2019, 11:26 AMKroppeb
06/04/2019, 11:27 AMribesg
06/04/2019, 1:00 PMVague
06/04/2019, 1:54 PMPaulius Ruminas
06/04/2019, 6:29 PMfunction foo<T extends Bar>() {}
and class Foo<T extends Bar> {}
. Just out of curiosity were there any limitations why it couldn't be like fun foo<T : Bar>() {}
in Kotlin?thana
06/04/2019, 7:39 PMdata class
which has a property of type Array<String> (let's forgo discussing whether or not to use arrays at all).
Let's do a step back: What should the equals
method generated for data classes do? I think they should compare the values of data classes.
Unfortunately when the data class
has an Array
property compares those arrays using equals()
and not using content(Deep)Equals()
.
Do you think this is a good idea? why?jw
06/04/2019, 7:40 PMfangzhzh
06/04/2019, 8:47 PMlouiscad
06/04/2019, 9:00 PMcontentEquals
a while ago: https://youtrack.jetbrains.com/issue/KT-26499
You can add your vote.mandeep
06/04/2019, 11:14 PMclass Foo {
fun bar() {
println("bar")
}
internal fun bar2() {
println("bar2")
}
}
internal class Foo2
It might output something like:
// public_api.txt
class Foo {
fun bar()
}
Tom Adam
06/05/2019, 8:12 AMEric Martori
06/05/2019, 8:51 AMinterface Foo<T> {
fun bar(t: T)
}
And we want to be able to have the same interface but without the parameter:
interface Foo {
fun bar()
}
but this is not possible because we are redeclaring the interface name. A possible solution is to declare Foo<Unit>
and pass Unit
instead of having the second interface without parameters, but this verbose on the calling and declaration site.
We have an extension function fun Foo<Unit>.bar() = bar(Unit)
to make the calling site clearer, but declaring it is still a little bit cumbersome.
Any ideas on how to achieve this?iex
06/05/2019, 9:42 AMiex
06/05/2019, 9:42 AM