Apache Commons logo Commons Weaver

Apache Commons Weaver Normalizer

The Normalizer module merges identical anonymous class definitions into a single type, thereby “normalizing” them and reducing their collective footprint on your archive and more importantly on your JVM.

Considers only the simplest case in which:

  • no methods are implemented

  • the constructor only calls the super constructor

An anonymous class which violates these restrictions will be considered too complex and skipped in the interest of correctness.


The NormalizerWeaver supports the following options:

  • normalizer.superTypes : comma-delimited list of types whose subclasses/implementations should be normalized, e.g. javax.enterprise.util.TypeLiteral.

  • normalizer.targetPackage : package to which merged types should be added.