eclipse / xtext

Eclipse Xtext™ is a language development framework
http://www.eclipse.org/Xtext
Eclipse Public License 2.0
769 stars 321 forks source link

Compiler error on overloaded AssertJ method #2328

Open johanwannheden opened 4 years ago

johanwannheden commented 4 years ago

The following valid Java code fails to compile in Xtend:

org.assertj.core.api.Assertions.<MyType>assertThat(myEntity).isNotNull();

Whereas MyType refers to a type generated by EMF.

With the following Xtend code:

org.assertj.core.api.Assertions::<MyType>assertThat(myEntity).isNotNull()

the Xtend editor shows this error:

Bounds mismatch: The type argument is not a valid substitute for the bounded type parameter <T extends Comparable<? super T>> of the method assertThat(T)

And this code:

assertThat(myEntity).isNotNull()

results in the following error:

Type mismatch: cannot convert from EObject to BigDecimal

Xtend version used is 2.19.0.

cdietrich commented 4 years ago

same issue as https://github.com/eclipse/xtext/issues/2298 ?

johanwannheden commented 4 years ago

Might be related, hard for me to tell. The message relating to the BigDecimal type is bogus, the assertThat(BigDecimal) method just happens to be the first method declared in the AssertJ Assertions class.

cdietrich commented 4 years ago

@szarnekow any idea what could cause this?

szarnekow commented 4 years ago

I assume it is caused by all type parameters on the overloads having the same name 🤕

szarnekow commented 4 years ago

In other words, some invalid shadowing kicking in when looking up JvmOperations on JvmDeclaredTypes

I've this on my list to investigate further.