Reversing "implicit" imports for inheritance fail
|Status:||Resolved||Start date:||09 August 2012|
|Assignee:||Christophe Malgouyres||% Done:|
I’ve had a case where reverse-engineering fails to identify the Interface used by a Class, though it is in the Java source code I’m reversing.
After a bit of digging around, I’ve found exactly how to reproduce this : Java does not need an “import” clause if the Interface is in the same package as the Class. And JavaDesigner fails to locate the Interface that’s implemented when there is no “import” clause for this Interface.
See included failing and working examples. This is a show-stopper to using reverse engineering on our projects :(
#2 Updated by Michaël Piffret almost 8 years ago
This one is driving me mad : I’m finding very strange bugs in inheritance and associations too… Reversing only seems to work if the imported class is imported before, meaning imports must be in alphabetical order (B may import A, A may not import B). I have uploaded the examples I’ve been using.
The problem goes away after round tripping : reverse semi-fails, code generation works, round-tripping updates the model properly. Am I doing something very wrong ?
I am using Modelio 2.2 (Extensions 188.8.131.5220) and JavaDesigner 2.1 (184.108.40.20620). I’m trying to prototype using Modelio to reverse our projects to introduce MDA, and it doesn’t look good yet.
#3 Updated by Christophe Malgouyres over 7 years ago
- Status changed from New to Assigned
- Assignee set to Christophe Malgouyres
- Target version set to 2.1.01
I’ve been trying to reverse your samples, and as far as I can tell, I might have found what is going on: in the source reverse wizard, the namespace lookup root was always the file typed in the upper zone, instead of the tree selection.
You should be able to workaround your lookup problems using the wizard like this: 1. Open the reverse wizard. 2. Set the reverse root, for example “c:\test\association_test\association_different_packages”. 3. Select the package to reverse, for example “com”. 4. Launch the reverse.
By the way, I noticed errors in inheritance_test/inheritance_fails => “MonInterface” doesn’t exist and therefore can’t be found. “com.a.MonParent” should be “com.parent.MonParent”…