Skip to content

Make JavaLayoutUtil a static Utility #18

@BenjaminKlatt

Description

@BenjaminKlatt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions