Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » MoDisco » Infix Operation Code Elements Missing from JavaCode Model to KDM Model
Infix Operation Code Elements Missing from JavaCode Model to KDM Model [message #657644] Thu, 03 March 2011 15:04 Go to next message
Suhrit Rimal is currently offline Suhrit RimalFriend
Messages: 6
Registered: September 2010
Junior Member
Hi,
I posted this message as a reply in previous thread. No one replied so I thought no one saw it. Sorry for cross posting.

I installed Indigo and Modisco 9.
When I compare helios+8.X model and indigo +9.0 model its same. I think some information gets lost in KDM model when being trasnformed from Java Model.

I am using following code:
public class test {

public void echo(){
String message = "hello";
String newMessage ="world";
System.out.println(message+newMessage);
}
}

In Java Model What I can see is that message and newMessage gets add the information is still there but when it comes to KDM Model Information gets lost. I tried different variation. If inside println function we keep direct string something like System.out.println("hello"+"world"); the information is preserved but variables are never there even if it is direct string + some variable. Seecorresponding JavaCodeModel and KDM Model.

JavaCodeModel

<statements xsi:type="java:ExpressionStatement" originalCompilationUnit="//@compilationUnits.0">
<expression xsi:type="java:MethodInvocation" originalCompilationUnit="//@compilationUnits.0" method=" //@ownedElements.1/@ownedPackages.1/@ownedElements.1/@bodyDe clarations.0 ">
<arguments xsi:type="java:InfixExpression" originalCompilationUnit="//@compilationUnits.0" operator="+">
<rightOperand xsi:type="java:SingleVariableAccess" variable=" //@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@bod y/@statements.1/@fragments.0 "/>
<leftOperand xsi:type="java:SingleVariableAccess" variable=" //@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@bod y/@statements.0/@fragments.0 "/>
</arguments>
<expression xsi:type="java:SingleVariableAccess" variable=" //@ownedElements.1/@ownedPackages.0/@ownedElements.3/@bodyDe clarations.0/@fragments.0 ">
<qualifier xsi:type="java:TypeAccess" type="//@ownedElements.1/@ownedPackages.0/@ownedElements.3"/ >
</expression>
</expression>
</statements>

KDM model:

<codeElement xsi:type="action:ActionElement" name="expression statement" kind="expression statement">
<source language="java">
<region file="//@model.2/@inventoryElement.0" language="java"/>
</source>
<codeElement xsi:type="action:ActionElement" name="method invocation" kind="method invocation">
<source language="java">
<region file="//@model.2/@inventoryElement.0" language="java"/>
</source>
<codeElement xsi:type="action:ActionElement" name="+" kind="infix expression">
<source language="java">
<region file="//@model.2/@inventoryElement.0" language="java"/>
</source>
</codeElement>
<actionRelation xsi:type="action:Calls" to=" //@model.1/@codeElement.0/@codeElement.1/@codeElement.1/@cod eElement.0 " from=" //@model.0/@codeElement.0/@codeElement.0/@codeElement.0/@cod eElement.1/@codeElement.2/@codeElement.0 "/>
</codeElement>
</codeElement>


Well I dont know whether its a bug or KDM is just not meant to hold that much of information.
If I change message to "hello" inside function println I can see following things:

Java Code:
System.out.println("hello"+newMessage);

Java Model:
<statements xsi:type="java:ExpressionStatement" originalCompilationUnit="//@compilationUnits.0">
<expression xsi:type="java:MethodInvocation" originalCompilationUnit="//@compilationUnits.0" method=" //@ownedElements.1/@ownedPackages.1/@ownedElements.1/@bodyDe clarations.0 ">
<arguments xsi:type="java:InfixExpression" originalCompilationUnit="//@compilationUnits.0" operator="+">
<rightOperand xsi:type="java:SingleVariableAccess" variable=" //@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@bod y/@statements.1/@fragments.0 "/>
<leftOperand xsi:type="java:StringLiteral" originalCompilationUnit="//@compilationUnits.0" escapedValue="&quot;hello&quot;"/>
</arguments>
<expression xsi:type="java:SingleVariableAccess" variable=" //@ownedElements.1/@ownedPackages.0/@ownedElements.3/@bodyDe clarations.0/@fragments.0 ">
<qualifier xsi:type="java:TypeAccess" type="//@ownedElements.1/@ownedPackages.0/@ownedElements.3"/ >
</expression>
</expression>
</statements>

KDM MOdel

<codeElement xsi:type="action:ActionElement" name="method invocation" kind="method invocation">
<source language="java">
<region file="//@model.2/@inventoryElement.0" language="java"/>
</source>
<codeElement xsi:type="action:ActionElement" name="+" kind="infix expression">
<source language="java">
<region file="//@model.2/@inventoryElement.0" language="java"/>
</source>
<codeElement xsi:type="code:Value" name="string literal" type="//@model.0/@codeElement.1/@codeElement.9" ext="&quot;hello&quot;">
<source language="java">
<region file="//@model.2/@inventoryElement.0" language="java"/>
</source>
</codeElement>
</codeElement>
<actionRelation xsi:type="action:Calls" to=" //@model.1/@codeElement.0/@codeElement.1/@codeElement.1/@cod eElement.0 " from=" //@model.0/@codeElement.0/@codeElement.0/@codeElement.0/@cod eElement.1/@codeElement.2/@codeElement.0 "/>
</codeElement>

SO my thoughts are that there is CodeElement missing for newMessage storable unit where infix operation is performed.

If this is a bug I can give try fixing it I know the basics of MDT i guess its some ATL file where i need to do changes. Can you tell me where this file is and how to make changes to it.


Thanks
Suhrit
Re: Infix Operation Code Elements Missing from JavaCode Model to KDM Model [message #657702 is a reply to message #657644] Thu, 03 March 2011 16:37 Go to previous messageGo to next message
Gabriel BARBIER is currently offline Gabriel BARBIERFriend
Messages: 106
Registered: July 2009
Senior Member
Hello Suhrit,

Thanks for pushing forward.
You are right, it seems there is a bug in ATL transformation. You could find it in plug-in org.eclipse.gmt.modisco.java.discoverer. It has been hidden in package org.eclipse.gmt.modisco.java.actions.resources.transformatio ns, I recommend that you create a separate ATL project, then copy javaToKdm.atl file before making modifications.

Also, I recommend you to fill a bug in bugzilla ( https://bugs.eclipse.org/bugs/enter_bug.cgi?product=MDT.MoDi sco&component=Main)
to track this, and to be able to contribute a patch (that's the eclipse way).

Regards,
Gabriel
Re: Infix Operation Code Elements Missing from JavaCode Model to KDM Model [message #657855 is a reply to message #657702] Fri, 04 March 2011 11:01 Go to previous messageGo to next message
Gabriel BARBIER is currently offline Gabriel BARBIERFriend
Messages: 106
Registered: July 2009
Senior Member
Hello Suhrit,

To be able to validate the bug, I have added a test in svn (more details on bug).
Fell free to modify it in concordance with your correction.

Regards
Gabriel
Re: Infix Operation Code Elements Missing from JavaCode Model to KDM Model [message #657895 is a reply to message #657855] Fri, 04 March 2011 14:32 Go to previous message
Suhrit Rimal is currently offline Suhrit RimalFriend
Messages: 6
Registered: September 2010
Junior Member
Thanx,

I will try to make the changes. Though I know the concept I have only writtern person to family kind of transformation dont know how long will it take but will deffinitely give a shot. I will write to you if i face any difficulties.

Thanx again
Previous Topic:Just downloaded Eclipse, what is next?
Next Topic:Integrating support for Javascript
Goto Forum:
  


Current Time: Thu Apr 18 19:36:15 GMT 2024

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

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

Back to the top