Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » ResolvedOperations.getDeclaredOperations
ResolvedOperations.getDeclaredOperations [message #1506089] Wed, 10 December 2014 15:19 Go to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi

I noted that
org.eclipse.xtext.xbase.typesystem.override.ResolvedOperations.getDeclaredOperations()
computes the field declaredOperations lazily, delegating to

protected List<IResolvedOperation> computeDeclaredOperations() {
JvmType rawType = getRawType();
if (!(rawType instanceof JvmDeclaredType)) {
return Collections.emptyList();
}
List<IResolvedOperation> result = Lists.newArrayList();
for(IResolvedOperation operation: getAllOperations()) {
if (operation.getDeclaration().getDeclaringType() == rawType) {
result.add(operation);
}
}
return Collections.unmodifiableList(result);
}

So this method first computes all operations and then selects only the
ones effectively declared in the very JvmType. This means that all the
operations from supertypes are collected (performed by
computeAllOperations), which are useless if you need only the declared
ones. Is that intentional?

I mean computeDeclaredOperations() could be implemented as a simplified
version of computeAllOperations() where supertypes are not inspected at all.

(I realized that in my DSL where I have a custom semantics for
"inheritance" and "method overriding" which, in the case of declared
operations, should not take place).

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book


Re: ResolvedOperations.getDeclaredOperations [message #1506172 is a reply to message #1506089] Wed, 10 December 2014 16:35 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Lorenzo,

yes, that would work. Could you provide a patch or file a ticket?

Best,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: ResolvedOperations.getDeclaredOperations [message #1506252 is a reply to message #1506172] Wed, 10 December 2014 18:04 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 10/12/2014 17:35, Sebastian Zarnekow wrote:
> Hi Lorenzo,
>
> yes, that would work. Could you provide a patch or file a ticket?

I've done both :)

https://bugs.eclipse.org/bugs/show_bug.cgi?id=454786

I see that ResolvedOperations has been replaced by ResolvedFeatures but
they seem to do the same.

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book


Previous Topic:Xtype's ArrayBrackets
Next Topic:strange behavior for navigation to elements
Goto Forum:
  


Current Time: Thu Apr 25 03:44:16 GMT 2024

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

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

Back to the top