Infix Operation Code Elements Missing from JavaCode Model to KDM Model [message #657644] |
Thu, 03 March 2011 10:04  |
Eclipse User |
|
|
|
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=""hello""/>
</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=""hello"">
<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
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03746 seconds