This version of Lorenz consolidates the work towards supporting additional formats, even going as far to support those formats. A number of breaking changes have been made in order to support these formats, in addition to new constructs to make using Lorenz easier.

The following formats are now supported:

Big thanks to @Minecrell, for his help towards this release!

Changes

Type Model

Lorenz 0.4.0 has received a major overhaul of the type model, migrating that section of the codebase over to its own project (Bombe), and introducing a great deal of safety to types and their uses.

  • PrimitiveType has been split up to BaseType and VoidType, becoming more in line with the JVM specification.
    • However, there now exists a PrimtiveType interface that both BaseType and VoidType inherit.
  • FieldType has been introduced, providing type safety for field types (void is not a valid field or parameter descriptor as per the JVM specification).
  • The #getObfuscated() and #getDeobfuscated(MappingSet) methods no longer exist in either Type or MethodDescriptor.
    • Calls to #getObfuscated() should be replaced with calls to #toString().
    • Calls to #getDeobfuscated(MappingSet) should be replaced with calls to MappingSet#deobfuscate for the appropriate type.
  • MethodDescriptor#compile() has been renamed to MethodDescriptor#of().
  • The ‘convenience’ signature constructors have been replaced with #of(String, String) methods.

I/O

Previously Lorenz had only supported text-based mapping formats and gave them a rather strict means of being implemented. Lorenz 0.4.0 has generified the I/O classes to be more adaptable to a greater number of situations, including binary-based formats.

The provided implementations of mapping format I/O classes have also been moved to their own packages in preparation of the modularisation that will happen in Lorenz 0.5.0 (more on that later).

  • MappingsReader and MappingsWriter have been generified and are no longer dependent on text-based formats.
    • There is abstract classes for both text-based formats and binary-based formats.
  • The Processors of text-based formats are now contained as inner classes of their parent reader.
    • The processors no longer use Guava’s LineProcessor, instead using Java’s Consumer.
  • MappingsReader#parse() has been refactored to MappingsReader#read() becoming more consistent with the reader naming.
  • The mapping readers will now throw exceptions when given bad input, as opposed to ignoring it as it did in the past.
    • Do note that SRG package mappings are’nt considered bad input, and will be silently ignored.
    • This remains to be something that needs to be looked into further, and expect changes to be made in 0.5.0/1.0.0.
  • Introduced a MappingFormat interface, with convenience methods that will be useful to consumers of Lorenz.
    • Notably there are convenience methods for operating with Paths directly.
      • MappingFormat#read(Path)
      • MappingFormat#write(MappingSet, Path)
    • There is a psuedo-enumeration of MappingFormats implemented within Lorenz available through the MappingFormats class.

Other

These changes, though notable, are not large enough to warrant their own section. Most of the changes listed here are features / changes to better support the new formats that Lorenz supports.

  • Fields are now stored using their signature as a key, not their obfuscated name.
  • FieldTypeProviders no longer guarantee the availability of field type information.
  • MappingSet makes use of a CascadingFieldTypeProvider allowing multiple providers to be used.
  • Method Parameter Mappings are now supported, using the index of the parameter as the obfuscated name and key.
    • To make this change, MemberMapping was altered to become generic - allowing for any parent mapping of type Mapping.
  • The dependency on Guava has been dropped.

Modularisation

As previously mentioned, Lorenz 0.5.0 will have complete modularisation. This will go further than the “primitive” modularisation present in 0.4.0. There will exist individual modules for each format supported in Lorenz, as opposed to being included in the base module.

Complete modularisation was deferred until 0.5.0 to not hold back any further on a 0.4.0 release, and allow for adequate time to consider a few technical points that would be nice to have solved.

Lorenz-ASM

The first module has appeared! Lorenz-ASM provides a number of utilities that may be useful when using Lorenz with ASM.

  • An implementation of ASM’s Remapper class, backed by a MappingSet and an InheritanceProvider (from Bombe).
    • This class was previously available through Survey and notably the Lorenz version lacks the SignatureAdapter that can handle broken signatures produced by obfuscators. This omission was made simply as fixing issues with obfuscators does not fall within Lorenz’s remit.
    • Bombe-ASM (which Lorenz-ASM depends on) has 2 implementations of InheritanceProvider.
  • An implementation of Lorenz’s FieldTypeProvider, backed by a SourceSet (from Bombe-ASM).