Classes from class diagrams in the same package cannot be resolved in generated Java code
Issue description
The class-diagram generator creates an individual Java package for each class diagram. Therefore, classes declared in different class diagrams cannot reference each other, even if both class diagrams are located in the same package.
Reproduction
Example CDs:
package test;
classdiagram CD1 {
public class A {
}
}
package test;
classdiagram CD2 {
public class B extends A {
}
}
Actual behavior
The generator creates separate Java packages for the class diagrams. In this example, A is generated in package test.CD1, while B is generated in package test.CD2.
The generated class B contains code equivalent to:
package test.CD2;
public class B extends A {
}
Since A is located in test.CD1, it cannot be resolved from test.CD2. This produces a Java compiler error:
ERROR in ...\test\CD2\B.java (at line 29)
public class B extends A {
^
A cannot be resolved to a type
Expected behavior
Classes declared in class diagrams that share the same package should be accessible from each other in the generated Java code.
For the example above, A and B should be generated into the same Java package, for example:
Alternatively, the generator must emit the required imports so that B can resolve and extend A.
Impact
Any CD that references classes from another class diagram in the same CD package can generate Java code that does not compile. This prevents splitting related models across multiple class diagrams while retaining package-level visibility.
Classes from class diagrams in the same package cannot be resolved in generated Java code
Issue description
The class-diagram generator creates an individual Java package for each class diagram. Therefore, classes declared in different class diagrams cannot reference each other, even if both class diagrams are located in the same package.
Reproduction
Example CDs:
Actual behavior
The generator creates separate Java packages for the class diagrams. In this example,
Ais generated in packagetest.CD1, whileBis generated in packagetest.CD2.The generated class
Bcontains code equivalent to:Since
Ais located intest.CD1, it cannot be resolved fromtest.CD2. This produces a Java compiler error:Expected behavior
Classes declared in class diagrams that share the same package should be accessible from each other in the generated Java code.
For the example above,
AandBshould be generated into the same Java package, for example:Alternatively, the generator must emit the required imports so that
Bcan resolve and extendA.Impact
Any CD that references classes from another class diagram in the same CD package can generate Java code that does not compile. This prevents splitting related models across multiple class diagrams while retaining package-level visibility.