https://kotlinlang.org logo
#spring
Title
s

sdeleuze

08/09/2019, 2:05 PM
I may miss something, but with following Java interface:
Copy code
public interface Expression {

    @Nullable
	Object getValue(EvaluationContext context, Object rootObject) throws EvaluationException;

    @Nullable
	<T> T getValue(EvaluationContext context, @Nullable Class<T> desiredResultType) throws EvaluationException;
}
And following Kotlin code
val value = expression.getValue(context, String::class.java)
, the method used is the first variant, not the second (with IDEA 2019.2 and Kotlin 1.3.41). Why?
🤔 1
m

Marcelus Trojahn

08/09/2019, 2:46 PM
I had a similar problem with this.
I wanted to use the last one... But it would always take some other... That was because of T, and I couldn't really figure out what was going on...
s

sdeleuze

08/09/2019, 2:46 PM
Hum, any existing bug referenced? Sounds like a surprising and big interop issue.
m

Marcelus Trojahn

08/09/2019, 2:47 PM
I fixed by adding a when checking for the class type and the compiler got the right one... Lemme find it
image.png
I wanted to pass that "parameter" in the end... But it would always default to the overrides that only had 3 parameters
s

sdeleuze

08/09/2019, 2:49 PM
Ok I will ask ok #general and if no more info I will create an issue
m

Marcelus Trojahn

08/09/2019, 2:51 PM
Yep... It does look like it's a inference thing... Once I made sure the of the viewClass class, it allowed it as a parameter and got the right override.
s

sdeleuze

08/09/2019, 2:51 PM
I tried to disable the new inference but same result
3 Views