Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Flaky "Ambiguous feature call" error with Xtend 2.7.3
Flaky "Ambiguous feature call" error with Xtend 2.7.3 [message #1645333] Mon, 02 March 2015 13:05 Go to next message
Andreas Heiduk is currently offline Andreas HeidukFriend
Messages: 3
Registered: November 2014
Junior Member
I'm migrating from Xtext 2.6.x to 2.7.3 and I stumbled over a sporadic compile error in some Xtend code.

The minimal example requires two files:

package xxx

abstract class Base{
	
	Child childExtension
	
	def protected dispatch Boolean foo(Object it){
		null
	}
	
	def protected dispatch Boolean foo(Integer it){
		val Boolean x = childExtension.foo(it)  // required for bug
		x
	}
}


and the other file:

package xxx

class Child extends Base {
	
	def protected dispatch Boolean foo(String it){
		val x = foo(null)	// first occurrence always OK
		x
	}
	
	def protected dispatch Boolean foo(StringBuilder it){
		val x = foo(null)	// second and following occurrences fail, but are marked only sometimes 
		// Ambiguous feature call. The methods foo(Object) in Child and foo(Object) in Base both match. 
		x
	}
}


The strange parts are:


  • The compiler thinks that the two generated dispatch methods in Base and Child are in conflict. But only in this specific situation.
  • The delegation call in Base is required for the error.
  • The first call to the method is not marked as an error.
  • Touching the file (SAPCE-BACKSPACE-SAVE) removes the error from the editor but not from the Problems View. Closing and reopening the editor shows the error again.
  • Building with Maven sometimes show the error, sometimes not.


So my questions are:


  • Is there a workaround?
  • Should I file a bug?
  • Is there a chance that this is solved before 2.8? (i.e. will there be a version 2.7.4)


Regards,
Andreas
Re: Flaky "Ambiguous feature call" error with Xtend 2.7.3 [message #1645442 is a reply to message #1645333] Mon, 02 March 2015 14:13 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 13882
Registered: July 2009
Senior Member
Hi,

Xtext 2.8 will be released in March 2015 so there will be no 2.7.4 (https://twitter.com/xtext/status/560890014641704961)
Can you please file a bug for the problem

as a workround (in base)

	def protected dispatch Boolean foo(Integer it){
		val Boolean x = childExtension.foo2(it)  // required for bug
		x
	}
	
	def Boolean foo2(Object o) {
		foo(o)
	}


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Flaky "Ambiguous feature call" error with Xtend 2.7.3 [message #1645532 is a reply to message #1645333] Mon, 02 March 2015 15:05 Go to previous message
Andreas Heiduk is currently offline Andreas HeidukFriend
Messages: 3
Registered: November 2014
Junior Member
Thank you Christian!
I'll file a bug in the evening.
Previous Topic:How to use Xtext internal.Stopwatch in measuring performance
Next Topic:Xbase: Add own EMF-classes to the model
Goto Forum:
  


Current Time: Wed Apr 14 09:24:19 GMT 2021

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

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

Back to the top