JaMoPP can parse Java source and byte code into EMF-based models and vice versa. It preserves source formatting and can be used for code analysis and refactoring.
The JavaLayoutUtil class is a pure utility class. All methods are stateless and threadsafe.
In the current implementation, it is instantiated twice per resource. Once as private field in JavaSourceOrClassFileResource and once in the parent class JavaResource.
It would be better to follow the typical design of utility classes:
make the class final
make the constructor private
make the methods static
let the consumers call the static methods and not initializing any instances of JavaResource
While JavaSourceOrClassFileResource is a manually maintained class, JavaResource is generated by EMF Text an moving it into the manually maintained source folder is not a reasonable change.
The EMF Text code generation should be adapted to generate JavaLayoutUtil as a real utility class and generate JavaResource in such a way that it makes use of the static utlity methods.
I did identify the Utility class generator in EMF Text but not the generator for the concrete resource generator. So I hope the issue will find it's way when I leave it here.
The JavaLayoutUtil class is a pure utility class. All methods are stateless and threadsafe.
In the current implementation, it is instantiated twice per resource. Once as private field in
JavaSourceOrClassFileResource
and once in the parent classJavaResource
.It would be better to follow the typical design of utility classes:
While JavaSourceOrClassFileResource is a manually maintained class, JavaResource is generated by EMF Text an moving it into the manually maintained source folder is not a reasonable change.
The EMF Text code generation should be adapted to generate JavaLayoutUtil as a real utility class and generate JavaResource in such a way that it makes use of the static utlity methods. I did identify the Utility class generator in EMF Text but not the generator for the concrete resource generator. So I hope the issue will find it's way when I leave it here.