Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [Xtend] error occurs by changing method-order in Java base class
[Xtend] error occurs by changing method-order in Java base class [message #997139] Thu, 03 January 2013 22:30 Go to next message
Tim Ehlers is currently offline Tim Ehlers
Messages: 1
Registered: January 2013
Junior Member
I stumbled upon an oddity in xtend version 2.3.1: I have a xtend class wich extends a java class like this:

package demo

class XtendClass extends JavaClass {

	def String example() {
		run [|System::out.println("hello")]
		run [|"hello"]
	}
	
}


package demo;

class JavaClass {

	public interface Runner {
		public void run();
	}

	public interface RunnerWithResult<T> {
		public T run();
	}

	protected void run(Runner runner) {
		runner.run();
	}

	protected <T> T run(RunnerWithResult<T> runner) {
		return runner.run();
	}

}


An error occurs in the xtend class, when you switch the position of the two protected "run" methods in the java class:
Incompatible implicit return type. Expected java.lang.String but was void


Re: [Xtend] error occurs by changing method-order in Java base class [message #997168 is a reply to message #997139] Fri, 04 January 2013 09:04 Go to previous message
Sebastian Zarnekow is currently offline Sebastian Zarnekow
Messages: 2908
Registered: July 2009
Senior Member
Hi Tim,

thanks for your feedback. I filed a ticket:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=397424

Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 04.01.13 03:03, schrieb Tim Ehlers:
> I stumbled upon an oddity in xtend version 2.3.1: I have a xtend class
> wich extends a java class like this:
>
>
> package demo
>
> class XtendClass extends JavaClass {
>
> def String example() {
> run [|System::out.println("hello")]
> run [|"hello"]
> }
>
> }
>
>
>
> package demo;
>
> class JavaClass {
>
> public interface Runner {
> public void run();
> }
>
> public interface RunnerWithResult<T> {
> public T run();
> }
>
> protected void run(Runner runner) {
> runner.run();
> }
>
> protected <T> T run(RunnerWithResult<T> runner) {
> return runner.run();
> }
>
> }
>
>
> An error occurs in the xtend class, when you switch the position of the
> two protected "run" methods in the java class: Incompatible implicit
> return type. Expected java.lang.String but was void
>
>
Previous Topic:Fix Eclipse XText Site (and include source links)
Next Topic:Formatter ignoring "comment" rules - remember to provide own IHiddenTokenHelper implementa
Goto Forum:
  


Current Time: Sun Oct 26 03:05:15 GMT 2014

Powered by FUDForum. Page generated in 0.02390 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software