Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 361915 - Generation of KDM model from Java: Missing parameter entry
Summary: Generation of KDM model from Java: Missing parameter entry
Status: NEW
Alias: None
Product: MoDisco
Classification: Modeling
Component: Main (show other bugs)
Version: 0.10.0   Edit
Hardware: PC Windows 7
: P5 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-25 08:25 EDT by Florian CLA
Modified: 2012-12-19 09:06 EST (History)
1 user (show)

See Also:


Attachments
Changes to javaToKdm.atl (783 bytes, text/plain)
2011-10-27 15:39 EDT, Florian CLA
no flags Details
javaToKdm.atl patch (3.22 KB, patch)
2011-10-27 16:00 EDT, Florian CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Florian CLA 2011-10-25 08:25:55 EDT
int i = 3;
int x = method2(i, "example", method3());

generates a HasValue for x, pointing to:

    <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="code:Value" name="string literal" type="//@model.0/@codeElement.1/@codeElement.9" ext="&quot;example&quot;">
        <source language="java">
          <region file="//@model.2/@inventoryElement.0" language="java"/>
        </source>
      </codeElement>
      <codeElement xsi:type="action:ActionElement" name="method invocation" kind="method invocation">
        <source language="java">
          <region file="//@model.2/@inventoryElement.0" language="java"/>
        </source>
        <actionRelation xsi:type="action:Calls" to="//@model.0/@codeElement.0/@codeElement.0/@codeElement.3" from="//@model.1/@codeElement.3/@codeElement.1"/>
      </codeElement>
      <actionRelation xsi:type="action:Calls" to="//@model.0/@codeElement.0/@codeElement.0/@codeElement.2" from="//@model.1/@codeElement.3"/>
    </codeElement>

The string "example" and the invocation of "method3()" is listed. However, that "i" is a parameter to method2 is not included.
Comment 1 Gregoire Dupe CLA 2011-10-26 03:47:12 EDT
Hello,

Thanks for reporting this job. I’ m not sure that we will have time to fix this bug in the next month (MoDisco team is working hard to finish the migration to EMF Facet).

If you can write a path and contribute it, this would help to decrease the fixing delay.

Please, can you precise the EMF Facet's version in which you found this bug.

Regards,
Gregoire Dupe
Comment 2 Florian CLA 2011-10-27 15:39:35 EDT
Created attachment 206091 [details]
Changes to javaToKdm.atl
Comment 3 Florian CLA 2011-10-27 15:46:28 EDT
(In reply to comment #2)
> Created attachment 206091 [details]
> Changes to javaToKdm.atl

Hello,

I have fixed the "bug". It had something to do with the exclusion of SingleVariableAccess (in the ATL file) and not handling it in every method. I also had to wrap an ActionElement around the Reads Element (that is proposed by OMG) because the order of elements is destroyed otherwise.

3 Methods handle SingleVariableAccess on their own. About 10 methods need no special handling (and are really missing SingleVariableAccess handling). Therefore, I propose to write a second helper method for the 3 methods (the old filterExpression). The new filterExpression method, that resolves many missing elements, is attached as a patch.

Best Regards,
Florian
Comment 4 Florian CLA 2011-10-27 16:00:33 EDT
Created attachment 206092 [details]
javaToKdm.atl patch
Comment 5 Gregoire Dupe CLA 2011-10-28 05:34:50 EDT
Hello,

Thank you for this patch.

The version 0.10.0 has not been released yet. Are you using a nightly build ? (It’s not recommended to use a nightly build).

If this bug exists in 0.9 we could commit this path for second service release (0.9.2, February 2012). Otherwise, we would only have to commit this bug in the trunk (corresponding to the version 0.10.0 which will be released in June 2012).
Please, can you check those details? This will help me to plan the release of this patch.

Please, could you also provide a unit test? This is really help full to do the code review.

Regards,
Grégoire
Comment 6 Florian CLA 2011-10-28 07:19:18 EDT
(In reply to comment #5)
Hello,

I tested it with Version 0.9, 0.9.1 and 0.10.0 and the bug is existing in all versions.

Unit Testing these changes would consume too much time for me right now, sorry.

It would include about 13 generated elements and testing with two and one variable accesses.

I saw a unit test in JavaProject2KdmTest.java with the method "testBug338874_InfixExpressionWithVariables" which would be a test method for the infix expression and variable accesses. Same scheme can be applied to other elements.

Regards,
Florian