Björn Mayer
04/14/2021, 9:02 AMclass ExampleConverter<T> : Converter<T, String> {
override fun convert(source: T): String? {
TODO("Not yet implemented")
}
}
it implements this Java interface:
@FunctionalInterface
public interface Converter<S, T> {
/**
* Convert the source object of type {@code S} to target type {@code T}.
* @param source the source object to convert, which must be an instance of {@code S} (never {@code null})
* @return the converted object, which must be an instance of {@code T} (potentially {@code null})
* @throws IllegalArgumentException if the source cannot be converted to the desired target type
*/
@Nullable
T convert(S source);
}
The IDE says, that everything is fine.
However when I try to compile I get:
Class 'ExampleConverter' is not abstract and does not implement abstract member public abstract fun convert(p0: T!!): String?
'convert' overrides nothing
Any idea?Pavel Sidyakin
04/14/2021, 9:07 AMBjörn Mayer
04/14/2021, 9:08 AMPavel Sidyakin
04/14/2021, 9:20 AMandroid {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
Björn Mayer
04/14/2021, 9:27 AMkotlinOptions {
freeCompilerArgs = listOf(
"-progressive",
"-Xinline-classes",
"-Xjsr305=strict",
"-Xjvm-default=enable",
"-Xopt-in=kotlin.ExperimentalUnsignedTypes"
)
jvmTarget = "11"
javaParameters = true
}
Java Toolchain is set to 11:
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}
Pavel Sidyakin
04/14/2021, 9:31 AM"-Xjsr305=strict",
Pavel Sidyakin
04/14/2021, 9:32 AMPavel Sidyakin
04/14/2021, 9:32 AMPavel Sidyakin
04/14/2021, 9:34 AMBjörn Mayer
04/14/2021, 9:34 AMPavel Sidyakin
04/14/2021, 9:34 AMJ.Snow
04/14/2021, 9:35 AMorg.springframework.core.convert.Converter
which is come from springBjörn Mayer
04/14/2021, 9:39 AMprogressive
Björn Mayer
04/14/2021, 10:01 AMBjörn Mayer
04/14/2021, 10:04 AMprogressive
or Xjsr305=strict
compiler args leads to succesful compilation.
However: both shouldn’t cause this IMOBjörn Mayer
04/14/2021, 10:14 AM