Skip to main content



      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 08:05 Go to next message
Eclipse UserFriend
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 09:13 Go to previous messageGo to next message
Eclipse UserFriend
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)
	}
Re: Flaky "Ambiguous feature call" error with Xtend 2.7.3 [message #1645532 is a reply to message #1645333] Mon, 02 March 2015 10:05 Go to previous message
Eclipse UserFriend
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: Thu Jul 10 09:09:32 EDT 2025

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

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

Back to the top