dumptruckman
06/30/2017, 3:35 PMoverride fun getMessage(): String {
return super.message
}
It says 'getMessage' overrides nothingdineshbob
07/01/2017, 5:02 AMjschneider
07/01/2017, 9:28 AMvoddan
07/01/2017, 9:43 AMakerenyi
07/01/2017, 3:50 PMkarelpeeters
07/01/2017, 6:45 PMsitepodmatt
07/03/2017, 6:41 AMthisen
07/03/2017, 6:49 PMfun ContentType.withCharset(charset: Charset) = withParameter("charset", charset.name())
Why isn't it placed inside the class?karelpeeters
07/04/2017, 7:37 AMelect
07/04/2017, 11:07 AM1.2-M1
and now top level parameters and functions are invisible from gradle dependencies projects..
what happens? anyone experienced anything similar?karelpeeters
07/04/2017, 7:52 PMdierre
07/05/2017, 8:10 AMkirillrakhman
07/05/2017, 8:11 AMjschneider
07/05/2017, 5:52 PMrockerhieu
07/06/2017, 2:21 AMfun click(onClick: ((v: View) -> Unit)? = null) {}
What is the correct syntax for describing click(if (condition) null else <a lambda>)
rajendhiraneasu
07/06/2017, 12:42 PMdierre
07/06/2017, 3:47 PMfun RestClientBuilder.withKotlinSupport(): RestClientBuilder {
KotlinRestClientFactoryConfigurer.configure(this)
return this
}
Now this class just adds the KotlinModule for Jackson. The problem is that if I build my RestClient
with the RestClientBuilder
on the child project, there is no way I can see withKotlinSupport
. Could you tell me a way to identify which is the problem?kaiyang.tay
07/06/2017, 4:02 PMelect
07/06/2017, 4:04 PMcontinue
the while
if I have something like:
while(..) {
x?.let{ ... if(y) continue }
?poohbar
07/06/2017, 6:49 PMkarelpeeters
07/07/2017, 2:58 PMjschneider
07/08/2017, 9:35 AMclass DaClass {
companion object {
@JvmStatic
fun convert(strings: Iterable<String>): List<Int> {
return strings.map { convert(it) }
}
@JvmStatic
fun convert(string: String): Int {
return java.lang.Integer.parseInt(string)
}
}
}
Java-Call:
List<String> list = ImmutableList.of("1", "2");
System.out.println(DaClass.convert(list));
List<? extends String> listWithWildcards = ImmutableList.of("1", "2");
System.out.println(DaClass.convert(listWithWildcards)); //Does *not* compile
diesieben07
07/08/2017, 10:44 AMcopy
. If you use invoke
in the companion object, you can make it look like a normal constructor call though.danneu
07/08/2017, 4:30 PMkarelpeeters
07/08/2017, 9:53 PMenum class Test {
A, B, C
}
val a = Test.valueOf("A")
jschneider
07/08/2017, 10:07 PMpublic <E extends Throwable> void foo() throws E
orangy
()
. Either check it for null, or use safe call with explicit invokeqwasz
07/09/2017, 2:54 AMmenegatti
07/10/2017, 7:33 AMveiset
07/10/2017, 11:28 AMgetOrElse
works.
fun foo(x: String) : () -> String = { x + "!" }
val map = mapOf(Pair("a", 1), Pair("b", 2))
val result = map.getOrElse("x", foo("kotlin"))
I would expect a type-error here, but it happily returns a String. If I define the type of result
it works as I would expect. Can someone help me understand the type definition of `orGetElse`:
public inline fun <K, V> Map<K, V>.getOrElse(key: K, defaultValue: () -> V): V = get(key) ?: defaultValue()