Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Missing type info in JvmType model
Missing type info in JvmType model [message #1057941] Thu, 09 May 2013 23:09 Go to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
Hi,

I'm using Xbase and the JvmType model for a DSL that among others
supports referring to Swing events by a simple name, e.g. action for a
JTextField. To find out which events are allowed for a specific class, I
search among all the features for operations with names like
addXxxListener and removeXxxListener. If there exists a pair like that
Xxx is an valid action name. E.g. JTextField has addActionListener and
removeActionListener. As an extra check I test that the qualified name
of the type of the first parameter of both are the same, in this case
ActionListener. I also use this type later, to generate code for an
implementation of the listener.

The strange thing is that suddenly the JvmType model seems to be missing
some types. E.g. JTextField.removeActionListener has type info for its
first parameter, while JTextField.addActionListener hasn't (it's null).
Hence, my code crashes when testing their qualified name. What can be
causing this kind of behavior (it worked at some point, but now
consistently doesn't)? What code is actually loading this information
and from where?

Regards,

Hallvard
Re: Missing type info in JvmType model [message #1058064 is a reply to message #1057941] Fri, 10 May 2013 17:41 Go to previous message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
Hi,

My fault, sorry for the disturbance. My code created a new class that
implemented a listener interface. Hence, I had added a (type reference
to) the listener interface to the class' superTypes list. Unfortunately,
this was the same type reference that was in the JvmType model, so it
was effectively removed from its previous container, in this case the
addActionListener method's first formal parameter. Adding a call to
typeRef.cloneWithProxies solved it.

I notice that all calls to builder methods, like toField, take care to
do this, but when adding directly to lists like a class' superTypes,
this will not happen.

Hallvard

On 09.05.13 16.09, Hallvard Trætteberg wrote:
>
> I'm using Xbase and the JvmType model for a DSL that among others
> supports referring to Swing events by a simple name, e.g. action for a
> JTextField. To find out which events are allowed for a specific class, I
> search among all the features for operations with names like
> addXxxListener and removeXxxListener. If there exists a pair like that
> Xxx is an valid action name. E.g. JTextField has addActionListener and
> removeActionListener. As an extra check I test that the qualified name
> of the type of the first parameter of both are the same, in this case
> ActionListener. I also use this type later, to generate code for an
> implementation of the listener.
>
> The strange thing is that suddenly the JvmType model seems to be missing
> some types. E.g. JTextField.removeActionListener has type info for its
> first parameter, while JTextField.addActionListener hasn't (it's null).
> Hence, my code crashes when testing their qualified name. What can be
> causing this kind of behavior (it worked at some point, but now
> consistently doesn't)? What code is actually loading this information
> and from where?
>
> Regards,
>
> Hallvard
Previous Topic:XText entry rule
Next Topic: emulate return functions and objects in xbase???
Goto Forum:
  


Current Time: Fri Mar 29 10:26:29 GMT 2024

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

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

Back to the top