Community
Participate
Working Groups
Build Identifier: I20110613-1736 Xtend2 reports a strange `incompatible types` error within an Xtend class method if we pass instance of that class to some external method defined in pure Java. Let's see an example. The `Hello.xtend` is: --------------------- package com.my.hello class Hello { String message def setMessage(String message) { this.message = message } override toString() { return message } } --------------------- The `HelloService.java` is: --------------------- package com.my.hello; public class HelloService { public void say(Hello hello) { System.err.println(hello); } } --------------------- The `Test.xtend` is: --------------------- package com.my.hello class Test { def test() { val helloService = new HelloService() val hello = new Hello() hello.message = 'Hello World!' helloService.say(hello) } } --------------------- In the `Test.xtend` I am seeing following error at line: 11 Incompatible types. Expected com.my.hello.Hello but was com.my.hello.Hello I have tested with xtext 2.0.0 as well as 2.0.1 This so critical that we are unable to move ahead with our projects. Reproducible: Always Steps to Reproduce: 1. Create a Java project with plugin & xtext nature 2. Add plugin dependency to org.eclipse.xtext.xbase.lib 3. Add plugin dependency to org.eclipse.xtext.xtend2.lib 4. Create all the three files listed in the discription
Created attachment 202220 [details] test project Here is the test project to reproduce the same error.
Created attachment 202223 [details] screenshot Here is a screenshot showing the error.
We need to make sure that the JVM types use the global scope, i.e. link to shadowing JVMTypes from Xtext's index.
Pushed to master.
Closing all bugs that were set to RESOLVED before Neon.0