DevBoost / JaMoPP

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.
17 stars 18 forks source link

Make JavaLayoutUtil a static Utility #18

Open BenjaminKlatt opened 10 years ago

BenjaminKlatt commented 10 years ago

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:

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.